source: Daodan/src/flatline/Flatline_Net.h@ 894

Last change on this file since 894 was 877, checked in by alloc, 11 years ago

Daodan: Moved flatline to subfolder, flatline enabled through patch "flatline"

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