Last change
on this file since 891 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 |
|
---|
10 | typedef struct hostent hostent ;
|
---|
11 | typedef struct in_addr in_addr;
|
---|
12 |
|
---|
13 | typedef struct {
|
---|
14 | short ss_family;
|
---|
15 | char pad1[pad1_size];
|
---|
16 | uint64_t pad64;
|
---|
17 | char pad2[pad2_size];
|
---|
18 | } sockaddr_storage;
|
---|
19 |
|
---|
20 | typedef struct sockaddr sockaddr;
|
---|
21 | typedef struct sockaddr_in sockaddr_in;
|
---|
22 | typedef sockaddr_storage sockaddr_in6;
|
---|
23 |
|
---|
24 | void NetCatchError();
|
---|
25 |
|
---|
26 | unsigned char NetUDPServer_Listen(uint16_t port, unsigned char (*packet_callback)(char* data, int datalen, int from));
|
---|
27 | unsigned char NetUDPServer_Send(sockaddr* address, char* data, int datalen);
|
---|
28 |
|
---|
29 | int NetUDPSocket_Create(uint16_t port, sockaddr_in* address);
|
---|
30 | int NetTCPSocket_Create(uint16_t port, sockaddr_in* address);
|
---|
31 | int NetUDPSocket_Send(int socket, const sockaddr* address, char* data, int datalen);
|
---|
32 | void NetUDPSocket_Close(int sock);
|
---|
33 | unsigned 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.