]> git.sesse.net Git - vlc/blob - include/netutils.h
Je vous avais pr�venu. Le demoronifier a frapp�.
[vlc] / include / netutils.h
1 /*****************************************************************************
2  * netutils.h: various network functions
3  * (c)1999 VideoLAN
4  *****************************************************************************
5  * This header describe miscellanous utility functions shared between several
6  * modules.
7  *****************************************************************************
8  * Required headers:
9  *  <netinet/in.h>
10  *****************************************************************************/
11
12
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  *****************************************************************************/
19 typedef struct
20 {
21     /* Interface device name (e.g. "eth0") */
22     char* psz_ifname;
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) */
30     u16 i_flags;
31 } if_descr_t;
32
33
34 /*****************************************************************************
35  * net_descr_t: describes all the interfaces of the computer
36  *****************************************************************************
37  * Nothing special to say :)
38  *****************************************************************************/
39 typedef struct
40 {
41     /* Number of networks interfaces described below */
42     int i_if_number;
43     /* Table of if_descr_t describing each interface */
44     if_descr_t* a_if;
45 } net_descr_t;
46
47
48 /*****************************************************************************
49  * Prototypes
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 );
55