]> git.sesse.net Git - vlc/blob - include/netutils.h
. correction des conneries de BBP :)
[vlc] / include / netutils.h
1 /*****************************************************************************
2  * netutils.h: various network functions
3  * This header describes miscellanous utility functions shared between several
4  * modules.
5  *****************************************************************************
6  * Copyright (C) 1999, 2000 VideoLAN
7  *
8  * Authors:
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  * 
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
23  *****************************************************************************/
24
25 /*****************************************************************************
26  * Required headers:
27  *  <netinet/in.h>
28  *****************************************************************************/
29
30
31 /*****************************************************************************
32  * if_descr_t: describes a network interface.
33  *****************************************************************************
34  * Note that if the interface is a point to point one, the broadcast address is
35  * set to the destination address of that interface
36  *****************************************************************************/
37 typedef struct
38 {
39     /* Interface device name (e.g. "eth0") */
40     char* psz_ifname;
41     /* Interface physical address */
42     struct sockaddr sa_phys_addr;
43     /* Interface network address */
44     struct sockaddr_in sa_net_addr;
45     /* Interface broadcast address */
46     struct sockaddr_in sa_bcast_addr;
47     /* Interface flags: see if.h for their description) */
48     u16 i_flags;
49 } if_descr_t;
50
51
52 /*****************************************************************************
53  * net_descr_t: describes all the interfaces of the computer
54  *****************************************************************************
55  * Nothing special to say :)
56  *****************************************************************************/
57 typedef struct
58 {
59     /* Number of networks interfaces described below */
60     int i_if_number;
61     /* Table of if_descr_t describing each interface */
62     if_descr_t* a_if;
63 } net_descr_t;
64
65
66 /*****************************************************************************
67  * Prototypes
68  *****************************************************************************/
69 int ReadIfConf      (int i_sockfd, if_descr_t* p_ifdescr, char* psz_name);
70 int ReadNetConf     (int i_sockfd, net_descr_t* p_net_descr);
71 int BuildInetAddr   ( struct sockaddr_in *p_sa_in, char *psz_in_addr, int i_port );
72 int ServerPort      ( char *psz_addr );
73