inet4s.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // inet4s.h : iface ... inet static
  2. //
  3. #if !defined(AGD_INET4S_H__8DD9BEA3_89E3_42BA_88AC_9D805D2CAEBC__INCLUDED_)
  4. #define AGD_INET4S_H__8DD9BEA3_89E3_42BA_88AC_9D805D2CAEBC__INCLUDED_
  5. #include <string.h>
  6. #include <sys/types.h>
  7. #include <sys/socket.h>
  8. #include <netinet/in.h>
  9. #include <arpa/inet.h>
  10. #include <linux/if_packet.h>
  11. #include <net/if_arp.h>
  12. #include <vector>
  13. #include <string>
  14. /////////////////////////////////////////////////////////////////////////////
  15. // inet4s.h - Declarations:
  16. typedef struct _IFACE_INET_STATIC
  17. {
  18. _IFACE_INET_STATIC(){_reset();}
  19. void _reset(void)
  20. {
  21. addr.s_addr = INADDR_ANY;
  22. gate.s_addr = INADDR_ANY;
  23. bcast.s_addr = INADDR_ANY;
  24. pointopoint.s_addr = INADDR_ANY;
  25. netmask.s_addr = INADDR_ANY;
  26. memset(&namesvr, 0, sizeof(namesvr));
  27. netprefix = 0;
  28. bcastOpt = 0;
  29. metric = -1;
  30. mtu = -1;
  31. hwaddr.clear();
  32. scope.clear();
  33. dnss.clear();
  34. }
  35. struct in_addr addr;
  36. struct in_addr netmask;
  37. struct in_addr gate;
  38. struct in_addr bcast;
  39. struct in_addr pointopoint;
  40. struct in_addr namesvr[3];
  41. unsigned int netprefix;
  42. int bcastOpt;
  43. int metric;
  44. int mtu;
  45. std::string hwaddr;
  46. std::string scope;
  47. std::vector<std::string> dnss;
  48. }IFACE_INET_STATIC, *LPIFACE_INET_STATIC;
  49. typedef const IFACE_INET_STATIC *LPCIFACE_INET_STATIC;
  50. bool ParseIfaceInet4sParam(const std::vector<std::string> &v, IFACE_INET_STATIC &is);
  51. bool WriteIfaceInet4sParam(FILE *pf, const IFACE_INET_STATIC &is);
  52. /////////////////////////////////////////////////////////////////////////////
  53. #endif // !defined(AGD_INET4S_H__8DD9BEA3_89E3_42BA_88AC_9D805D2CAEBC__INCLUDED_)