1 /*******************************************************************************
2 * input_vlan.h: vlan input method
4 *******************************************************************************
6 *******************************************************************************
10 *******************************************************************************/
12 /*******************************************************************************
13 * Vlan server related constants
14 *******************************************************************************/
16 #define VLAN_SERVER_MSG_LENGTH 256 /* maximum length of a message */
17 #define VLAN_CLIENT_VERSION "1.3.0" /* vlan client version */
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] */
24 #define VLAN_LOGOUT 99 /* logout */
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] */
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] */
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) )
41 /*******************************************************************************
42 * input_vlan_server_t: vlan server
43 *******************************************************************************
44 * This structure describes a vlan server.
45 *******************************************************************************/
48 struct sockaddr_in sa_in; /* server address */
49 int i_socket; /* socket descriptor */
51 /* Login informations */
52 char * psz_login; /* server login */
53 char * psz_passwd; /* server password */
54 } input_vlan_server_t;
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
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 *******************************************************************************/
68 char * psz_name; /* interface name */
69 struct sockaddr_in sa_in; /* interface IP */
70 char psz_mac[20]; /* interface MAC */
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 */
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 */
84 /*******************************************************************************
86 *******************************************************************************
87 * Store global vlan library data.
88 *******************************************************************************/
91 vlc_mutex_t lock; /* library lock */
94 input_vlan_server_t server; /* vlan server */
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;
101 /*******************************************************************************
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 );
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 );