Release 0.41.92
[vala-gnome.git] / vapi / sdl-net.vapi
blobb4a6d7261f0f8cff31a76b9f416456bd6c0f0ef4
1 [CCode (cprefix="SDLNet_", cheader_filename="SDL_net.h")]
2 namespace SDLNet {
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 {
29                 public uint host;
30                 public uint16 port;
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();
43         }// IPAddress
45         [CCode (cname="UDPpacket", free_function="SDLNet_FreePacket")]
46         [Compact]
47         public class UDPPacket {
48                 public int channel;
49                 public uchar *data;
50                 public int len;
51                 public int maxlen;
52                 public int status;
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);
60         }// UDPPacket
62         [CCode (cname="void")]
63         [Compact]
64         public class Socket {
65                 public int ready;
66         }// Socket
68         [CCode (cname="struct _TCPsocket", free_function="SDLNet_TCP_Close")]
69         [Compact]
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);
85         }// TCPSocket
87         [CCode (cname="struct _UDPsocket", free_function="SDLNet_UDP_Close")]
88         [Compact]
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);
113         }// UDPSocket
115         [CCode (cname="struct _SDLNet_SocketSet", free_function="SDLNet_FreeSocketSet")]
116         [Compact]
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);
129         }// SocketSet
130 }// SDL