public void C_Endpoint_NewV6() { if (!C.SL_IPV6_ENABLED) { return; } Assert.True(IPAddress.TryParse("fe80::300e:5130:704b:a647%21", out IPAddress netip)); SL.C.Context ctx = default; Assert.True(API.Setup(&ctx)); try { C.Endpoint endpoint = C.Endpoint.NewV6(&ctx, _port, C.IPv6.New(0xfe80, 0, 0, 0, 0x300e, 0x5130, 0x704b, 0xa647)); Assert.AreEqual(ctx.af_inet6, endpoint.af); Assert.AreEqual(_port, endpoint.port); fixed(byte *pnetip = netip.GetAddressBytes()) Assert.True(Util.MemCmp((byte *)&endpoint.addr6, 0, pnetip, 0, C.SL_IP6_SIZE)); Assert.True(API.Cleanup(&ctx)); } finally { API.Cleanup(&ctx); } }
public void StartListenStop() { void *service = null; SL.C.Context ctx = default; SL.C.Endpoint local_endpoint = SL.C.Endpoint.NewV4(&ctx, _port, SL.C.IPv4.New(127, 0, 0, 1)); Assert.True(SVL.API.Setup(&ctx, &service)); Assert.True(SVL.API.Start(service, &local_endpoint)); Assert.True(SVL.API.Stop(service)); Assert.True(SVL.API.Cleanup(&ctx, &service)); }
public void C_Endpoint_NewV4() { Assert.True(IPAddress.TryParse("127.0.0.1", out IPAddress netip)); SL.C.Context ctx = default; Assert.True(API.Setup(&ctx)); try { C.Endpoint endpoint = C.Endpoint.NewV4(&ctx, _port, C.IPv4.New(127, 0, 0, 1)); Assert.AreEqual(ctx.af_inet, endpoint.af); Assert.AreEqual(_port, endpoint.port); fixed(byte *pnetip = netip.GetAddressBytes()) Assert.True(Util.MemCmp((byte *)&endpoint.addr4, 0, pnetip, 0, sizeof(C.IPv4))); Assert.True(API.Cleanup(&ctx)); } finally { API.Cleanup(&ctx); } }