source: Daodan/src/Flatline_Net.h@ 876

Last change on this file since 876 was 876, checked in by gumby, 12 years ago

Daodan pass 1

File size: 1.1 KB
Line 
1#ifndef FLATLINE_NET_H
2#define FLATLINE_NET_H
3
4#define pad1_size (sizeof(int64_t) - sizeof(short))
5#define pad2_size (128 - (sizeof(short) + pad1_size + sizeof(int64_t)))
6
7
8typedef struct hostent hostent ;
9typedef struct in_addr in_addr;
10
11typedef struct {
12 short ss_family;
13 char pad1[pad1_size];
14 uint64_t pad64;
15 char pad2[pad2_size];
16} sockaddr_storage;
17
18typedef struct sockaddr sockaddr;
19typedef struct sockaddr_in sockaddr_in;
20typedef sockaddr_storage sockaddr_in6;
21
22void NetCatchError();
23
24unsigned char NetUDPServer_Listen(uint16_t port, unsigned char (*packet_callback)(char* data, int datalen, int from));
25unsigned char NetUDPServer_Send(sockaddr* address, char* data, int datalen);
26
27int NetUDPSocket_Create(uint16_t port, sockaddr_in* address);
28int NetTCPSocket_Create(uint16_t port, sockaddr_in* address);
29int NetUDPSocket_Send(int socket, const sockaddr* address, char* data, int datalen);
30void NetUDPSocket_Close(int sock);
31unsigned char NetUDPSocket_Recieve(int socket, sockaddr_storage* address, char* data, uint16_t* datalen);
32
33#endif
Note: See TracBrowser for help on using the repository browser.