/* * aps_if.h - Device Class Driver Interface Header * Copyright (C) 1997-2000 SpellCaster Telecommunications Inc. * $Id: aps_if.h,v 1.4 2004/08/24 01:46:14 bcrl Exp $ * Released under the GNU Public License. See LICENSE file for details. */ #ifndef _APS_IF_H #define _APS_IF_H #ifdef __cplusplus extern "C" { #endif #ifndef __KERNEL__ #include #include #endif #ifdef __KERNEL__ #include #include #include #include #include #include #include #include "vercomp.h" #endif /* def __KERNEL__ */ struct bdev_stats { u64 rx_bytes; u64 tx_bytes; u64 rx_packets; u64 tx_packets; u64 rx_dropped; u64 tx_dropped; u64 rx_errors; u64 collisions; }; #ifdef __KERNEL__ /* * Call States */ #define CS_IDLE 0 #define CS_DIALING 1 #define CS_RINGING 2 #define CS_CONNECTING 3 #define CS_CONNECTED 4 #define CS_DISCONNECTING 5 #define CS_DISCONNECTED 6 #define CS_STALLED 7 #define CS_UNAVAIL 8 struct wait_queue; struct sk_buff; /* * The channel structure * Must be 32-bit aligned!!!!! */ typedef struct channel { struct net_device ndev; unsigned long busy; unsigned char use_existing_call; /* Device Specific */ unsigned int mru; unsigned int device_id; unsigned int devclass_id; char device_name[16]; char dev_class[16]; unsigned int unit; unsigned int index; unsigned int channels_index; /* Pointer to associated device */ void *dev; /* Outgoing/Incoming dn's */ char CalledNumber[32]; char CallerNumber[32]; int callType; /* call type for incoming calls */ /* Filled in by the device class driver (callbacks) */ void (*use)(struct channel *); void (*unuse)(struct channel *); int (*Output)(struct channel *, struct sk_buff *); int (*Connect)(struct channel *, const char *, u32); int (*Hangup)(struct channel *); void (*SetACCM)(struct channel *, u32 rx, u32 tx); int (*ioctl)(struct channel *ch, unsigned int cmd, unsigned long arg); void (*ReInput)(struct channel *ch, struct sk_buff *skb); /* Provided by the protocol driver to the class driver */ void (*Open)(struct channel *); void (*Close)(struct channel *); void (*Up)(struct channel *); void (*Down)(struct channel *); void (*OutputComplete)(struct channel *); void (*ConnectComplete)(struct channel *, int); void (*Release)(struct channel *); /* Next channel in the list */ struct channel *next; /* Link we're attached to */ void *link; /* The current disposition of the channel */ unsigned char state; unsigned char no_auth; /* set by driver if link is already authenticated. */ unsigned char reserved[2]; unsigned int x_accm[4]; /* Tx Async Control Mask */ unsigned int r_accm; /* Rx Async Control Mask */ struct bdev_stats stats; #if LINUX_VERSION_CODE < 0x20100 unsigned long rx_bytes, tx_bytes; #define CH_rx_bytes rx_bytes #define CH_tx_bytes tx_bytes #else #define CH_rx_bytes stats.rx_bytes #define CH_tx_bytes stats.tx_bytes #endif } channel_t; #define ETH_P_PPP 0x0024 /* Provided by the protocol driver to the class driver */ extern void ch_Input(channel_t *ch, struct sk_buff *skb); extern void ch_Open(struct channel *); extern void ch_Close(struct channel *); extern void ch_Up(struct channel *); extern void ch_Down(struct channel *); extern void ch_OutputComplete(struct channel *); extern void ch_ConnectComplete(struct channel *, int); struct chan; struct file; struct inode; extern int ch_ioctl(struct inode *, struct file *filp, struct chan *, unsigned int cmd, unsigned long arg); inline void clear_busy(channel_t *ch) { clear_bit(0, &ch->busy); } inline void set_busy(channel_t *ch) { set_bit(0, &ch->busy); } inline int test_busy(channel_t *ch) { return (test_bit(0, &ch->busy)); } inline int test_and_set_busy(channel_t *ch) { return (test_and_set_bit(0, &ch->busy)); } /* * The following functions are exported from Babylon */ extern unsigned int RegisterDeviceClass(char *); extern void UnregisterDeviceClass(unsigned int); extern int RegisterChannel(channel_t *); extern void UnregisterChannel(channel_t *); extern ssize_t babylon_read(struct file *filp, char __user *buf, size_t len, loff_t *off); extern ssize_t babylon_write(struct file *filp, const char __user *buf, size_t len, loff_t *off); extern unsigned int babylon_poll(struct file *filp, poll_table *wait); extern int babylon_ioctl(struct inode *ino, struct file *filp, unsigned int cmd, unsigned long arg); extern long babylon_unlocked_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); extern int babylon_release(struct inode *ino, struct file *filp); extern struct chan *babylon_alloc_call(channel_t *ch, int *retp); extern int babylon_release_call(struct chan *dev, struct file *filp) ; #endif /*def __KERNEL__ */ #define BIOCGETCHCLASS _IOR('I', 0x24, char[32]) /* arg = char class[32] */ #define BIOCGETCHNAME _IOR('I', 0x25, char[32]) /* arg = char name[32] */ #define BIOCDIAL _IO('I', 0x26) /* arg = char *number */ #define BIOCANSWER _IO('I', 0x2a) /* arg = u32 */ #define BIOCGETCALLID _IO('I', 0x2b) /* arg = n/a */ #define BIOC_GETBSTATS _IOR('I', 0x2c, struct bdev_stats) /* arg = (struct bdev_stats *) */ #define BIOC_SET_MULTIHOP _IO('I', 0x2d) /* arg = int callid */ #define BIOCGETDEVID _IO('x', 0x14) /* arg = n/a */ #define BIOCCREATEBUNDLE _IO('x', 0x15) /* arg = int * */ #define BIOCDESTROYBUNDLE _IO('x', 0x16) /* arg = int */ #define BIOCJOINBUNDLE _IO('x', 0x17) /* arg = int */ #define BIOCLEAVEBUNDLE _IO('x', 0x18) /* arg = n/a */ #define BIOCHANGUP _IO('x', 0x19) /* arg = n/a */ #define BIOC_SETLCFL _IO('x', 0x1a) /* arg = int */ #define BIOC_SETRCFL _IO('x', 0x1b) /* arg = int */ #define BIOC_GETLCFL _IOR('x', 0x1c, int) /* arg = int * */ #define BIOC_GETRCFL _IOR('x', 0x1d, int) /* arg = int * */ #define BIOC_SET_MTU _IO('x', 0x1e) /* arg = int */ #define BIOCCREATEBUNDLENAME _IO('x', 0x1f) /* arg = (char *) */ #define AF_BPPP 29 /* protocol family */ #define PF_BPPP AF_BPPP /* protocol family */ #define BF_PPP 0x0001 /* channel: actually do ppp processing */ #define BF_ACFC 0x0002 #define BF_PFC 0x0004 #define BF_PASS_ML 0x0008 #define BF_PASS_IP 0x0010 #define BF_PASS_IPX 0x0020 #define BF_SSN 0x0040 #define BF_STAY_UP 0x0080 /* device: stay up when all channels are gone */ #define BF_VJC 0x0100 /* enable Van Jacobson header compression */ #define BF_STRICT_ORDER 0x0200 /* enable strict packet ordering on ML packets. Required for most compression protocols */ #define BF_RAIN 0x0400 #define BF_PASS_IPV6 0x0800 #define BIOC_GETFRAME _IOR('x', 0x1e, int) /* arg = (int *) */ #define BIOC_SETFRAME _IO('x', 0x1f) /* int */ #define FRAME_HDLC 0x00 #define FRAME_RAW 0x01 #define BIOC_GETMAXFRAMESIZE _IOR('x', 0x20, int) /* (int *) */ #define BIOC_SETMAXFRAMESIZE _IO('x', 0x21) /* (int) */ #define BIOC_SETLBFL _IO('x', 0x22) /* arg = (int) */ #define BIOC_SETRBFL _IO('x', 0x23) /* arg = (int) */ #define BIOC_GETLBFL _IOR('x', 0x24, int) /* arg = (int *) */ #define BIOC_GETRBFL _IOR('x', 0x25, int) /* arg = (int *) */ #define BIOC_GETCALLTYPE _IOR('x', 0x26, int) /* arg = (int *) */ #define BIOC_SETCALLTYPE _IO('x', 0x27) /* arg = (int) */ #define BIOC_GETCAUSECODE _IOR('x', 0x28, int) /* arg = (int *) */ #define L2TP_BIND_SOCK _IO('x', 0x29) /* arg = int fd */ #define BIOC_GET_CALLING_NUMBER _IOR('x', 0x2A, char[32]) /* arg = (char[32] *) */ #define BIOC_GET_CALLED_NUMBER _IOR('x', 0x2B, char[32]) /* arg = (char[32] *) */ #define BIOC_GET_MAX_MRU _IOR('x', 0x2C, int) /* arg = (int *) */ #define BIOC_MVIP_ATTACH _IO('x', 0x2D) /* arg = (int) = (stream << 8) | slot -> use MVIP_SLOT */ #define MVIP_SLOT_NONE (~0UL) #define MVIP_SLOT(stream, slot) (((unsigned long)(stream) << 8) | (unsigned long)(slot)) #define CALLTYPE_64K 0 #define CALLTYPE_56K 1 #define CALLTYPE_SPEECH 2 #define CALLTYPE_31KHZ 3 #define BIOC_GET_LINK_STATS _IOR('x', 0x2E, struct bdev_stats) /* arg = struct bdev_stats * */ #define BIOC_SET_MAX_CREDITS _IO('x', 0x2F) /* arg = int bytes */ #define BIOC_SET_BANDWIDTH _IO('x', 0x30) /* arg = int bits_per_second */ #define BIOC_SET_PACKET_OVERHEAD _IO('x', 0x31) /* arg = bytes */ #define BIOC_SET_MIN_FRAGS _IO('x', 0x32) /* arg = nfrags */ #define BIOC_SET_MAX_FRAGS _IO('x', 0x33) /* arg = nfrags */ #define BIOC_GET_MIN_FRAGS _IOR('x', 0x34, unsigned) /* arg = unsigned * */ #define BIOC_GET_MAX_FRAGS _IOR('x', 0x35, unsigned) /* arg = unsigned * */ #define BIOCSETBUNDLENETNS _IO('x', 0x36) /* arg = int netns_pid */ struct l2tp_hardwire_info { char dev_name[32]; u32 hw_src_ip; u32 hw_dst_ip; u16 hw_src_port; u16 hw_dst_port; u16 hw_peer_tunnel; u16 hw_peer_session; u8 hw_gw_mac[6]; }; #define BIOC_L2TP_HARDWIRE_SESSION _IOR('x', 0x37, void *) #define BIOC_GET_IDLE_MS _IOR('x', 0x38, unsigned long) #define BIOC_L2TP_SET_TUNNEL_CSUM_PAYLOAD _IOR('x', 0x39, unsigned) #ifdef __cplusplus }; #endif #endif // _APS_IF_H