Home |
Function xn_add_host_table_entry Function xn_delete_host_table_entry Function xn_bootp_res Function xn_interface_open_config Function xn_interface_ethernet_statistics Function xn_interface_statistics Function xn_send_ethernet_frame Function cb_wr_screen_string_fnc Function cb_rs232_connection_lost_fnc |
Function xn_bootp_resCalls a bootp server to get this node's IP address and other configuration parameters. #define IP_ALEN 4 typedef struct static_route_t { byte dest_ip[IP_ALEN]; /* destination addr */ byte gw_ip[IP_ALEN]; /* gateway's addr */ } STATIC_ROUTE; struct boot_p_results { int have_mask; /* True is subnet mask returned */ byte my_ip_address[IP_ALEN]; /* local IP address */ byte bootp_ip_address[IP_ALEN]; /* local IP address */ char bootp_file_name[128]; byte my_net_mask[IP_ALEN]; /* Subnet mask */ byte my_host_name[64]; /* My host name */ byte my_domain_name[100]; /* My domain name */ byte default_gateway[IP_ALEN]; /* Default gateway */ int n_gateways; /* Number of gateways in vendor */ /* specific */ int n_domservers; int n_static_routes; byte * gateways; byte * domservers; /* Allow up to CFG_MAX_DNS_SRV */ STATIC_ROUTE * static_routes; /* static routes */ }; int xn_bootp_res(int iface_no, struct boot_p_results * presults); Parametersiface_noInterface number (returned by xn_interface_open, xn_interface_open_config or xn_attach). presultsPointer to a structure to receive the results. return valueReturns 0 if successful, otherwise SOCKET_ERROR. If an error occurred, call xn_getlasterror and xn_geterror_string to return the error value. Section Error Codes further describes each error. Possible values for this function are:
This routine implements a Stanford BOOTP protocol client over UDP. It may be called after the interface has been initialized. It retrieves and applies the interface's IP address and network IP mask based on data from the bootp server. Applications are responsible for allocating and deallocation the structure passed to xn_bootp_res(). Example:struct boot_p_results Results; memset(&Results, 0, sizeof(Results)); Results.gateways = malloc(CFG_BOOTP_RTSIZE * IP_ALEN); Results.domservers = malloc(CFG_MAX_DNS_SRV * IP_ALEN); Results.static_routes = malloc(CFG_BOOTP_RTSIZE * sizeof(STATIC_ROUTE)); int code = xn_bootp_res(interface, &Result); if (Code == SOCKET_ERROR) ... Alternatively, call xn_bootp which handles allocation and deallocation internally.
|