nwcfg.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780
  1. /***************************************************************
  2. ** **
  3. ** (C)Copyright 2006-2009, American Megatrends Inc. **
  4. ** **
  5. ** All Rights Reserved. **
  6. ** **
  7. ** 5555 Oakbrook Pkwy Suite 200, Norcross, **
  8. ** **
  9. ** Georgia - 30093, USA. Phone-(770)-246-8600. **
  10. ** **
  11. ****************************************************************
  12. * Filename: nwcfg.h
  13. *
  14. * Description: Contains code for the basic network library APIs.
  15. *
  16. ****************************************************************/
  17. #ifndef _NWCFG_H
  18. #define _NWCFG_H
  19. #include <sys/socket.h>
  20. #include <netinet/in.h>
  21. #include <arpa/inet.h>
  22. //#include <Types.h>
  23. //#include "hostname.h"
  24. #include <com_IPMIDefs.h>
  25. #include <com_BmcType.h>
  26. // /* External dependencies */
  27. // #define PROC_NET_ROUTE_FILE "/proc/net/route"
  28. // /* ipv6 */
  29. // #define PROC_NET_IPV6ROUTE_FILE "/proc/net/ipv6_route"
  30. // #define DHCPD_PID_FILE "/var/run/udhcpc.eth0.pid"
  31. // #define DHCP6C_PID_FILE "/var/run/dhcp6c.pid"
  32. // #define DHCPD_CONFIG_FILE "/conf/dhcpc-config"
  33. // #define DHCPD_CONFIG_FILE_TEMP "/var/dhcp-config.tmp"
  34. // #define RESOLV_CONF_FILE "/conf/resolv.conf"
  35. // #define RESOLV_CONF_DISABLED_FILE "/conf/resolv_disabled.conf"
  36. // #define RESOLV_CONF_FILE_TEMP "/var/resolv.conf.tmp"
  37. // #define DNS_CONFIG_FILE "/conf/dns.conf"
  38. // #define DNS_CONFIG_FILE_TEMP "/var/dns.conf.tmp"
  39. // #define IFUP_BIN_PATH "/sbin/ifup"
  40. // #define IFDOWN_BIN_PATH "/sbin/ifdown"
  41. #define ZERO_IP "0.0.0.0"
  42. #define DEFAULT_GW_STR "0.0.0.0"
  43. /* /etc/network/interfaces file defines */
  44. // #define NETWORK_IF_FILE "/etc/network/interfaces"
  45. // #define NETWORK_IF_FILE_TMP "/conf/interfaces.tmp"
  46. // #define NETWORK_DNS_TMP "/conf/dns.tmp"
  47. // #define NETWORK_IP_SRC_FILE "/conf/ipaddrsource"
  48. #define AUTO_LOCAL_STR "auto lo\n"
  49. #define AUTO_LOCAL_LOOPBACK_STR "iface lo inet loopback\n"
  50. #define IF_STATIC_IP_STR "address"
  51. #define IF_STATIC_MASK_STR "netmask"
  52. #define IF_STATIC_BCAST_STR "broadcast"
  53. #define IF_STATIC_GW_STR "gateway"
  54. #define IF_STATIC_MTU_STRING "mtu"
  55. #define DEFAULT_GW_FLAGS 0x0003
  56. // #define DEV_FILE "/proc/net/dev"
  57. // #define VLAN_ID_SETTING_STR "vlanid"
  58. // #define VLAN_INTERFACES_FILE "/conf/vlaninterfaces"
  59. // #define VLAN_PRIORITY_SETTING_STR "vlanpriority"
  60. // #define VLAN_INDEX_STR "index"
  61. // #define VLANSETTING_CONF_FILE "/conf/vlansetting.conf"
  62. // #define VLAN_NETWORK_DECONFIG_FILE "/etc/init.d/vlannetworking stop"
  63. // #define VLAN_NETWORK_CONFIG_FILE "/etc/init.d/vlannetworking start"
  64. // #define VLAN_ONLY_IFDOWN "/etc/init.d/vlannetworking downvlan"
  65. // #define VLAN_PROC_SYS_RAC_NCSI_ENABLE_LAN "echo 1 > /proc/sys/ractrends/ncsi/Enable"
  66. // #define VLAN_NETWORK_IP_CONFIGFILE "/etc/init.d/vlannetworking enableip"
  67. // #define IF_STATIC_ADDR_STR " pre-up ip addr add"
  68. // /*Bond*/
  69. // #define BONDING_CONF_FILE "/conf/bond.conf"
  70. // #define BONDING_SYSTEM_FILE "/sys/class/net"
  71. #define IFACE_ENABLED 0x01
  72. #define IFACE_DISABLED 0x00
  73. #define BOND_ROUND_ROBIN 0x00
  74. #define BOND_ACTIVE_BACKUP 0x01
  75. #define MAX_BOND_MODE 0x06
  76. #define MAX_BOND 0x03
  77. #define ETH_IFACE_TYPE 0x01
  78. #define BOND_IFACE_TYPE 0x02
  79. #define BOND_MAX_SLAVE 8
  80. #define MAX_CHANNEL 0x04
  81. #define MAX_ETH 5
  82. ///* IPv6 */
  83. //#define KERNEL_IPV6_FILE "/proc/net/if_inet6"
  84. #define MAX_MAC_LEN 64
  85. #define MAC_ADDR_LEN 6
  86. #define IP_ADDR_LEN 4
  87. #define IP6_ADDR_LEN 16
  88. #define MAX_STR_LENGTH 128
  89. #define ROUTE_GW_LENGTH 100
  90. #define MAX_IPV6ADDRS 16
  91. #define DOMAIN_DHCP_LEN 7
  92. #define LOOPBACK_ADDR_LEN 9
  93. #define STR1_LEN 1
  94. #define STR2_LEN 2
  95. #define STR3_LEN 3
  96. #define STR4_LEN 4
  97. #define STR5_LEN 5
  98. /* DNS */
  99. #define MAX_HOST_NAME_STRING_SIZE 64
  100. #define MAX_DOMAIN_NAME_STRING_SIZE 256
  101. #define HOSTNAME_SETTING_MANUAL 0
  102. #define HOSTNAME_SETTING_AUTO 1
  103. #define ONELINE_LEN 300
  104. #define DNS_SERVERIP_LEN 26
  105. #define REG_BMC_ENABLE 0x01 //0th bit enable of BMC register
  106. #define REG_BMC_TSIG 0x02 //1st bit enable of BMC register
  107. #define REG_BMC_FQDN 0x10 //DHCP Option 81
  108. #define REG_BMC_HOSTNAME 0x20 //DHCP Option 12
  109. #define REG_BMC_RESERVED 0xCE //Binary value 1100 1110
  110. #define REG_BMC_RESERVED_TSIG 0xFD //Binary value 1111 1101
  111. /* TSIG Configuration */
  112. // #define CONF_LOCATION "/conf/"
  113. // #define TEMP_LOCATION "/tmp/"
  114. // #define TSIG_PRIVATE_FILE "tsig.private"
  115. // #define CONF_TSIG_PRIVATE_FILE CONF_LOCATION TSIG_PRIVATE_FILE
  116. // #define TEMP_TSIG_PRIVATE_FILE TEMP_LOCATION TSIG_PRIVATE_FILE
  117. // #define MAX_TSIG_PRIVKEY_SIZE (8 * 1024)
  118. // #define TSIG_ALG_TYPE_HMAC_MD5 "Algorithm: 157 (HMAC_MD5)\n"
  119. /* Type of network configuration */
  120. #define CFGMETHOD_STATIC 1
  121. #define CFGMETHOD_DHCP 2
  122. #define CFGMETHOD_BIOS 3
  123. #define CFGMETHOD_OTHER 4
  124. #define NWCFGTYPE_STATIC 0x1
  125. #define NWCFGTYPE_DHCP 0x2
  126. #define NWCFGTYPE_DHCPFIRST 0x4
  127. /*Interface enable state*/
  128. #define NW_INTERFACE_ENABLE 0x1
  129. #define NW_INTERFACE_DISABLE 0x2
  130. #define NW_INTERFACE_UNKNOWN 0x3
  131. #define NW_AUTO_NEG_ON 0x1
  132. #define NW_AUTO_NEG_OFF 0x2
  133. #define NW_DUPLEX_FULL 0x1
  134. #define NW_DUPLEX_HALF 0x2
  135. /*
  136. * ETHSET FLAG: See nwSetNWExtEthCfg API
  137. */
  138. #define NWEXT_ETHCFG_LAMAC 0x1
  139. #define NWEXT_ETHCFG_BURNEDMAC 0x2
  140. #define NWEXT_ETHCFG_SPEED 0x4
  141. #define NWEXT_ETHCFG_DUPLEX 0x8
  142. #define NWEXT_ETHCFG_AUTONEG 0x10
  143. #define NWEXT_ETHCFG_MTU 0x20
  144. #define NWEXT_ETHCFG_WOL 0x40
  145. #define NWEXT_ETHCFG_ALL (NWEXT_ETHCFG_LAMAC \
  146. | NWEXT_ETHCFG_BURNEDMAC \
  147. | NWEXT_ETHCFG_SPEED \
  148. | NWEXT_ETHCFG_DUPLEX \
  149. | NWEXT_ETHCFG_AUTONEG \
  150. | NWEXT_ETHCFG_MTU \
  151. | NWEXT_ETHCFG_WOL)
  152. /*
  153. * NWSET FLAG: See nwSetNWExtIPCfg API
  154. */
  155. #define NWEXT_IPCFG_INTFSTATE 0x1
  156. #define NWEXT_IPCFG_CFGMETHOD 0x2
  157. #define NWEXT_IPCFG_IP 0x4
  158. #define NWEXT_IPCFG_MASK 0x8
  159. #define NWEXT_IPCFG_GW 0x10
  160. #define NWEXT_IPCFG_FBIP 0x20
  161. #define NWEXT_IPCFG_FBMASK 0x40
  162. #define NWEXT_IPCFG_FBGW 0x80
  163. #define NWEXT_IPCFG_ALL (NWEXT_IPCFG_INTFSTATE \
  164. | NWEXT_IPCFG_CFGMETHOD \
  165. | NWEXT_IPCFG_FBIP \
  166. | NWEXT_IPCFG_FBMASK \
  167. | NWEXT_IPCFG_FBGW \
  168. | NWEXT_IPCFG_IP \
  169. | NWEXT_IPCFG_MASK \
  170. | NWEXT_IPCFG_GW)
  171. #define MAX_RESTART_SERVICE 4
  172. #define MAX_SERVICE 5
  173. /*Used to check the flag status*/
  174. #define CHECK_FLAG(in,level) ((in&level) == level)
  175. /*Used to set flag value*/
  176. #define SET_FLAG(out,level) (out|=level)
  177. /* Enable or disable Auto-Negotiation */
  178. #define AUTONEG_DISABLE 0x00
  179. #define AUTONEG_ENABLE 0x01
  180. /* Network Link modes */
  181. #define PHY_SPEED_10 10
  182. #define PHY_SPEED_100 100
  183. #define PHY_SPEED_1000 1000
  184. #define PHY_DUPLEX_HALF 0x0
  185. #define PHY_DUPLEX_FULL 0x1
  186. #define PHY_SPEED_AN_MASK 0x8000 /*Auto-Negotiation Mask for Speed*/
  187. #define PHY_DUPLEX_AN_MASK 0x4000 /*Auto-Negotiation Mask for Duplex*/
  188. /* MII registers for PHY */
  189. #define MII_BMCR 0x00 /* Basic mode control register */
  190. #define MII_BMSR 0x01 /* Basic mode status register */
  191. #define MII_PHY_ID1 0x02 /* PHY identifier 1 */
  192. #define MII_PHY_ID2 0x03 /* PHY identifier 2 */
  193. #define MII_ADVERTISE 0x04 /* Advertisement control reg */
  194. #define MII_LPA 0x05 /* Link partner ability reg */
  195. #define MII_EXPANSION 0x06 /* Expansion register */
  196. #define MII_CTRL1000 0x09 /* 1000BASE-T control */
  197. #define MII_STAT1000 0x0a /* 1000BASE-T status */
  198. /* Mask for BMCR Register settings for Speed/Duplex */
  199. #define PHY_BMCR_10_FD 0x0100
  200. #define PHY_BMCR_10_HD 0x0000
  201. #define PHY_BMCR_100_FD 0x2100
  202. #define PHY_BMCR_100_HD 0x2000
  203. #define PHY_BMCR_1000_FD 0x1140
  204. #define PHY_BMCR_AUTO_NEG 0x3000
  205. /* Mask for ADVERTISE Register settings for Speed/Duplex */
  206. #define PHY_ADV_AUTO_NEG 0x05e1
  207. #define PHY_ADV_1000_FD 0x0401
  208. /* Mask for Gigabit Control Register settings for Speed/Duplex */
  209. #define PHY_GBCR_AUTO_NEG 0x0300
  210. #pragma pack (1)
  211. typedef struct
  212. {
  213. uint8_t AutoNegotiationEnable;
  214. uint16_t Speed;
  215. uint8_t Duplex;
  216. uint8_t Interface;
  217. uint8_t CapabilitiesSupported;
  218. } PHYConfig_T;
  219. typedef struct
  220. {
  221. uint8_t Enable; /*Enable/Disable*/
  222. uint8_t BondIndex; /*Index value of Bond Interface*/
  223. uint8_t BondMode; /*Bond Mode*/
  224. uint16_t MiiInterval; /*MII Interval*/
  225. uint8_t Slaves; /*Each bit represents the interface Index value i.e 0-7*/
  226. uint8_t AutoConf;
  227. } BondIface;
  228. typedef struct{
  229. unsigned char CfgMethod; /* This field can either be NWCFGTYPE_DHCP or NWCFGTYPE_STATIC */
  230. unsigned char MAC[6];
  231. unsigned char Local_MAC[6];
  232. unsigned char IPAddr[4];
  233. unsigned char Broadcast[4];
  234. unsigned char Mask[4];
  235. unsigned char Gateway[4];
  236. unsigned char BackupGateway[4];
  237. /* If interface is enabled, value is
  238. * NW_INTERFACE_ENABLE otherwise NW_INTERFACE_DISABLE
  239. */
  240. unsigned char enable;
  241. unsigned char IFName[10];
  242. unsigned short VLANID;
  243. unsigned char vlanpriority;
  244. unsigned char Master;
  245. unsigned char Slave;
  246. unsigned char BondIndex;
  247. } NWCFG_STRUCT;
  248. /*ipv6*/
  249. typedef struct{
  250. unsigned char enable;
  251. unsigned char MAC[6];
  252. unsigned char CfgMethod; /* This field can either be NWCFGTYPE_DHCP or NWCFGTYPE_STATIC */
  253. unsigned char LinkIPAddr[16];
  254. unsigned char LinkPrefix;
  255. unsigned char SiteIPAddr[16];
  256. unsigned char SitePrefix;
  257. unsigned char GlobalIPAddr[MAX_IPV6ADDRS][16]; //anyCast Globel address //UniCast Globel address
  258. unsigned char GlobalPrefix[MAX_IPV6ADDRS];
  259. unsigned char Gateway[16];
  260. unsigned char IFName[10];
  261. } NWCFG6_STRUCT;
  262. typedef struct {
  263. unsigned char Enable;
  264. unsigned short MiiInterval;
  265. unsigned char BondMode;
  266. unsigned char Slave;
  267. } BondConf;
  268. typedef struct {
  269. unsigned char Upslave;
  270. } ActiveConf;
  271. typedef struct
  272. {
  273. int8_t Ifcname[16];
  274. uint8_t Index;
  275. uint8_t Enabled;
  276. } IfcName_T;
  277. typedef struct{
  278. unsigned short Family;
  279. NWCFG_STRUCT IPv4;
  280. NWCFG6_STRUCT IPv6;
  281. } ALL_NWCFG_STRUCT;
  282. typedef struct{
  283. NWCFG_STRUCT NwInfo[10];
  284. int IFCount;
  285. } NWCFGS;
  286. typedef struct
  287. {
  288. /* This field can either be NW_DUPLEX_FULL or NW_DUPLEX_HALF */
  289. unsigned long speed;
  290. /* This field can either be NW_DUPLEX_FULL or NW_DUPLEX_HALF */
  291. unsigned int duplex;
  292. /* This field can either be NW_AUTO_NEG_ON or NW_AUTO_NEG_OFF,
  293. * Auto negotiation is applicable for both speed & duplex.
  294. */
  295. unsigned int autoneg;
  296. /* This field features the link modes that are supported by the interface */
  297. unsigned char supported;
  298. /*Max transmission unit*/
  299. unsigned long maxtxpkt;
  300. unsigned long wolsupported;
  301. unsigned long wolopts;
  302. } ETHCFG_STRUCT;
  303. typedef struct{
  304. ETHCFG_STRUCT EthInfo[10];
  305. } ETHCFGS;
  306. typedef struct{
  307. /* Name of the interface, example: eth0, eth1, ethernet,...*/
  308. char IFName[10];
  309. /*
  310. * This field can either be NWCFGTYPE_DHCP or
  311. * NWCFGTYPE_STATIC or NWCFGTYPE_DHCPFIRST
  312. */
  313. unsigned char CfgMethod;
  314. /*
  315. * If interface is enabled, value is NW_INTERFACE_ENABLE
  316. * otherwise NW_INTERFACE_DISABLE
  317. */
  318. unsigned char Enable;
  319. /*
  320. * Current IP Origin NWCFGTYPE_DHCP or NWCFGTYPE_STATIC
  321. */
  322. unsigned char IPOrigin;
  323. /*
  324. * IP assigned: If IPOrgin is DHCP, then this is DHCP IP,
  325. * if the IPOrigin is Static, then this is Static IP address
  326. */
  327. unsigned char IPAddr[4];
  328. unsigned char Mask[4];
  329. unsigned char Gateway[4];
  330. /*
  331. * Manually configured Fall back (FB) IP
  332. */
  333. unsigned char FB_IPAddr[4];
  334. unsigned char FB_Mask[4];
  335. unsigned char FB_Gateway[4];
  336. } NWEXT_IPCFG;
  337. typedef struct
  338. {
  339. /*Burned-in MAC address*/
  340. unsigned char BurnedMAC[6];
  341. /* Locally admin-MAC: Setting Local MAC to other than 00:00:00:00:00:00
  342. * makes it as current MAC. If a platform does not support. If this is
  343. * non-zero then this is current MAC while getting
  344. */
  345. unsigned char Local_MAC[6];
  346. } NWEXT_MACCFG;
  347. typedef struct
  348. {
  349. /* MAC Configuration */
  350. NWEXT_MACCFG mac_cfg;
  351. /* Ethernet Configuration */
  352. ETHCFG_STRUCT eth_cfg;
  353. } NWEXT_ETHCFG;
  354. typedef struct
  355. {
  356. unsigned char DNSDhcpEnable; /*Specifies that the DNS server IP addresses should be assigned from the DHCP server*/
  357. unsigned char DNSServerEthIndex; /*Specifies that from which DHCP server the IP addresses should be assigned */
  358. unsigned char DNSServer1[IP_ADDR_LEN]; /*Specifies the IP address for DNS server 1*/
  359. unsigned char DNSServer2[IP_ADDR_LEN]; /*Specifies the IP address for DNS server 2*/
  360. unsigned char v4v6;
  361. unsigned char RegisterBMCFQDN[MAX_CHANNEL]; /*Register the BMC host name using FQDN method */
  362. unsigned char DNSRegisterBMC[MAX_CHANNEL]; /*Enable registering the BMC host name on the DNS server*/
  363. unsigned char DNSBMCHostSetting; /*Specifies host name is Automatic or Manual */
  364. unsigned char DNSBMCHostNameLen;
  365. unsigned char DNSBMCHostName[MAX_HOST_NAME_STRING_SIZE]; /*Specifies the DNS BMC host name*/
  366. unsigned char DNSDomainNameDhcpEnable; /*Specifies that the DNS domain name should be assigned from the DHCP server*/
  367. unsigned char DNSDomainNameEthIndex; /*Specifies that from which DHCP server the DNS domain name should be assigned */
  368. unsigned char DNSDomainNameLen;
  369. unsigned char DNSDomainName[MAX_DOMAIN_NAME_STRING_SIZE];/*The DNS domain name string*/
  370. } DNS_CONFIG;
  371. #define DNSCFG_MAX_DOMAIN_NAME_LEN 256 //with null
  372. #define DNSCFG_MAX_RAC_NAME_LEN 64
  373. /*DNS-Manual enable state*/
  374. #define DNS_MANUAL_ENABLE 0x1
  375. #define DNS_MANUAL_DISABLE 0x2
  376. typedef struct
  377. {
  378. unsigned char dnsEnable;
  379. unsigned char manualDNSDomain1Length;
  380. char manualDNSDomainName1[DNSCFG_MAX_DOMAIN_NAME_LEN];
  381. unsigned char manualDNSDomain2Length;
  382. char manualDNSDomainName2[DNSCFG_MAX_DOMAIN_NAME_LEN];
  383. struct in_addr manualDNSServer1;
  384. struct in_addr manualDNSServer2;
  385. struct in_addr manualDNSServer3;
  386. } MANUAL_DNS_CONFIG;
  387. // /*********************************/
  388. // /* DNS Configuration structures */
  389. // /*********************************/
  390. // #define DOMAIN_V4 1
  391. // #define DOMAIN_V6 2
  392. // #define CONFDNSCONF "/conf/dns.conf"
  393. // #define CONFDNSCONF_TMP "/conf/dns.conf.tmp"
  394. // typedef struct
  395. // {
  396. // uint8_t HostSetting; /*Specifies host name is Automatic or Manual */
  397. // uint8_t HostNameLen;
  398. // uint8_t HostName[MAX_HOSTNAME_LEN]; Specifies the DNS BMC host name
  399. // } HOSTNAMECONF;
  400. // typedef struct
  401. // {
  402. // uint8_t dhcpEnable;
  403. // uint8_t EthIndex;
  404. // uint8_t v4v6;
  405. // uint8_t domainname[DNSCFG_MAX_DOMAIN_NAME_LEN];
  406. // uint8_t domainnamelen;
  407. // } DOMAINCONF;
  408. // typedef struct
  409. // {
  410. // uint8_t DNSIP1[IP6_ADDR_LEN];
  411. // uint8_t DNSIP2[IP6_ADDR_LEN];
  412. // uint8_t DNSIP3[IP6_ADDR_LEN];
  413. // uint8_t DNSEnable;
  414. // uint8_t DNSDHCP;
  415. // uint8_t DNSIndex;
  416. // uint8_t IPPriority;
  417. // } DNSCONF;
  418. /* Define the network interface */
  419. typedef enum
  420. {
  421. PENDING=1, // Interface having configured/pending settings
  422. ACTIVE // Interface having current/active settings
  423. }NW_INTERFACE;
  424. typedef struct
  425. {
  426. uint8_t param;
  427. uint8_t NwRestartNeeded;
  428. } MONSETLANPARAM_STRUCT;
  429. // typedef struct
  430. // {
  431. // NWCFG_STRUCT cfgIPv4[MAX_ETH];
  432. // NWCFG6_STRUCT cfgIPv6[MAX_ETH];
  433. // BondIface BondConfig;
  434. // PHYConfig_T PHYConfig[MAX_ETH];
  435. // unsigned short mtu_size[MAX_ETH];
  436. // HOSTNAMECONF HostnameConfig;
  437. // DOMAINCONF DomainConfig;
  438. // uint8_t regBMC_FQDN[MAX_CHANNEL];
  439. // uint8_t TypeOfService[MAX_ETH];
  440. // DNSCONF DnsIPConfig;
  441. // } DELAYEDLANRESTART_NWDATA;
  442. #pragma pack ()
  443. // /* Functions to read/write current network status */
  444. // int nwReadNWCfgs(NWCFGS *cfg, ETHCFGS *ethcfg);
  445. // int IsLinkModeSupported(ETHCFG_STRUCT *ethcfg,uint16_t speed,uint8_t duplex);
  446. // int nwGetEthInformation(ETHCFG_STRUCT *ethcfg, char * IFName);
  447. // int nwSetEthInformation(unsigned long speed, unsigned int duplex, char * IFName);
  448. // int nwWriteNWCfgNoUpDown(NWCFG_STRUCT *cfg);
  449. // int nwSetEthMTUSize(int mtu, char * IFName);
  450. // int nwSetBkupGWyAddr(unsigned char *ip,uint8_t EthIndex);
  451. // int nwGetBkupGWyAddr(unsigned char *ip,uint8_t EthIndex);
  452. // /* One should pass the buffer of size MAX_MAC_LEN to the following function */
  453. // int nwGetMACAddr(char *MAC);
  454. // int nwSetMACAddr(char *MAC, int Index);
  455. // int nwSetGateway(uint8_t* GwIP,uint8_t EthIndex);
  456. // int nwDelExistingGateway(uint8_t EthIndex);
  457. // /* Functions to set/get MDIO PHY registers */
  458. // /* These can be used by OEMs to monitor/control the speed/duplex of the PHY */
  459. // int nwGetPHYRegister(char regNo, char *IfcName);
  460. // int nwSetPHYRegister(unsigned short regValue, char regNo, char *IfcName);
  461. // /* Function to generate an IPv6 address based on EUI-64 algo */
  462. // int nwFormIPv6Addr_EUI64(uint8_t *IPv6Addr, uint8_t EthIndex, int GlobalIPv6);
  463. // int nwGetNWInformations(NWCFG_STRUCT *cfg,char *IFName);
  464. // int nwMakeIFDown(uint8_t EthIndex);
  465. // int nwMakeIFUp(uint8_t EthIndex);
  466. // extern void GetNwCfgInfo(void);
  467. // extern int GetNoofInterface(void);
  468. // /* Extended API for network*/
  469. // int GetHostEthbyIPAddr(char *IPAddr);
  470. // int GetHostEthByIPv6Addr(char *IPAddr);
  471. // int GetIfcNameByIndex(int Index, char * IfcName);
  472. // int nwGetSrcMacAddr(uint8_t* IpAddr,uint8_t EthIndex,uint8_t *MacAddr);
  473. // int nwGetSrcCacheMacAddr(uint8_t* IpAddr, uint8_t EthIndex, uint8_t *MacAddr);
  474. // int nwGetSrcMacAddr_IPV6(uint8_t* IpAddr,uint8_t *MacAddr);
  475. // int nwGetNWExtEthCfg(NWEXT_ETHCFG *cfg);
  476. // int nwGetNWInterfaceStatus(void);
  477. // int nwSetNWExtEthCfg(NWEXT_ETHCFG *cfg, int nwSetFlag);
  478. // int nwSetNWExtIPCfg (NWEXT_IPCFG *cfg, int nwSetFlag,int global_ipv6);
  479. // int GetNwLinkStatus(int fd,char *ifname);
  480. // int GetNwLinkType_mii(char *ifname);
  481. // /**
  482. // *@fn nwUpdateVLANInterfacesFile
  483. // *@brief This function is invoked to update vlan interfaces file
  484. // */
  485. // int nwUpdateVLANInterfacesFile(void);
  486. // /**
  487. // *@fn ReadVLANFile
  488. // *@brief This function is invoked to read the vlan configuration files
  489. // *@param SettingStr - Pointer to setting name that we want to read from vlan configurations file
  490. // *@param desArr - pointer to an array where the reading has to be stored
  491. // */
  492. // int ReadVLANFile(char *SettingStr, uint16_t *desArr);
  493. // /**
  494. // *@fn WriteVLANFile
  495. // *@brief This function is invoked to write all the vlan configuration files
  496. // *@param SettingStr - Pointer to setting name that we want to write into vlan configurations file
  497. // *@param desArr - pointer to an array where the reading has to be stored
  498. // *@param EthIndex - char value to Ethernet index
  499. // *@param val - short int to the value that has to be written
  500. // */
  501. // int WriteVLANFile(char *SettingStr, uint16_t *desArr, uint8_t EthIndex, uint16_t val);
  502. // /*ipv6*/
  503. // void ConvertIP6numToStr(unsigned char *var, unsigned int len,unsigned char *string) ;
  504. // int nwReadNWCfg_IPv6(NWCFG6_STRUCT *cfg,uint8_t EthIndex);
  505. // int GetDefaultGateway_ipv6(unsigned char *gw,uint8_t *Interface);
  506. // int nwGetResolvConf_v4_v6(char* DNS1,char*DNS2,char *DNS3, uint8_t DNSIPPriority,char* domain,unsigned char* domainnamelen);
  507. // /**
  508. // *@fn nwReadNWCfg_v4_v6
  509. // *@brief This function is invoked to Get the current network status of both IPv4 and IPv6 networks.
  510. // *@ If there is no need of IPv6 data means, then just pass NULL to IPv6 pointer.
  511. // *@param cfg - Pointer to Structure used to get IPv4 network configurations.
  512. // *@param cfg6 - Pointer to Structure used to get IPv6 network configurations.
  513. // *@param EthIndex - pointer to char used to store Interface Index value.
  514. // *@return Returns 0 on success and -1 on fails
  515. // */
  516. // int nwReadNWCfg_v4_v6(NWCFG_STRUCT *cfg, NWCFG6_STRUCT *cfg6, uint8_t EthIndex,int global_ipv6);
  517. // /**
  518. // *@fn nwWriteNWCfg_ipv4_v6
  519. // *@brief This function is invoked to set both IPv4 and IPv6 network configurations.
  520. // *@ If there is no need to write IPv6 data means, then just pass NULL to IPv6 pointer.
  521. // *@param cfg - Pointer to Structure used to set IPv4 network configurations
  522. // *@param cfg6 - Pointer to Structure used to set IPv6 network configurations
  523. // *@param EthIndex - pointer to char used to store Interface Index value.
  524. // *@return Returns 0 on success and -1 on fails
  525. // */
  526. // int nwWriteNWCfg_ipv4_v6(NWCFG_STRUCT *cfg, NWCFG6_STRUCT *cfg6, uint8_t EthIndex);
  527. // * @fn nwConfigureBonding
  528. // * @brief This function will Enable/Disable the bonding support
  529. // * @param BondCfg [in] Bonding configuration table
  530. // * @param BondIndex [in] Index value of Bond interface to be configured
  531. // * @return 0 on success, -1 on failure
  532. // int nwConfigureBonding(BondIface *BondCfg,uint8_t EthIndex,int timeoutd_sess_timeout,int global_ipv6);
  533. // /*
  534. // * @fn nwGetBondConf
  535. // * @brief This function will Get the bonding Configuration of Specified index
  536. // * @param BondCfg [out] Bonding configuration table
  537. // * @param BondIndex [in] Index value of Bond interface
  538. // * @return 0 on success, -1 on failure
  539. // */
  540. // int nwGetBondConf(BondIface *BondCfg,uint8_t BondIndex);
  541. // /*
  542. // * @fn CheckIfcEntry
  543. // * @brief This function will check the interface presence in ifcname table
  544. // * @param Index [in] index value
  545. // * @param IfcType [in] interface type
  546. // * @return 0 in success, -1 on failure
  547. // */
  548. // int CheckIfcEntry(uint8_t Index,uint8_t IfcType);
  549. // /*
  550. // * @fn CheckBondSlave
  551. // * @brief This function will check the given interfaces slave status
  552. // * @param EthIndex[in] interface's Ethindex value
  553. // * @returns 1 if the interface is a slave of any bond interface, otherwise 0
  554. // */
  555. // int CheckBondSlave(uint8_t EthIndex);
  556. // /*
  557. // * @fn CheckIfcLinkStatus
  558. // * @brief This function will check the interface's Link health
  559. // * @param Index [in] index value
  560. // * @return -1 on failure
  561. // */
  562. // int CheckIfcLinkStatus(uint8_t Index);
  563. // /*
  564. // * @fn InitIfcNameTable
  565. // * @brief This function is used to initialize the Ifcname table based on NIC count
  566. // * @return -1 on failure
  567. // */
  568. // int InitIfcNameTable();
  569. // /**
  570. // *@fn IsKernelIPv6Enabled
  571. // *@brief This function is used to check for IPv6 support in the kernel.
  572. // *@return Returns 1 on success and 0 on fails
  573. // */
  574. // int IsKernelIPv6Enabled();
  575. // /*
  576. // * @fn nwActiveSlave
  577. // * @brief This function will active the single slave for the bonding interface
  578. // * @param SlaveIndex to be activated
  579. // * @return 0 on success, -1 on failure
  580. // */
  581. // int nwActiveSlave(uint8_t BondIndex,uint8_t SlaveIndex);
  582. // /*
  583. // * @fn nwGetActiveSlave
  584. // * @brief This function will gets the active interface of specified bondindex
  585. // * @param Bondindex [in] bonding index, Activeindex[out] active slaves
  586. // * @return 0 on success, -1 on failure
  587. // */
  588. // int nwGetActiveSlave(uint8_t BondIndex,uint8_t *ActiveIndex);
  589. // /**
  590. // *@fn Write_dhcp6c_conf
  591. // *@brief This function is used to write interface wise entries for dhcp6c.conf file.
  592. // *@return Returns 0 on success and -1 on fails
  593. // */
  594. // int Write_dhcp6c_conf();
  595. // /**
  596. // *@fn IsValidGlobalIPv6Addr
  597. // *@brief This function will check the given IPv6 address as global IP address or not
  598. // *@return Return 0 on success and -1 on failure
  599. // */
  600. // int IsValidGlobalIPv6Addr(struct in6_addr * IPv6Addr);
  601. // /* DNS */
  602. // int nwSetResolvConf_v4_v6(char* dns1,char* dns2,char* dnsv3,char* domain);
  603. // int ReadDNSConfFile ( DOMAINCONF *DomainConfig, DNSCONF *DnsIPConfig,uint8_t *regBMC_FQDN);
  604. // int WriteDNSConfFile ( DOMAINCONF *DomainConfig, DNSCONF *DnsIPConfig, uint8_t *regBMC_FQDN);
  605. // int nwGetAllDNSConf( HOSTNAMECONF *HostnameConfig, DOMAINCONF *DomainConfig, DNSCONF *DnsIPConfig,uint8_t *regBMC_FQDN );
  606. // int nwSetAllDNSConf( HOSTNAMECONF *HostnameConfig, DOMAINCONF *DomainConfig, DNSCONF *DnsIPConfig,uint8_t *regBMC_FQDN );
  607. // /* Library for AMI Extended DNS command */
  608. // int nwSetHostName(char *name);
  609. // int nwGetDNSConf(unsigned char* UseDHCPForDNS,unsigned char* UseDHCPForDomain,unsigned char* DoDDNS);
  610. // int nwGetAllDNSCfg(DNS_CONFIG* dnscfg);
  611. // int nwSetDNSConf(unsigned char UseDHCPForDNS,unsigned char UseDHCPForDomain,unsigned char DoDDNS);
  612. // int nwSetAllDNSCfg_NotRestart(DNS_CONFIG* dnscfg);
  613. // int nwGetDHCPServerIP(char *dhcpServerIP);
  614. // /*!
  615. // * @brief Reading current/active network configuration using netman script
  616. // * #param[out] cfg - IP, Netmask, Gateway, Conf method(dhcp/statis)
  617. // * @returns 0 on succee , -1 on failure
  618. // */
  619. // int nwGetNwActIPCfg( NWEXT_IPCFG *cfg );
  620. // int GetIPAdrressType(uint8_t* IPAddr);
  621. // int nwSyncNWCfg_ipv4_v6(NWCFG_STRUCT *cfg,NWCFG6_STRUCT *cfg6, uint8_t EthIndex);
  622. // /**
  623. // *@fn GetIPAddrstr
  624. // *@brief This function is used to get IP address string for given ip or hostname
  625. // *@param addr - pointer to string of IP address of hostname
  626. // *@param pResIPaddr - pointer to IP address string
  627. // *@return Returns address family (AF_INET or AF_INET6) on success and -1 on failure
  628. // */
  629. // int GetIPAddrstr(unsigned char *addr, char *pResIPaddr);
  630. // int getFullyQualifiedDName(char *fqdname, uint8_t EthIndex);
  631. // int nwGetExtMACAddr(unsigned char *MAC);
  632. // /*
  633. // * @fn IsBMCNFSMode
  634. // * @brief Check whether BMC is in BMC Mode.
  635. // * @return 0 for FALSE,
  636. // * 1 for TRUE.
  637. // */
  638. // int IsBMCNFSMode();
  639. // int nwSyncBondCfg(BondIface *pBondCfg);
  640. // void GetNwStruct_v4_v6(NWCFG_STRUCT *pCFGIPv4,NWCFG6_STRUCT *pCFGIPv6);
  641. // int HandleDelayedNwRestart(DELAYEDLANRESTART_NWDATA *pDelyedLAN_NwCfgs, uint8_t Flag_SetDNS, uint8_t EthIndex);
  642. // int SetNWSpeed(PHYConfig_T *pPHYConfig, char * IFName);
  643. // int SetNWMTUSize(int mtu, char * IFName);
  644. // int SetVLANPriority(uint16_t vlanID, uint8_t VLANPriority, uint8_t TypeOfService, char *IfcName);
  645. #endif /* _NWCFG_H */