1 /*****************************************************************************
2 * netutils.h: various network functions
3 * This header describes miscellanous utility functions shared between several
5 *****************************************************************************
6 * Copyright (C) 1999, 2000 VideoLAN
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.
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.
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 *****************************************************************************/
25 /*****************************************************************************
28 *****************************************************************************/
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 *****************************************************************************/
39 /* Interface device name (e.g. "eth0") */
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) */
52 /*****************************************************************************
53 * net_descr_t: describes all the interfaces of the computer
54 *****************************************************************************
55 * Nothing special to say :)
56 *****************************************************************************/
59 /* Number of networks interfaces described below */
61 /* Table of if_descr_t describing each interface */
66 /*****************************************************************************
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 );