Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
8337 | superturbo | 1 | #ifndef __NETWORK_H |
2 | #define __NETWORK_H |
||
3 | |||
4 | #include |
||
5 | |||
6 | #define EAI_ADDRFAMILY 1 |
||
7 | #define EAI_AGAIN 2 |
||
8 | #define EAI_BADFLAGS 3 |
||
9 | #define EAI_FAIL 4 |
||
10 | #define EAI_FAMILY 5 |
||
11 | #define EAI_MEMORY 6 |
||
12 | #define EAI_NONAME 8 |
||
13 | #define EAI_SERVICE 9 |
||
14 | #define EAI_SOCKTYPE 10 |
||
15 | #define EAI_BADHINTS 12 |
||
16 | #define EAI_PROTOCOL 13 |
||
17 | #define EAI_OVERFLOW 14 |
||
18 | |||
19 | // Flags for addrinfo |
||
20 | #define AI_PASSIVE 1 |
||
21 | #define AI_CANONNAME 2 |
||
22 | #define AI_NUMERICHOST 4 |
||
23 | #define AI_NUMERICSERV 8 |
||
24 | #define AI_ADDRCONFIG 0x400 |
||
25 | |||
26 | #pragma pack(push, 1) |
||
27 | struct ARP_entry{ |
||
28 | unsigned int IP; |
||
29 | unsigned char MAC[6]; |
||
30 | unsigned short status; |
||
31 | unsigned short TTL; |
||
32 | }; |
||
33 | #pragma pack(pop) |
||
34 | |||
35 | #pragma pack(push, 1) |
||
36 | struct addrinfo { |
||
37 | int ai_flags; |
||
38 | int ai_family; |
||
39 | int ai_socktype; |
||
40 | int ai_protocol; |
||
41 | int ai_addrlen; |
||
42 | char *ai_canonname; |
||
43 | sockaddr *ai_addr; |
||
44 | struct addrinfo *ai_next; |
||
45 | }; |
||
46 | #pragma pack(pop) |
||
47 | |||
48 | extern int networklib_init (); |
||
49 | extern int (*inet_addr __attribute__ ((stdcall)))(const char* hostname); |
||
50 | extern char* (*inet_ntoa __attribute__ ((stdcall)))(int ip_addr); |
||
51 | extern int (*getaddrinfo __attribute__ ((stdcall)))(char* hostname, int servname, struct addrinfo* hints, struct addrinfo** res); |
||
52 | extern void (*freeaddrinfo __attribute__ ((stdcall)))(struct addrinfo* ai); |
||
53 | |||
54 | #endif |