Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik...
[linux-2.6] / 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 state_sk;
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
104 /* Private wanpipe socket structures. */
105 struct wanpipe_opt
106 {
107         void   *mbox;           /* Mail box  */
108         void   *card;           /* Card bouded to */
109         struct net_device *dev; /* Bounded device */
110         unsigned short lcn;     /* Binded LCN */
111         unsigned char  svc;     /* 0=pvc, 1=svc */
112         unsigned char  timer;   /* flag for delayed transmit*/  
113         struct timer_list tx_timer;
114         unsigned poll_cnt;
115         unsigned char force;    /* Used to force sock release */
116         atomic_t packet_sent;   
117         unsigned short num; 
118 };
119
120 #define wp_sk(__sk) ((struct wanpipe_opt *)(__sk)->sk_protinfo)
121
122 #endif
123
124 #endif