slub: fix a possible memleak in __slab_alloc()
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / linux / ppp_channel.h
blob5d87f810a3b747d028c47dc9c70264c6eccd6cc0
1 #ifndef _PPP_CHANNEL_H_
2 #define _PPP_CHANNEL_H_
3 /*
4 * Definitions for the interface between the generic PPP code
5 * and a PPP channel.
7 * A PPP channel provides a way for the generic PPP code to send
8 * and receive packets over some sort of communications medium.
9 * Packets are stored in sk_buffs and have the 2-byte PPP protocol
10 * number at the start, but not the address and control bytes.
12 * Copyright 1999 Paul Mackerras.
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version
17 * 2 of the License, or (at your option) any later version.
19 * ==FILEVERSION 20000322==
22 #include <linux/list.h>
23 #include <linux/skbuff.h>
24 #include <linux/poll.h>
25 #include <net/net_namespace.h>
27 struct ppp_channel;
29 struct ppp_channel_ops {
30 /* Send a packet (or multilink fragment) on this channel.
31 Returns 1 if it was accepted, 0 if not. */
32 int (*start_xmit)(struct ppp_channel *, struct sk_buff *);
33 /* Handle an ioctl call that has come in via /dev/ppp. */
34 int (*ioctl)(struct ppp_channel *, unsigned int, unsigned long);
37 struct ppp_channel {
38 void *private; /* channel private data */
39 const struct ppp_channel_ops *ops; /* operations for this channel */
40 int mtu; /* max transmit packet size */
41 int hdrlen; /* amount of headroom channel needs */
42 void *ppp; /* opaque to channel */
43 int speed; /* transfer rate (bytes/second) */
44 /* the following is not used at present */
45 int latency; /* overhead time in milliseconds */
48 #ifdef __KERNEL__
49 /* Called by the channel when it can send some more data. */
50 extern void ppp_output_wakeup(struct ppp_channel *);
52 /* Called by the channel to process a received PPP packet.
53 The packet should have just the 2-byte PPP protocol header. */
54 extern void ppp_input(struct ppp_channel *, struct sk_buff *);
56 /* Called by the channel when an input error occurs, indicating
57 that we may have missed a packet. */
58 extern void ppp_input_error(struct ppp_channel *, int code);
60 /* Attach a channel to a given PPP unit in specified net. */
61 extern int ppp_register_net_channel(struct net *, struct ppp_channel *);
63 /* Attach a channel to a given PPP unit. */
64 extern int ppp_register_channel(struct ppp_channel *);
66 /* Detach a channel from its PPP unit (e.g. on hangup). */
67 extern void ppp_unregister_channel(struct ppp_channel *);
69 /* Get the channel number for a channel */
70 extern int ppp_channel_index(struct ppp_channel *);
72 /* Get the unit number associated with a channel, or -1 if none */
73 extern int ppp_unit_number(struct ppp_channel *);
75 /* Get the device name associated with a channel, or NULL if none */
76 extern char *ppp_dev_name(struct ppp_channel *);
79 * SMP locking notes:
80 * The channel code must ensure that when it calls ppp_unregister_channel,
81 * nothing is executing in any of the procedures above, for that
82 * channel. The generic layer will ensure that nothing is executing
83 * in the start_xmit and ioctl routines for the channel by the time
84 * that ppp_unregister_channel returns.
87 #endif /* __KERNEL__ */
88 #endif