| 1 | |
| 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 | |
| 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 | |
| 29 |
|
| 30 | struct concap_proto{
|
| 31 | struct net_device *net_dev;
|
| 32 | struct concap_device_ops *dops;
|
| 33 | struct concap_proto_ops *pops;
|
| 34 | spinlock_t lock;
|
| 35 | int flags;
|
| 36 | void *proto_data; |
| 37 | be accessed via *pops methods only
|
| 38 | |
| 39 | :
|
| 40 | whatever
|
| 41 | :
|
| 42 |
|
| 43 | };
|
| 44 |
|
| 45 | |
| 46 | * protocol entity. No receive method is offered because the encapsulation
|
| 47 | * protocol directly calls netif_rx().
|
| 48 |
|
| 49 | struct concap_device_ops{
|
| 50 |
|
| 51 |
|
| 52 | int (*data_req)(struct concap_proto *, struct sk_buff *);
|
| 53 |
|
| 54 | |
| 55 | support connection control.
|
| 56 |
|
| 57 | int (*connect_req)(struct concap_proto *);
|
| 58 |
|
| 59 |
|
| 60 | int (*disconn_req)(struct concap_proto *);
|
| 61 | };
|
| 62 |
|
| 63 | |
| 64 | * device driver.
|
| 65 |
|
| 66 | struct concap_proto_ops{
|
| 67 |
|
| 68 |
|
| 69 | struct concap_proto * (*proto_new) (void);
|
| 70 |
|
| 71 | |
| 72 | cprot may no loger be referenced after calling this
|
| 73 | void (*proto_del)(struct concap_proto *cprot);
|
| 74 |
|
| 75 | |
| 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 | |
| 83 | protocol may not call any *dops methods after this.
|
| 84 | int (*close)(struct concap_proto *cprot);
|
| 85 |
|
| 86 |
|
| 87 | int (*encap_and_xmit)(struct concap_proto *cprot, struct sk_buff *skb);
|
| 88 |
|
| 89 |
|
| 90 | int (*data_ind)(struct concap_proto *cprot, struct sk_buff *skb);
|
| 91 |
|
| 92 | |
| 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 | |
| 106 |
|
| 107 | extern int concap_nop(struct concap_proto *cprot);
|
| 108 |
|
| 109 | |
| 110 |
|
| 111 | extern int concap_drop_skb(struct concap_proto *cprot, struct sk_buff *skb);
|
| 112 | #endif
|