home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1999 May / pcp151c.iso / misc / src / install / net.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-05  |  2.0 KB  |  67 lines

  1. #ifndef H_NET
  2. #define H_NET
  3.  
  4. #include "devices.h"
  5.  
  6. #include <netinet/in.h>
  7. #include <netinet/ip.h>
  8. #include <arpa/inet.h>
  9.  
  10. #define BOOTPROTO_UNKNOWN    0
  11. #define BOOTPROTO_STATIC    1
  12. #define BOOTPROTO_BOOTP        2
  13. #define BOOTPROTO_DHCP        3
  14.  
  15. #define INTFINFO_HAS_IP        (1 << 0)
  16. #define INTFINFO_HAS_NETMASK    (1 << 1)
  17. #define INTFINFO_HAS_BROADCAST    (1 << 2)
  18. #define INTFINFO_HAS_NETWORK    (1 << 3)
  19. #define INTFINFO_HAS_BOOTPROTO    (1 << 4)
  20. #define INTFINFO_HAS_DEVICE    (1 << 5)
  21. #define INTFINFO_HAS_BOOTSERVER    (1 << 6)
  22. #define INTFINFO_HAS_BOOTFILE    (1 << 7)
  23.  
  24. #define NETINFO_HAS_GATEWAY    (1 << 0)
  25. #define NETINFO_HAS_HOSTNAME    (1 << 1)
  26. #define NETINFO_HAS_DOMAIN    (1 << 2)
  27. #define NETINFO_HAS_DNS        (1 << 3)
  28.  
  29. /* all of these in_addr things are in network byte order! */
  30. struct intfInfo {
  31.     char device[10];
  32.     int isPtp, isUp;
  33.     int set, manuallySet;
  34.     struct in_addr ip, netmask, broadcast, network;
  35.     struct in_addr bootServer;
  36.     char * bootFile;
  37.     int bootProto;
  38. };
  39.  
  40. struct netInfo {
  41.     int set, manuallySet;
  42.     char * hostname, * domain;        /* dynamically allocated */
  43.     struct in_addr gateway;
  44.     struct in_addr dnsServers[3];
  45.     int numDns;
  46. };
  47.  
  48. int readNetInterfaceConfig(char * prefix, char * device, 
  49.                struct intfInfo * intf);
  50. int writeNetInterfaceConfig(char * prefix, struct intfInfo * intf);
  51. int writeNetConfig(char * prefix, struct netInfo * netc, 
  52.            struct intfInfo * gwdev, int verbose);
  53. int writeResolvConf(char * prefix, struct netInfo * net);
  54. int writeHosts(char * prefix, struct netInfo * netc, 
  55.            struct intfInfo * intf, int force);
  56. int readNetConfig(char * prefix, struct netInfo * netc);
  57. int bringUpNetworking(struct intfInfo * intf, struct netInfo * netc,
  58.               struct driversLoaded ** dl, int dir);
  59. int writeNetConfig(char * prefix, struct netInfo * netc, 
  60.            struct intfInfo * gwdev, int verbose);
  61. int netDeviceAvailable(char * device);
  62. int checkNetConfig(struct intfInfo * intf, struct netInfo * netc,
  63.            struct intfInfo * intfFinal, struct netInfo * netcFinal,
  64.            struct driversLoaded ** dl, int dir);
  65.  
  66. #endif
  67.