Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

slip.c File Reference

#include <linux/config.h>
#include <linux/module.h>
#include <asm/system.h>
#include <asm/uaccess.h>
#include <asm/bitops.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/in.h>
#include <linux/tty.h>
#include <linux/errno.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/rtnetlink.h>
#include <linux/if_arp.h>
#include <linux/if_slip.h>
#include <linux/init.h>
#include "slip.h"

Include dependency graph for slip.c:

Go to the source code of this file.

Defines

#define SL_CHECK_TRANSMIT
#define SLIP_VERSION   "0.8.4-NET3.019-NEWTTY"

Typedefs

typedef slip_ctrl slip_ctrl_t

Functions

 MODULE_PARM (slip_maxdev,"i")
static int slip_esc (unsigned char *p, unsigned char *d, int len)
static void slip_unesc (struct slip *sl, unsigned char c)
static int sl_alloc_bufs (struct slip *sl, int mtu)
static void sl_free_bufs (struct slip *sl)
static int sl_realloc_bufs (struct slip *sl, int mtu)
static void sl_lock (struct slip *sl)
static void sl_unlock (struct slip *sl)
static void sl_bump (struct slip *sl)
static void sl_encaps (struct slip *sl, unsigned char *icp, int len)
static void slip_write_wakeup (struct tty_struct *tty)
static int sl_xmit (struct sk_buff *skb, struct device *dev)
static int sl_close (struct device *dev)
static int sl_open (struct device *dev)
static int sl_change_mtu (struct device *dev, int new_mtu)
static struct net_device_statssl_get_stats (struct device *dev)
static int sl_init (struct device *dev)
static int slip_receive_room (struct tty_struct *tty)
static void slip_receive_buf (struct tty_struct *tty, const unsigned char *cp, char *fp, int count)
static void sl_sync (void)
static struct slipsl_alloc (kdev_t line)
static int slip_open (struct tty_struct *tty)
static void slip_close (struct tty_struct *tty)
static int slip_ioctl (struct tty_struct *tty, void *file, int cmd, void *arg)
 __initfunc (int slip_init_ctrl_dev(struct device *dummy))

Variables

static slip_ctrl_t ** slip_ctrls = NULL
int slip_maxdev = SL_NRUNIT
static struct tty_ldisc sl_ldisc


Define Documentation

#define SL_CHECK_TRANSMIT
 

Definition at line 57 of file slip.c.

#define SLIP_VERSION   "0.8.4-NET3.019-NEWTTY"
 

Definition at line 87 of file slip.c.

Referenced by __initfunc().


Typedef Documentation

typedef struct slip_ctrl slip_ctrl_t
 


Function Documentation

__initfunc int   slip_init_ctrl_dev(struct device *dummy)  ) 
 

Definition at line 1324 of file slip.c.

References ENODEV, ENOMEM, file, KERN_INFO, kmalloc(), memset, N_SLIP, NULL, printk, slip_close(), slip_ioctl(), slip_maxdev, slip_open(), slip_receive_buf(), slip_receive_room(), SLIP_VERSION, slip_write_wakeup(), status, TTY_LDISC_MAGIC, and tty_register_ldisc().

Here is the call graph for this function:

MODULE_PARM slip_maxdev  ,
"i" 
 

static struct slip* sl_alloc kdev_t  line  )  [static]
 

Definition at line 723 of file slip.c.

References slip_ctrl::ctrl, current, slip::dev, slip::flags, i, init_timer(), kmalloc(), slip::leased, slip::line, long, slip::magic, memset, slip::mode, NULL, slip::pid, sl_free_bufs(), sl_init(), SL_MODE_DEFAULT, SLF_INUSE, SLIP_MAGIC, slip_maxdev, sprintf(), test_bit, slip::tty, and unregister_netdevice.

Referenced by slip_open().

Here is the call graph for this function:

static int sl_alloc_bufs struct slip sl,
int  mtu
[static]
 

Definition at line 131 of file slip.c.

References slip::buffsize, end_bh_atomic(), ENOBUFS, ENODEV, kfree(), kmalloc(), len, slip::mtu, NULL, slip::rbuff, slip::rcount, slhc_free(), slhc_init(), start_bh_atomic(), slip::tty, slip::xbuff, xchg, and slip::xleft.

Referenced by slip_open().

Here is the call graph for this function:

static void sl_bump struct slip sl  )  [static]
 

Definition at line 343 of file slip.c.

