|
@@ -16,115 +16,106 @@ namespace UNet
|
|
|
public const int ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT = 1;
|
|
public const int ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT = 1;
|
|
|
public const int ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT = 255;
|
|
public const int ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT = 255;
|
|
|
public const int ENET_PROTOCOL_MAXIMUM_PEER_ID = 0xfff;
|
|
public const int ENET_PROTOCOL_MAXIMUM_PEER_ID = 0xfff;
|
|
|
- public const uint ENET_VERSION = (1 << 16) | (3 << 8) | (10);
|
|
|
|
|
public const uint ENET_HOST_ANY = 0;
|
|
public const uint ENET_HOST_ANY = 0;
|
|
|
public const uint ENET_HOST_BROADCAST = 0xffffffff;
|
|
public const uint ENET_HOST_BROADCAST = 0xffffffff;
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_address_set_host")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_address_set_host")]
|
|
|
internal static extern int EnetAddressSetHost(ref ENetAddress address, string hostName);
|
|
internal static extern int EnetAddressSetHost(ref ENetAddress address, string hostName);
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_address_get_host")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_address_get_host")]
|
|
|
internal static extern int EnetAddressGetHost(
|
|
internal static extern int EnetAddressGetHost(
|
|
|
ref ENetAddress address, StringBuilder hostName, uint nameLength);
|
|
ref ENetAddress address, StringBuilder hostName, uint nameLength);
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl,
|
|
|
|
|
- EntryPoint = "enet_address_get_host_ip")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_address_get_host_ip")]
|
|
|
internal static extern int EnetAddressGetHostIp(
|
|
internal static extern int EnetAddressGetHostIp(
|
|
|
ref ENetAddress address, StringBuilder hostIp, uint ipLength);
|
|
ref ENetAddress address, StringBuilder hostIp, uint ipLength);
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_deinitialize")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_deinitialize")]
|
|
|
internal static extern void EnetDeinitialize();
|
|
internal static extern void EnetDeinitialize();
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_initialize")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_initialize")]
|
|
|
internal static extern int EnetInitialize();
|
|
internal static extern int EnetInitialize();
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_host_create")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_host_create")]
|
|
|
internal static extern IntPtr EnetHostCreate(
|
|
internal static extern IntPtr EnetHostCreate(
|
|
|
ref ENetAddress address, uint peerLimit, uint channelLimit, uint incomingBandwidth,
|
|
ref ENetAddress address, uint peerLimit, uint channelLimit, uint incomingBandwidth,
|
|
|
uint outgoingBandwidth);
|
|
uint outgoingBandwidth);
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_host_create")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_host_create")]
|
|
|
internal static extern IntPtr EnetHostCreate(
|
|
internal static extern IntPtr EnetHostCreate(
|
|
|
IntPtr address, uint peerLimit, uint channelLimit, uint incomingBandwidth,
|
|
IntPtr address, uint peerLimit, uint channelLimit, uint incomingBandwidth,
|
|
|
uint outgoingBandwidth);
|
|
uint outgoingBandwidth);
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_host_destroy")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_host_destroy")]
|
|
|
internal static extern void EnetHostDestroy(IntPtr host);
|
|
internal static extern void EnetHostDestroy(IntPtr host);
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_host_connect")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_host_connect")]
|
|
|
internal static extern IntPtr EnetHostConnect(
|
|
internal static extern IntPtr EnetHostConnect(
|
|
|
IntPtr host, ref ENetAddress address, uint channelCount, uint data);
|
|
IntPtr host, ref ENetAddress address, uint channelCount, uint data);
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_host_broadcast")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_host_broadcast")]
|
|
|
internal static extern void EnetHostBroadcast(IntPtr host, byte channelID, IntPtr packet);
|
|
internal static extern void EnetHostBroadcast(IntPtr host, byte channelID, IntPtr packet);
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_host_compress")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_host_compress")]
|
|
|
internal static extern void EnetHostCompress(IntPtr host, IntPtr compressor);
|
|
internal static extern void EnetHostCompress(IntPtr host, IntPtr compressor);
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl,
|
|
|
|
|
- EntryPoint = "enet_host_compress_with_range_coder")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_host_compress_with_range_coder")]
|
|
|
internal static extern int EnetHostCompressWithRangeCoder(IntPtr host);
|
|
internal static extern int EnetHostCompressWithRangeCoder(IntPtr host);
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl,
|
|
|
|
|
- EntryPoint = "enet_host_channel_limit")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_host_channel_limit")]
|
|
|
internal static extern void EnetHostChannelLimit(IntPtr host, uint channelLimit);
|
|
internal static extern void EnetHostChannelLimit(IntPtr host, uint channelLimit);
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl,
|
|
|
|
|
- EntryPoint = "enet_host_bandwidth_limit")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_host_bandwidth_limit")]
|
|
|
internal static extern void EnetHostBandwidthLimit(
|
|
internal static extern void EnetHostBandwidthLimit(
|
|
|
IntPtr host, uint incomingBandwidth, uint outgoingBandwidth);
|
|
IntPtr host, uint incomingBandwidth, uint outgoingBandwidth);
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_host_flush")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_host_flush")]
|
|
|
internal static extern void EnetHostFlush(IntPtr host);
|
|
internal static extern void EnetHostFlush(IntPtr host);
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_host_check_events"
|
|
|
|
|
- )]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_host_check_events")]
|
|
|
internal static extern int EnetHostCheckEvents(IntPtr host, ENetEvent ev);
|
|
internal static extern int EnetHostCheckEvents(IntPtr host, ENetEvent ev);
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_host_service")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_host_service")]
|
|
|
internal static extern int EnetHostService(IntPtr host, ENetEvent ev, uint timeout);
|
|
internal static extern int EnetHostService(IntPtr host, ENetEvent ev, uint timeout);
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_time_get")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_time_get")]
|
|
|
internal static extern uint EnetTimeGet();
|
|
internal static extern uint EnetTimeGet();
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_time_set")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_time_set")]
|
|
|
internal static extern void EnetTimeSet(uint newTimeBase);
|
|
internal static extern void EnetTimeSet(uint newTimeBase);
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_packet_create")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_packet_create")]
|
|
|
internal static extern IntPtr EnetPacketCreate(byte[] data, uint dataLength, PacketFlags flags);
|
|
internal static extern IntPtr EnetPacketCreate(byte[] data, uint dataLength, PacketFlags flags);
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_packet_destroy")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_packet_destroy")]
|
|
|
internal static extern void EnetPacketDestroy(IntPtr packet);
|
|
internal static extern void EnetPacketDestroy(IntPtr packet);
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_packet_resize")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_packet_resize")]
|
|
|
internal static extern int EnetPacketResize(IntPtr packet, uint dataLength);
|
|
internal static extern int EnetPacketResize(IntPtr packet, uint dataLength);
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl,
|
|
|
|
|
- EntryPoint = "enet_peer_throttle_configure")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_peer_throttle_configure")]
|
|
|
internal static extern void EnetPeerThrottleConfigure(
|
|
internal static extern void EnetPeerThrottleConfigure(
|
|
|
IntPtr peer, uint interval, uint acceleration, uint deceleration);
|
|
IntPtr peer, uint interval, uint acceleration, uint deceleration);
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_peer_send")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_peer_send")]
|
|
|
internal static extern int EnetPeerSend(IntPtr peer, byte channelID, IntPtr packet);
|
|
internal static extern int EnetPeerSend(IntPtr peer, byte channelID, IntPtr packet);
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_peer_receive")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_peer_receive")]
|
|
|
internal static extern IntPtr EnetPeerReceive(IntPtr peer, out byte channelID);
|
|
internal static extern IntPtr EnetPeerReceive(IntPtr peer, out byte channelID);
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_peer_reset")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_peer_reset")]
|
|
|
internal static extern void EnetPeerReset(IntPtr peer);
|
|
internal static extern void EnetPeerReset(IntPtr peer);
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_peer_ping")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_peer_ping")]
|
|
|
internal static extern void EnetPeerPing(IntPtr peer);
|
|
internal static extern void EnetPeerPing(IntPtr peer);
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl,
|
|
|
|
|
- EntryPoint = "enet_peer_disconnect_now")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_peer_disconnect_now")]
|
|
|
internal static extern void EnetPeerDisconnectNow(IntPtr peer, uint data);
|
|
internal static extern void EnetPeerDisconnectNow(IntPtr peer, uint data);
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_peer_disconnect")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_peer_disconnect")]
|
|
|
internal static extern void EnetPeerDisconnect(IntPtr peer, uint data);
|
|
internal static extern void EnetPeerDisconnect(IntPtr peer, uint data);
|
|
|
|
|
|
|
|
- [DllImport(LIB, CallingConvention = CallingConvention.Cdecl,
|
|
|
|
|
- EntryPoint = "enet_peer_disconnect_later")]
|
|
|
|
|
|
|
+ [DllImport(LIB, EntryPoint = "enet_peer_disconnect_later")]
|
|
|
internal static extern void EnetPeerDisconnectLater(IntPtr peer, uint data);
|
|
internal static extern void EnetPeerDisconnectLater(IntPtr peer, uint data);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|