1 /*******************************************************************************
2 * netutils.h: various network functions
4 *******************************************************************************
5 * This header describe miscellanous utility functions shared between several
7 *******************************************************************************
10 *******************************************************************************/
13 /*******************************************************************************
14 * if_descr_t: describes a network interface.
15 *******************************************************************************
16 * Note that if the interface is a point to point one, the broadcast address is
17 * set to the destination address of that interface
18 *******************************************************************************/
21 /* Interface device name (e.g. "eth0") */
23 /* Interface physical address */
24 struct sockaddr sa_phys_addr;
25 /* Interface network address */
26 struct sockaddr_in sa_net_addr;
27 /* Interface broadcast address */
28 struct sockaddr_in sa_bcast_addr;
29 /* Interface flags: see if.h for their description) */
34 /*******************************************************************************
35 * net_descr_t: describes all the interfaces of the computer
36 *******************************************************************************
37 * Nothing special to say :)
38 *******************************************************************************/
41 /* Number of networks interfaces described below */
43 /* Table of if_descr_t describing each interface */
48 /*******************************************************************************
50 *******************************************************************************/
51 int ReadIfConf (int i_sockfd, if_descr_t* p_ifdescr, char* psz_name);
52 int ReadNetConf (int i_sockfd, net_descr_t* p_net_descr);
53 int BuildInetAddr ( struct sockaddr_in *p_sa_in, char *psz_in_addr, int i_port );
54 int ServerPort ( char *psz_addr );