]> git.sesse.net Git - vlc/blob - include/netutils.h
Encore un commit venu tout droit des abysses de l'enfer, d�sol� pour
[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 GNU
18  * General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public
21  * License along with this program; if not, write to the
22  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23  * Boston, MA 02111-1307, USA.
24  *****************************************************************************/
25
26 /*****************************************************************************
27  * Required headers:
28  *  <netinet/in.h>
29  *****************************************************************************/
30
31
32 /*****************************************************************************
33  * if_descr_t: describes a network interface.
34  *****************************************************************************
35  * Note that if the interface is a point to point one, the broadcast address is
36  * set to the destination address of that interface
37  *****************************************************************************/
38 typedef struct
39 {
40     /* Interface device name (e.g. "eth0") */
41     char* psz_ifname;
42     /* Interface physical address */
43     struct sockaddr sa_phys_addr;
44     /* Interface network address */
45     struct sockaddr_in sa_net_addr;
46     /* Interface broadcast address */
47     struct sockaddr_in sa_bcast_addr;
48     /* Interface flags: see if.h for their description) */
49     u16 i_flags;
50 } if_descr_t;
51
52
53 /*****************************************************************************
54  * net_descr_t: describes all the interfaces of the computer
55  *****************************************************************************
56  * Nothing special to say :)
57  *****************************************************************************/
58 typedef struct
59 {
60     /* Number of networks interfaces described below */
61     int i_if_number;
62     /* Table of if_descr_t describing each interface */
63     if_descr_t* a_if;
64 } net_descr_t;
65
66
67 /*****************************************************************************
68  * Prototypes
69  *****************************************************************************/
70 int ReadIfConf      (int i_sockfd, if_descr_t* p_ifdescr, char* psz_name);
71 int ReadNetConf     (int i_sockfd, net_descr_t* p_net_descr);
72 int BuildInetAddr   ( struct sockaddr_in *p_sa_in, char *psz_in_addr, int i_port );
73 int ServerPort      ( char *psz_addr );
74