1 [CCode (cprefix="SDLNet_", cheader_filename="SDL_net.h")]
3 [CCode (cname="SDLNet_Linked_Version")]
4 public static SDL.Version linked();
6 [CCode (cname="SDLNet_Init")]
7 public static int init();
9 [CCode (cname="SDLNet_Quit")]
10 public static void quit();
12 [CCode (cname="SDLNet_Write16")]
13 public static void write16(uint16 value, void *area);
15 [CCode (cname="SDLNet_Write32")]
16 public static void write32(uint value, void *area);
18 [CCode (cname="SDLNet_Read16")]
19 public static uint16 read16(void *area);
21 [CCode (cname="SDLNet_Read32")]
22 public static uint read32(void *area);
27 [CCode (cname="IPaddress", free_function="g_free", has_type_id=false)]
28 public struct IPAddress {
32 [CCode (cname="INADDR_ANY")]
33 public const uint ANY;
35 [CCode (cname="INADDR_NONE")]
36 public const uint NONE;
38 [CCode (cname="SDLNet_ResolveHost")]
39 public static int from_host(out IPAddress address, string? host, uint16 port);
41 [CCode (cname="SDLNet_ResolveIP")]
42 public unowned string? lookup();
45 [CCode (cname="UDPpacket", free_function="SDLNet_FreePacket")]
47 public class UDPPacket {
53 public IPAddress address;
55 [CCode (cname="SDLNet_AllocPacket")]
56 public UDPPacket(int size);
58 [CCode (cname="SDLNet_ResizePacket")]
59 public int resize(int newsize);
62 [CCode (cname="void")]
68 [CCode (cname="struct _TCPsocket", free_function="SDLNet_TCP_Close")]
70 public class TCPSocket: Socket {
71 [CCode (cname="SDLNet_TCP_Open")]
72 public TCPSocket(IPAddress ip);
74 [CCode (cname="SDLNet_TCP_Accept")]
75 public TCPSocket? accept();
77 [CCode (cname="SDLNet_TCP_GetPeerAddress")]
78 public IPAddress? get_address();
80 [CCode (cname="SDLNet_TCP_Send")]
81 public int send(uchar[] data);
83 [CCode (cname="SDLNet_TCP_Recv")]
84 public int receive(uchar[] data);
87 [CCode (cname="struct _UDPsocket", free_function="SDLNet_UDP_Close")]
89 public class UDPSocket: Socket {
90 [CCode (cname="SDLNet_UDP_Open")]
91 public UDPSocket(uint16 port);
93 [CCode (cname="SDLNet_UDP_Bind")]
94 public int bind(int channel, IPAddress address);
96 [CCode (cname="SDLNet_UDP_Unbind")]
97 public void unbind(int channel);
99 [CCode (cname="SDLNet_UDP_GetPeerAddress")]
100 public IPAddress? get_address(int channel);
102 [CCode (cname="SDLNet_UDP_Send")]
103 public int send(int channel, UDPPacket packet);
105 [CCode (cname="SDLNet_UDP_Recv")]
106 public int receive(UDPPacket packet);
108 [CCode (cname="SDLNet_UDP_SendV")]
109 public int send_many(UDPPacket[] packets);
111 [CCode (cname="SDLNet_UDP_RecvV")]
112 public int receive_many([CCode (array_length = false)] UDPPacket[] packets);
115 [CCode (cname="struct _SDLNet_SocketSet", free_function="SDLNet_FreeSocketSet")]
117 public class SocketSet {
118 [CCode (cname="SDLNet_AllocSocketSet")]
119 public SocketSet(int maxsockets);
121 [CCode (cname="SDLNet_AddSocket")]
122 public int add(Socket socket);
124 [CCode (cname="SDLNet_DelSocket")]
125 public int remove(Socket socket);
127 [CCode (cname="SDLNet_CheckSockets")]
128 public int has_data(uint timeout);