Commit dbf40967 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: Move ISDN net lib interface related definitions into isdn_net_lib.h

parent fa581f71
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
*/ */
#include "isdn_common.h" #include "isdn_common.h"
#include "isdn_net.h" #include "isdn_net_lib.h"
#include "isdn_ciscohdlck.h" #include "isdn_ciscohdlck.h"
#include <linux/if_arp.h> #include <linux/if_arp.h>
...@@ -417,7 +417,7 @@ isdn_ciscohdlck_header(struct sk_buff *skb, struct net_device *dev, ...@@ -417,7 +417,7 @@ isdn_ciscohdlck_header(struct sk_buff *skb, struct net_device *dev,
return 4; return 4;
} }
struct isdn_netif_ops ciscohdlck_ops = { struct isdn_netif_ops isdn_ciscohdlck_ops = {
.hard_start_xmit = isdn_net_start_xmit, .hard_start_xmit = isdn_net_start_xmit,
.hard_header = isdn_ciscohdlck_header, .hard_header = isdn_ciscohdlck_header,
.do_ioctl = isdn_ciscohdlck_dev_ioctl, .do_ioctl = isdn_ciscohdlck_dev_ioctl,
......
...@@ -10,6 +10,6 @@ ...@@ -10,6 +10,6 @@
#ifndef ISDN_CISCOHDLCK_H #ifndef ISDN_CISCOHDLCK_H
#define ISDN_CISCOHDLCK_H #define ISDN_CISCOHDLCK_H
extern struct isdn_netif_ops ciscohdlck_ops; extern struct isdn_netif_ops isdn_ciscohdlck_ops;
#endif #endif
...@@ -18,8 +18,9 @@ ...@@ -18,8 +18,9 @@
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/ctype.h> #include <linux/ctype.h>
#include "isdn_common.h" #include "isdn_common.h"
#include "isdn_tty.h" #include "isdn_net_lib.h"
#include "isdn_net.h" #include "isdn_net.h"
#include "isdn_tty.h"
#include "isdn_ppp.h" #include "isdn_ppp.h"
#ifdef CONFIG_ISDN_AUDIO #ifdef CONFIG_ISDN_AUDIO
#include "isdn_audio.h" #include "isdn_audio.h"
...@@ -2183,7 +2184,7 @@ static int __init isdn_init(void) ...@@ -2183,7 +2184,7 @@ static int __init isdn_init(void)
} }
#endif /* CONFIG_ISDN_PPP */ #endif /* CONFIG_ISDN_PPP */
isdn_net_init(); isdn_net_lib_init();
printk(KERN_NOTICE "ISDN subsystem initialized\n"); printk(KERN_NOTICE "ISDN subsystem initialized\n");
isdn_info_update(); isdn_info_update();
return 0; return 0;
...@@ -2211,7 +2212,7 @@ static void __exit isdn_exit(void) ...@@ -2211,7 +2212,7 @@ static void __exit isdn_exit(void)
#endif #endif
save_flags(flags); save_flags(flags);
cli(); cli();
isdn_net_exit(); isdn_net_lib_exit();
isdn_tty_exit(); isdn_tty_exit();
if (unregister_chrdev(ISDN_MAJOR, "isdn")) if (unregister_chrdev(ISDN_MAJOR, "isdn"))
......
...@@ -9,18 +9,12 @@ ...@@ -9,18 +9,12 @@
* of the GNU General Public License, incorporated herein by reference. * of the GNU General Public License, incorporated herein by reference.
*/ */
#include <linux/config.h>
#include <linux/isdn.h> #include <linux/isdn.h>
#include <net/arp.h>
#include <net/dst.h>
#include <net/pkt_sched.h>
#include <linux/inetdevice.h> #include <linux/inetdevice.h>
#include <net/arp.h>
#include "isdn_common.h" #include "isdn_common.h"
#include "isdn_net_lib.h"
#include "isdn_net.h" #include "isdn_net.h"
#include "isdn_ppp.h"
#include <linux/concap.h>
#include "isdn_concap.h"
#include "isdn_ciscohdlck.h"
// ISDN_NET_ENCAP_IPTYP // ISDN_NET_ENCAP_IPTYP
// ethernet type field // ethernet type field
...@@ -46,7 +40,7 @@ isdn_iptyp_receive(isdn_net_local *lp, isdn_net_dev *idev, ...@@ -46,7 +40,7 @@ isdn_iptyp_receive(isdn_net_local *lp, isdn_net_dev *idev,
isdn_netif_rx(idev, skb, protocol); isdn_netif_rx(idev, skb, protocol);
} }
static struct isdn_netif_ops iptyp_ops = { struct isdn_netif_ops isdn_iptyp_ops = {
.hard_start_xmit = isdn_net_start_xmit, .hard_start_xmit = isdn_net_start_xmit,
.hard_header = isdn_iptyp_header, .hard_header = isdn_iptyp_header,
.flags = IFF_NOARP | IFF_POINTOPOINT, .flags = IFF_NOARP | IFF_POINTOPOINT,
...@@ -76,7 +70,7 @@ isdn_uihdlc_receive(isdn_net_local *lp, isdn_net_dev *idev, ...@@ -76,7 +70,7 @@ isdn_uihdlc_receive(isdn_net_local *lp, isdn_net_dev *idev,
isdn_netif_rx(idev, skb, htons(ETH_P_IP)); isdn_netif_rx(idev, skb, htons(ETH_P_IP));
} }
static struct isdn_netif_ops uihdlc_ops = { struct isdn_netif_ops isdn_uihdlc_ops = {
.hard_start_xmit = isdn_net_start_xmit, .hard_start_xmit = isdn_net_start_xmit,
.hard_header = isdn_uihdlc_header, .hard_header = isdn_uihdlc_header,
.flags = IFF_NOARP | IFF_POINTOPOINT, .flags = IFF_NOARP | IFF_POINTOPOINT,
...@@ -98,7 +92,7 @@ isdn_rawip_receive(isdn_net_local *lp, isdn_net_dev *idev, ...@@ -98,7 +92,7 @@ isdn_rawip_receive(isdn_net_local *lp, isdn_net_dev *idev,
netif_rx(skb); netif_rx(skb);
} }
static struct isdn_netif_ops rawip_ops = { struct isdn_netif_ops isdn_rawip_ops = {
.hard_start_xmit = isdn_net_start_xmit, .hard_start_xmit = isdn_net_start_xmit,
.flags = IFF_NOARP | IFF_POINTOPOINT, .flags = IFF_NOARP | IFF_POINTOPOINT,
.type = ARPHRD_PPP, .type = ARPHRD_PPP,
...@@ -148,37 +142,9 @@ isdn_ether_init(isdn_net_local *lp) ...@@ -148,37 +142,9 @@ isdn_ether_init(isdn_net_local *lp)
return 0; return 0;
} }
static struct isdn_netif_ops ether_ops = { struct isdn_netif_ops isdn_ether_ops = {
.hard_start_xmit = isdn_net_start_xmit, .hard_start_xmit = isdn_net_start_xmit,
.receive = isdn_ether_receive, .receive = isdn_ether_receive,
.init = isdn_ether_init, .init = isdn_ether_init,
.open = isdn_ether_open, .open = isdn_ether_open,
}; };
// ======================================================================
void
isdn_net_init(void)
{
isdn_net_lib_init();
register_isdn_netif(ISDN_NET_ENCAP_ETHER, &ether_ops);
register_isdn_netif(ISDN_NET_ENCAP_RAWIP, &rawip_ops);
register_isdn_netif(ISDN_NET_ENCAP_IPTYP, &iptyp_ops);
register_isdn_netif(ISDN_NET_ENCAP_UIHDLC, &uihdlc_ops);
register_isdn_netif(ISDN_NET_ENCAP_CISCOHDLC, &ciscohdlck_ops);
register_isdn_netif(ISDN_NET_ENCAP_CISCOHDLCK, &ciscohdlck_ops);
#ifdef CONFIG_ISDN_X25
register_isdn_netif(ISDN_NET_ENCAP_X25IFACE, &isdn_x25_ops);
#endif
#ifdef CONFIG_ISDN_PPP
register_isdn_netif(ISDN_NET_ENCAP_SYNCPPP, &isdn_ppp_ops);
#endif
}
void
isdn_net_exit(void)
{
isdn_net_lib_exit();
}
...@@ -9,76 +9,7 @@ ...@@ -9,76 +9,7 @@
* of the GNU General Public License, incorporated herein by reference. * of the GNU General Public License, incorporated herein by reference.
*/ */
#include <linux/kernel.h> extern struct isdn_netif_ops isdn_iptyp_ops;
#include <linux/netdevice.h> extern struct isdn_netif_ops isdn_uihdlc_ops;
#include <linux/isdn.h> extern struct isdn_netif_ops isdn_rawip_ops;
extern struct isdn_netif_ops isdn_ether_ops;
void isdn_net_init(void);
void isdn_net_exit(void);
void isdn_net_lib_init(void);
void isdn_net_lib_exit(void);
void isdn_net_hangup_all(void);
int isdn_net_ioctl(struct inode *, struct file *, uint, ulong);
int register_isdn_netif(int encap, struct isdn_netif_ops *ops);
int isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev);
void isdn_net_online(isdn_net_dev *idev);
void isdn_net_offline(isdn_net_dev *idev);
int isdn_net_stat_callback(int, isdn_ctrl *);
int isdn_net_find_icall(int, int, int, setup_parm *);
int isdn_net_rcv_skb(int, struct sk_buff *);
int isdn_net_hangup(isdn_net_dev *);
int isdn_net_dial_req(isdn_net_dev *);
void isdn_net_writebuf_skb(isdn_net_dev *, struct sk_buff *skb);
void isdn_net_write_super(isdn_net_dev *, struct sk_buff *skb);
int isdn_net_autodial(struct sk_buff *skb, struct net_device *ndev);
isdn_net_dev *isdn_net_get_xmit_dev(isdn_net_local *mlp);
void isdn_netif_rx(isdn_net_dev *idev, struct sk_buff *skb, u16 protocol);
/* ====================================================================== */
static inline int
put_u8(unsigned char *p, u8 x)
{
*p = x;
return 1;
}
static inline int
put_u16(unsigned char *p, u16 x)
{
*((u16 *)p) = htons(x);
return 2;
}
static inline int
put_u32(unsigned char *p, u32 x)
{
*((u32 *)p) = htonl(x);
return 4;
}
static inline int
get_u8(unsigned char *p, u8 *x)
{
*x = *p;
return 1;
}
static inline int
get_u16(unsigned char *p, u16 *x)
{
*x = ntohs(*((u16 *)p));
return 2;
}
static inline int
get_u32(unsigned char *p, u32 *x)
{
*x = ntohl(*((u32 *)p));
return 4;
}
/* Linux ISDN subsystem, Network interface configuration /* Linux ISDN subsystem, network interface support code
* *
* Copyright 1994-1998 by Fritz Elfert (fritz@isdn4linux.de) * Copyright 1994-1998 by Fritz Elfert (fritz@isdn4linux.de)
* 1995,96 by Thinking Objects Software GmbH Wuerzburg * 1995,96 by Thinking Objects Software GmbH Wuerzburg
...@@ -54,8 +54,10 @@ ...@@ -54,8 +54,10 @@
#include <linux/capability.h> #include <linux/capability.h>
#include <linux/rtnetlink.h> #include <linux/rtnetlink.h>
#include "isdn_common.h" #include "isdn_common.h"
#include "isdn_net_lib.h"
#include "isdn_net.h" #include "isdn_net.h"
#include "isdn_ppp.h" #include "isdn_ppp.h"
#include "isdn_ciscohdlck.h"
#define ISDN_NET_TX_TIMEOUT (20*HZ) #define ISDN_NET_TX_TIMEOUT (20*HZ)
...@@ -2335,12 +2337,25 @@ void ...@@ -2335,12 +2337,25 @@ void
isdn_net_lib_init(void) isdn_net_lib_init(void)
{ {
fsm_new(&isdn_net_fsm); fsm_new(&isdn_net_fsm);
register_isdn_netif(ISDN_NET_ENCAP_ETHER, &isdn_ether_ops);
register_isdn_netif(ISDN_NET_ENCAP_RAWIP, &isdn_rawip_ops);
register_isdn_netif(ISDN_NET_ENCAP_IPTYP, &isdn_iptyp_ops);
register_isdn_netif(ISDN_NET_ENCAP_UIHDLC, &isdn_uihdlc_ops);
register_isdn_netif(ISDN_NET_ENCAP_CISCOHDLC, &isdn_ciscohdlck_ops);
register_isdn_netif(ISDN_NET_ENCAP_CISCOHDLCK, &isdn_ciscohdlck_ops);
#ifdef CONFIG_ISDN_X25
register_isdn_netif(ISDN_NET_ENCAP_X25IFACE, &isdn_x25_ops);
#endif
#ifdef CONFIG_ISDN_PPP
register_isdn_netif(ISDN_NET_ENCAP_SYNCPPP, &isdn_ppp_ops);
#endif
} }
void void
isdn_net_lib_exit(void) isdn_net_lib_exit(void)
{ {
isdn_net_cleanup();
fsm_free(&isdn_net_fsm); fsm_free(&isdn_net_fsm);
} }
...@@ -15,11 +15,11 @@ ...@@ -15,11 +15,11 @@
#include <linux/if_arp.h> #include <linux/if_arp.h>
#include "isdn_common.h" #include "isdn_common.h"
#include "isdn_net_lib.h"
#include "isdn_ppp.h" #include "isdn_ppp.h"
#include "isdn_ppp_ccp.h" #include "isdn_ppp_ccp.h"
#include "isdn_ppp_vj.h" #include "isdn_ppp_vj.h"
#include "isdn_ppp_mp.h" #include "isdn_ppp_mp.h"
#include "isdn_net.h"
/* ====================================================================== */ /* ====================================================================== */
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include "isdn_ppp_ccp.h" #include "isdn_ppp_ccp.h"
#include "isdn_common.h" #include "isdn_common.h"
#include "isdn_net.h" #include "isdn_net_lib.h"
#include "isdn_ppp.h" #include "isdn_ppp.h"
#include <linux/ppp-comp.h> #include <linux/ppp-comp.h>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include "isdn_ppp_mp.h" #include "isdn_ppp_mp.h"
#include "isdn_ppp_ccp.h" #include "isdn_ppp_ccp.h"
#include "isdn_common.h" #include "isdn_common.h"
#include "isdn_net.h" #include "isdn_net_lib.h"
#include "isdn_ppp.h" #include "isdn_ppp.h"
/* ====================================================================== */ /* ====================================================================== */
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "isdn_ppp_vj.h" #include "isdn_ppp_vj.h"
#include "isdn_common.h" #include "isdn_common.h"
#include "isdn_net.h" #include "isdn_net_lib.h"
#include "isdn_ppp.h" #include "isdn_ppp.h"
struct slcompress * struct slcompress *
......
...@@ -278,37 +278,6 @@ struct isdn_net_phone { ...@@ -278,37 +278,6 @@ struct isdn_net_phone {
which holds the linux device structure (here: isdn_net_device) which holds the linux device structure (here: isdn_net_device)
*/ */
struct isdn_net_dev_s;
struct isdn_net_local_s;
struct isdn_netif_ops {
int (*hard_start_xmit) (struct sk_buff *skb,
struct net_device *dev);
int (*hard_header) (struct sk_buff *skb,
struct net_device *dev,
unsigned short type,
void *daddr,
void *saddr,
unsigned len);
int (*do_ioctl)(struct net_device *dev,
struct ifreq *ifr, int cmd);
unsigned short flags; /* interface flags (a la BSD) */
unsigned short type; /* interface hardware type */
unsigned char addr_len;/* hardware address length */
void (*receive)(struct isdn_net_local_s *,
struct isdn_net_dev_s *,
struct sk_buff *);
void (*connected)(struct isdn_net_dev_s *);
void (*disconnected)(struct isdn_net_dev_s *);
int (*bind)(struct isdn_net_dev_s *);
void (*unbind)(struct isdn_net_dev_s *);
int (*init)(struct isdn_net_local_s *);
void (*cleanup)(struct isdn_net_local_s *);
int (*open)(struct isdn_net_local_s *);
void (*close)(struct isdn_net_local_s *);
};
typedef struct { typedef struct {
unsigned long seqerrs; unsigned long seqerrs;
unsigned long frame_drops; unsigned long frame_drops;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment