File: /usr/src/linux/include/linux/if_wanpipe.h

1     /*****************************************************************************
2     * if_wanpipe.h	Header file for the Sangoma AF_WANPIPE Socket 	
3     *
4     * Author: 	Nenad Corbic 	
5     *
6     * Copyright:	(c) 2000 Sangoma Technologies Inc.
7     *
8     *		This program is free software; you can redistribute it and/or
9     *		modify it under the terms of the GNU General Public License
10     *		as published by the Free Software Foundation; either version
11     *		2 of the License, or (at your option) any later version.
12     * ============================================================================
13     *
14     * Jan 28, 2000	Nenad Corbic 	Initial Version
15     *
16     *****************************************************************************/
17     
18     #ifndef __LINUX_IF_WAN_PACKET_H
19     #define __LINUX_IF_WAN_PACKET_H
20     
21     struct wan_sockaddr_ll
22     {
23     	unsigned short	sll_family;
24     	unsigned short	sll_protocol;
25     	int		sll_ifindex;
26     	unsigned short	sll_hatype;
27     	unsigned char	sll_pkttype;
28     	unsigned char	sll_halen;
29     	unsigned char	sll_addr[8];
30     	unsigned char   sll_device[14];
31     	unsigned char 	sll_card[14];
32     };
33     
34     typedef struct 
35     {
36     	unsigned char free;
37     	unsigned char sk_state;
38     	int rcvbuf;
39     	int sndbuf;
40     	int rmem;
41     	int wmem;
42     	int sk_count;
43     	unsigned char bound;
44     	char name[14];
45     	unsigned char d_state;
46     	unsigned char svc;
47     	unsigned short lcn;
48     	unsigned char mbox;
49     	unsigned char cmd_busy;
50     	unsigned char command;
51     	unsigned poll;
52     	unsigned poll_cnt;
53     	int rblock;	
54     } wan_debug_hdr_t;
55     
56     #define MAX_NUM_DEBUG  10
57     #define X25_PROT       0x16
58     #define PVC_PROT       0x17	
59     
60     typedef struct
61     {
62     	wan_debug_hdr_t debug[MAX_NUM_DEBUG];
63     }wan_debug_t;
64     
65     #define	SIOC_WANPIPE_GET_CALL_DATA	(SIOCPROTOPRIVATE + 0)
66     #define	SIOC_WANPIPE_SET_CALL_DATA	(SIOCPROTOPRIVATE + 1)
67     #define SIOC_WANPIPE_ACCEPT_CALL	(SIOCPROTOPRIVATE + 2)
68     #define SIOC_WANPIPE_CLEAR_CALL	        (SIOCPROTOPRIVATE + 3)
69     #define SIOC_WANPIPE_RESET_CALL	        (SIOCPROTOPRIVATE + 4)
70     #define SIOC_WANPIPE_DEBUG	        (SIOCPROTOPRIVATE + 5)
71     #define SIOC_WANPIPE_SET_NONBLOCK	(SIOCPROTOPRIVATE + 6)
72     #define SIOC_WANPIPE_CHECK_TX		(SIOCPROTOPRIVATE + 7)
73     #define SIOC_WANPIPE_SOCK_STATE		(SIOCPROTOPRIVATE + 8)
74     
75     /* Packet types */
76     
77     #define WAN_PACKET_HOST		0		/* To us		*/
78     #define WAN_PACKET_BROADCAST	1		/* To all		*/
79     #define WAN_PACKET_MULTICAST	2		/* To group		*/
80     #define WAN_PACKET_OTHERHOST	3		/* To someone else 	*/
81     #define WAN_PACKET_OUTGOING		4		/* Outgoing of any type */
82     /* These ones are invisible by user level */
83     #define WAN_PACKET_LOOPBACK		5		/* MC/BRD frame looped back */
84     #define WAN_PACKET_FASTROUTE	6		/* Fastrouted frame	*/
85     
86     
87     /* X25 specific */
88     #define WAN_PACKET_DATA 	7
89     #define WAN_PACKET_CMD 		8
90     #define WAN_PACKET_ASYNC	9
91     #define WAN_PACKET_ERR	       10
92     
93     /* Packet socket options */
94     
95     #define WAN_PACKET_ADD_MEMBERSHIP		1
96     #define WAN_PACKET_DROP_MEMBERSHIP		2
97     
98     #define WAN_PACKET_MR_MULTICAST	0
99     #define WAN_PACKET_MR_PROMISC	1
100     #define WAN_PACKET_MR_ALLMULTI	2
101     
102     #ifdef __KERNEL__
103     #ifndef netdevice_t
104     #include <linux/version.h>
105     #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0)
106      #define netdevice_t struct net_device
107     #else
108      #define netdevice_t struct device
109     #endif
110     #endif
111     
112     /* Private wanpipe socket structures. */
113     struct wanpipe_opt
114     {
115     	void   *mbox;		/* Mail box  */
116     	void   *card; 		/* Card bouded to */
117     	netdevice_t *dev;	/* Bounded device */
118     	unsigned short lcn;	/* Binded LCN */
119     	unsigned char  svc;	/* 0=pvc, 1=svc */
120     	unsigned char  timer;   /* flag for delayed transmit*/	
121     	struct timer_list tx_timer;
122     	unsigned poll_cnt;
123     	unsigned char force;	/* Used to force sock release */
124     	atomic_t packet_sent;   
125     };
126     #endif
127     
128     #endif
129