]> git.sesse.net Git - vlc/blob - include/input_vlan.h
* vpar_blocks.c : Correction d'une erreur introduite hier soir avec
[vlc] / include / input_vlan.h
1 /*******************************************************************************
2  * input_vlan.h: vlan input method
3  * (c)1999 VideoLAN
4  *******************************************************************************
5  * ?? 
6  *******************************************************************************
7  * Required headers:
8  * <netinet/in.h>
9  * "vlc_thread.h"
10  *******************************************************************************/
11
12 /*******************************************************************************
13  * Vlan server related constants
14  *******************************************************************************/
15
16 #define VLAN_SERVER_MSG_LENGTH  256             /* maximum length of a message */
17 #define VLAN_CLIENT_VERSION     "1.3.0"                 /* vlan client version */
18
19 /* Messages codes */
20 #define VLAN_LOGIN_REQUEST      98        /* login: <version> <login> <passwd> */
21 #define VLAN_LOGIN_ANSWER       97                    /* login accepted: [msg] */
22 #define VLAN_LOGIN_REJECTED     96                    /* login rejected: [msg] */
23
24 #define VLAN_LOGOUT             99                                   /* logout */
25
26 #define VLAN_INFO_REQUEST       31                        /* info: no argument */
27 #define VLAN_INFO_ANSWER        32/* info ok: <switch> <port> <vlan> <sharers> */
28 #define VLAN_INFO_REJECTED      33                     /* info rejected: [msg] */
29
30 #define VLAN_CHANGE_REQUEST     21/* change: <mac> [ip] <vlan dest> [vlan src] */
31 #define VLAN_CHANGE_ANSWER      22                         /* change ok: [msg] */
32 #define VLAN_CHANGE_REJECTED    23                     /* change failed: [msg] */
33
34 /*******************************************************************************
35  * Macros to build/extract vlan_ids
36  *******************************************************************************/
37 #define VLAN_ID_IFACE( vlan_id )    ( ((vlan_id) >> 8) & 0xff ) 
38 #define VLAN_ID_VLAN( vlan_id )     ( (vlan_id) & 0xff )
39 #define VLAN_ID( iface, vlan )      ( ((iface) << 8) | (vlan) )
40
41 /*******************************************************************************
42  * input_vlan_server_t: vlan server
43  *******************************************************************************
44  * This structure describes a vlan server.
45  *******************************************************************************/
46 typedef struct
47 {
48     struct sockaddr_in  sa_in;                               /* server address */
49     int                 i_socket;                         /* socket descriptor */
50
51     /* Login informations */
52     char *              psz_login;                             /* server login */
53     char *              psz_passwd;                         /* server password */
54 } input_vlan_server_t;
55
56 /*******************************************************************************
57  * input_vlan_iface_t: vlan-capable network interface
58  *******************************************************************************
59  * This structure describes the abilities of a network interface capable of
60  * vlan management. Note that an interface could have several IP adresses, but
61  * since only the MAC address is used to change vlan, only one needs to be
62  * retrieved.
63  * ?? it could be interesting to send a port id on vlan request, to know if two
64  * interfaces are dependant regarding vlan changes.
65  *******************************************************************************/
66 typedef struct
67 {
68     char *                  psz_name;                        /* interface name */
69     struct sockaddr_in      sa_in;                             /* interface IP */
70     char                    psz_mac[20];                      /* interface MAC */
71
72     /* Hardware properties */
73     int                     i_master;                /* master interface index */
74     int                     i_switch;                         /* switch number */
75     int                     i_port;                             /* port number */
76     int                     i_sharers;          /* number of MACs on this port */
77     
78     /* Vlan properties - these are only used if i_master is negative */
79     int                     i_refcount;                       /* locks counter */
80     int                     i_vlan;                            /* current vlan */
81     int                     i_default_vlan;                    /* default vlan */
82 } input_vlan_iface_t;
83
84 /*******************************************************************************
85  * vlan_method_data_t
86  *******************************************************************************
87  * Store global vlan library data.
88  *******************************************************************************/
89 typedef struct
90 {    
91     vlc_mutex_t             lock;                              /* library lock */
92
93     /* Server */
94     input_vlan_server_t     server;                             /* vlan server */
95  
96     /* Network interfaces */
97     int                     i_ifaces;   /* number of vlan-compliant interfaces */
98     input_vlan_iface_t *    p_iface;                             /* interfaces */
99 } input_vlan_method_t;
100
101 /*******************************************************************************
102  * Prototypes
103  *******************************************************************************/
104 int     input_VlanMethodInit    ( input_vlan_method_t *p_method,
105                                   char *psz_server, int i_port);
106 void    input_VlanMethodFree    ( input_vlan_method_t *p_method );
107
108 int     input_VlanId            ( char *psz_iface, int i_vlan );
109 int     input_VlanJoin          ( int i_vlan_id );
110 void    input_VlanLeave         ( int i_vlan_id );
111 int     input_VlanRequest       ( char *psz_iface );
112 int     input_VlanSynchronize   ( void );
113
114
115