References slip::buffsize, c, count, sk_buff::data, sk_buff::dev, slip::dev, ETH_P_IP, htons(), sk_buff::mac, memcpy, slip::mode, netif_rx(), NULL, printk, sk_buff::protocol, slip::rbuff, slip::rcount, slip::rx_bytes, slip::rx_dropped, slip::rx_over_errors, slip::rx_packets, SL_MODE_ADAPTIVE, SL_MODE_CSLIP, SL_TYPE_COMPRESSED_TCP, SL_TYPE_UNCOMPRESSED_TCP, slhc_remember(), and slhc_uncompress().

Referenced by slip_unesc().

Here is the call graph for this function:

static int sl_change_mtu struct device *  dev,
int  new_mtu
[static]
 

Definition at line 576 of file slip.c.

References EINVAL, and sl_realloc_bufs().

Referenced by sl_init().

Here is the call graph for this function:

static int sl_close struct device *  dev  )  [static]
 

Definition at line 539 of file slip.c.

References end_bh_atomic(), MOD_DEC_USE_COUNT, slip::rcount, start_bh_atomic(), slip::tty, and slip::xleft.

Referenced by sl_init().

Here is the call graph for this function:

static void sl_encaps struct slip sl,
unsigned char *  icp,
int  len
[static]
 

Definition at line 400 of file slip.c.

References clear_bit, count, slip::dev, slip::flags, jiffies, slip::mode, slip::mtu, p, printk, SL_MODE_CSLIP, SL_MODE_SLIP6, sl_unlock(), SLF_OUTWAIT, slhc_compress(), slip_esc(), slip::tty, slip::tx_dropped, slip::xbuff, slip::xhead, and slip::xleft.

Referenced by sl_xmit().

Here is the call graph for this function:

static void sl_free_bufs struct slip sl  )  [static]
 

Definition at line 212 of file slip.c.

References kfree(), NULL, slip::rbuff, slhc_free(), tmp, slip::xbuff, and xchg.

Referenced by sl_alloc(), and slip_open().

Here is the call graph for this function:

static struct net_device_stats* sl_get_stats struct device *  dev  )  [static]
 

Definition at line 591 of file slip.c.

References net_device_stats::collisions, memset, slip::rx_bytes, net_device_stats::rx_bytes, slip::rx_dropped, net_device_stats::rx_dropped, slip::rx_errors, net_device_stats::rx_errors, net_device_stats::rx_fifo_errors, slip::rx_over_errors, net_device_stats::rx_over_errors, slip::rx_packets, net_device_stats::rx_packets, slcompress::sls_i_compressed, slcompress::sls_i_tossed, slcompress::sls_o_compressed, slcompress::sls_o_misses, slip::tx_bytes, net_device_stats::tx_bytes, slip::tx_dropped, net_device_stats::tx_dropped, slip::tx_errors, net_device_stats::tx_errors, net_device_stats::tx_fifo_errors, slip::tx_packets, and net_device_stats::tx_packets.

Referenced by sl_init().

static int sl_init struct device *  dev  )  [static]
 

Definition at line 627 of file slip.c.

References ARPHRD_SLIP, dev_init_buffers(), IFF_MULTICAST, IFF_NOARP, IFF_POINTOPOINT, slip::mode, slip::mtu, sl_change_mtu(), sl_close(), sl_get_stats(), sl_open(), and sl_xmit().

Referenced by sl_alloc().

Here is the call graph for this function:

static void sl_lock struct slip sl  )  [inline, static]
 

Definition at line 324 of file slip.c.

References slip::dev, printk, and test_and_set_bit.

Referenced by sl_xmit().

static int sl_open struct device *  dev  )  [static]
 

Definition at line 560 of file slip.c.

References ENODEV, slip::flags, MOD_INC_USE_COUNT, NULL, SLF_INUSE, and slip::tty.

Referenced by sl_init().

static int sl_realloc_bufs struct slip sl,
int  mtu
[static]
 

Definition at line 233 of file slip.c.

References slip::buffsize, slip::dev, dev, device, done, end_bh_atomic(), ENOBUFS, ENODEV, slip::flags, kfree(), kmalloc(), len, memcpy, slip::mtu, NULL, printk, slip::rbuff, slip::rcount, slip::rx_over_errors, set_bit, SLF_ERROR, start_bh_atomic(), slip::tty, slip::tx_dropped, slip::xbuff, xchg, slip::xhead, and slip::xleft.

Referenced by sl_change_mtu().

Here is the call graph for this function:

static void sl_sync void   )  [static]
 

Definition at line 706 of file slip.c.

References slip_ctrl::ctrl, slip_ctrl::dev, dev_close(), i, IFF_UP, slip::leased, NULL, slip_maxdev, and slip::tty.

Referenced by slip_open().

Here is the call graph for this function:

static void sl_unlock struct slip sl  )  [inline, static]
 

