Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
concap.h
Go to the documentation of this file.
1 /* $Id: concap.h,v 1.3.2.2 2004/01/12 23:08:35 keil Exp $
2  *
3  * Copyright 1997 by Henner Eisen <[email protected]>
4  *
5  * This software may be used and distributed according to the terms
6  * of the GNU General Public License, incorporated herein by reference.
7  */
8 
9 #ifndef _LINUX_CONCAP_H
10 #define _LINUX_CONCAP_H
11 
12 #include <linux/skbuff.h>
13 #include <linux/netdevice.h>
14 
15 /* Stuff to support encapsulation protocols genericly. The encapsulation
16  protocol is processed at the uppermost layer of the network interface.
17 
18  Based on a ideas developed in a 'synchronous device' thread in the
19  linux-x25 mailing list contributed by Alan Cox, Thomasz Motylewski
20  and Jonathan Naylor.
21 
22  For more documetation on this refer to Documentation/isdn/README.concap
23 */
24 
25 struct concap_proto_ops;
26 struct concap_device_ops;
27 
28 /* this manages all data needed by the encapsulation protocol
29  */
30 struct concap_proto{
31  struct net_device *net_dev; /* net device using our service */
32  struct concap_device_ops *dops; /* callbacks provided by device */
33  struct concap_proto_ops *pops; /* callbacks provided by us */
35  int flags;
36  void *proto_data; /* protocol specific private data, to
37  be accessed via *pops methods only*/
38  /*
39  :
40  whatever
41  :
42  */
43 };
44 
45 /* Operations to be supported by the net device. Called by the encapsulation
46  * protocol entity. No receive method is offered because the encapsulation
47  * protocol directly calls netif_rx().
48  */
50 
51  /* to request data is submitted by device*/
52  int (*data_req)(struct concap_proto *, struct sk_buff *);
53 
54  /* Control methods must be set to NULL by devices which do not
55  support connection control.*/
56  /* to request a connection is set up */
58 
59  /* to request a connection is released */
60  int (*disconn_req)(struct concap_proto *);
61 };
62 
63 /* Operations to be supported by the encapsulation protocol. Called by
64  * device driver.
65  */
67 
68  /* create a new encapsulation protocol instance of same type */
69  struct concap_proto * (*proto_new) (void);
70 
71  /* delete encapsulation protocol instance and free all its resources.
72  cprot may no loger be referenced after calling this */
73  void (*proto_del)(struct concap_proto *cprot);
74 
75  /* initialize the protocol's data. To be called at interface startup
76  or when the device driver resets the interface. All services of the
77  encapsulation protocol may be used after this*/
78  int (*restart)(struct concap_proto *cprot,
79  struct net_device *ndev,
80  struct concap_device_ops *dops);
81 
82  /* inactivate an encapsulation protocol instance. The encapsulation
83  protocol may not call any *dops methods after this. */
84  int (*close)(struct concap_proto *cprot);
85 
86  /* process a frame handed down to us by upper layer */
87  int (*encap_and_xmit)(struct concap_proto *cprot, struct sk_buff *skb);
88 
89  /* to be called for each data entity received from lower layer*/
90  int (*data_ind)(struct concap_proto *cprot, struct sk_buff *skb);
91 
92  /* to be called when a connection was set up/down.
93  Protocols that don't process these primitives might fill in
94  dummy methods here */
95  int (*connect_ind)(struct concap_proto *cprot);
96  int (*disconn_ind)(struct concap_proto *cprot);
97  /*
98  Some network device support functions, like net_header(), rebuild_header(),
99  and others, that depend solely on the encapsulation protocol, might
100  be provided here, too. The net device would just fill them in its
101  corresponding fields when it is opened.
102  */
103 };
104 
105 /* dummy restart/close/connect/reset/disconn methods
106  */
107 extern int concap_nop(struct concap_proto *cprot);
108 
109 /* dummy submit method
110  */
111 extern int concap_drop_skb(struct concap_proto *cprot, struct sk_buff *skb);
112 #endif