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