Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. #ifndef __NETWORK_H
  2. #define __NETWORK_H
  3.  
  4. #include <sys/socket.h>
  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)(const char* hostname) __attribute__ ((stdcall));
  50. extern char* (*inet_ntoa)(int ip_addr) __attribute__ ((stdcall));
  51. extern int (*getaddrinfo)(char* hostname, int servname, struct addrinfo* hints, struct addrinfo** res) __attribute__ ((stdcall));
  52. extern void (*freeaddrinfo)(struct addrinfo* ai) __attribute__ ((stdcall));
  53.  
  54. #endif
  55.