Definition at line 334 of file slip.c.

References slip::dev, printk, and test_and_clear_bit.

Referenced by sl_encaps(), sl_xmit(), and slip_write_wakeup().

static int sl_xmit struct sk_buff skb,
struct device *  dev
[static]
 

Definition at line 476 of file slip.c.

References sk_buff::data, dev_kfree_skb, HZ, jiffies, sk_buff::len, NULL, printk, sl_encaps(), sl_lock(), sl_unlock(), slip::tty, and slip::xleft.

Referenced by sl_init().

Here is the call graph for this function:

static void slip_close struct tty_struct *  tty  )  [static]
 

Definition at line 934 of file slip.c.

References del_timer(), slip::leased, slip::line, slip::magic, MOD_DEC_USE_COUNT, NULL, SLIP_MAGIC, and slip::tty.

Referenced by __initfunc().

Here is the call graph for this function:

int slip_esc unsigned char *  p,
unsigned char *  d,
int  len
[static]
 

Definition at line 964 of file slip.c.

References c, END, ESC, ESC_END, ESC_ESC, and ptr.

Referenced by sl_encaps().

static int slip_ioctl struct tty_struct *  tty,
void *  file,
int  cmd,
void *  arg
[static]
 

Definition at line 1126 of file slip.c.

References add_timer(), ARPHRD_SLIP, copy_to_user, del_timer(), slip::dev, EFAULT, EINVAL, end_bh_atomic(), ENODEV, ENOIOCTLCMD, slip::flags, get_user, HZ, jiffies, slip::magic, slip::mode, n_tty_ioctl(), put_user, set_bit, SIOCGIFENCAP, SIOCGIFNAME, SIOCGKEEPALIVE, SIOCGOUTFILL, SIOCSIFENCAP, SIOCSIFHWADDR, SIOCSKEEPALIVE, SIOCSOUTFILL, SL_MODE_ADAPTIVE, SL_MODE_CSLIP, SL_MODE_SLIP6, SLF_OUTWAIT, SLIP_MAGIC, start_bh_atomic(), strlen, TCGETA, TCGETS, tmp, and slip::tty.

Referenced by __initfunc().

Here is the call graph for this function:

static int slip_open struct tty_struct *  tty  )  [static]
 

Definition at line 829 of file slip.c.

References add_timer(), CAP_NET_ADMIN, capable, clear_bit, current, slip::dev, EEXIST, ENFILE, EPERM, slip::flags, HZ, jiffies, slip::line, slip::magic, MOD_DEC_USE_COUNT, MOD_INC_USE_COUNT, NULL, slip::pid, register_netdevice, rtnl_lock(), rtnl_unlock(), set_bit, sl_alloc(), sl_alloc_bufs(), sl_free_bufs(), SL_MTU, sl_sync(), SLF_INUSE, SLIP_MAGIC, test_bit, and slip::tty.

Referenced by __initfunc().

Here is the call graph for this function:

static void slip_receive_buf struct tty_struct *  tty,
const unsigned char *  cp,
char *  fp,
int  count
[static]
 

Definition at line 675 of file slip.c.

References slip::dev, slip::flags, slip::magic, slip::mode, slip::rx_errors, SL_MODE_SLIP6, SLF_ERROR, SLIP_MAGIC, slip_unesc(), and test_and_set_bit.

Referenced by __initfunc().

Here is the call graph for this function:

static int slip_receive_room struct tty_struct *  tty  )  [static]
 

Definition at line 663 of file slip.c.

Referenced by __initfunc().

static void slip_unesc struct slip sl,
unsigned char  c
[static]
 

Definition at line 1001 of file slip.c.

References clear_bit, END, ESC, ESC_END, ESC_ESC, set_bit, sl_bump(), SLF_ERROR, SLF_ESCAPE, SLF_KEEPTEST, test_and_clear_bit, and test_bit.

Referenced by slip_receive_buf().

Here is the call graph for this function:

static void slip_write_wakeup struct tty_struct *  tty  )  [static]
 

Definition at line 450 of file slip.c.

References slip::dev, slip::magic, mark_bh, NET_BH, sl_unlock(), SLIP_MAGIC, slip::tx_packets, slip::xhead, and slip::xleft.

Referenced by __initfunc().

Here is the call graph for this function:


Variable Documentation

struct tty_ldisc sl_ldisc [static]
 

Definition at line 101 of file slip.c.

slip_ctrl_t** slip_ctrls = NULL [static]
 

Definition at line 96 of file slip.c.

int slip_maxdev = SL_NRUNIT
 

Definition at line 98 of file slip.c.

Referenced by __initfunc(), sl_alloc(), and sl_sync().