/***************************************************************************** SS7 LINK LEVEL (L2) INTERFACE FOR NET4 ----------------------------------------------------------------------------- Copyright (C) 1997, 1998, 1999, 2000 Brian Bidulock All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Last Modified $Date: 2000/09/08 11:12:32 $ by $Author: brian $ ----------------------------------------------------------------------------- $Log: ss7if.h,v $ Revision 0.7.2.2 2000/09/08 11:12:32 brian Added some minor stuff: modules load and unload fine. Revision 0.7.2.1 2000/09/07 12:49:11 brian Got ss7link interface support for drivers compiling. Revision 0.7 2000/09/07 11:20:33 brian Initial import of OpenSS7 stack. Revision 0.7.2.1 2000/09/07 10:51:42 brian Got these files going. Revision 0.7 2000/09/06 19:39:10 brian Added files back in at revision 0.7. *****************************************************************************/ #ifndef __DRIVER_SS7IF_H__ #define __DRIVER_SS7IF_H__ #ifndef TX_Q_MAX #define TX_Q_MAX 10 #endif #ifndef LSSU_SIB #define LSSU_SIB 0x5 #endif #ifndef SS7_MTU #define SIF_MAX 272 #define SS7_MTU SIF_MAX #endif #ifndef AF_SS7 #define AF_SS7 24 #endif #ifndef ETH_P_SS7 #define ETH_P_SS7 0x0018 #define ETH_P_SS7LINK 0x0019 #endif #ifndef ARPHRD_SS7 #define ARPHRD_SS7 600 #endif #ifndef ss7_ptr #define ss7_ptr dn_ptr #endif /* * DRIVER HEADER FILE * General Notes: * * For examples of how to use the facilities of the SS7/LINK ss7 signaling * link interface facility, see acb56.c in drivers/net (or here). acb56.c * is a complete working example of a serial interface card implementation * to this driver interface for the Sealevel ACB56 card. */ /* * There are three ways to register a device as an SS7 interface and * attach a level 2 SS7 link state machine to a device: * * 1. Fill out your device structure with all necessary interface * service routines and set the dev->type to ARPHRD_SS7, and then * register the device with register_netdevice(). The netdevice * notifier will invoke the attach automagically. * * 2. Fill out your device structure with all necessary interface * service routines and call the exported ss7if_attach() routine. * Then register the device as usual. This is particularly useful * if you don't wish to register as a netdevice. */ extern int ss7if_attach(struct device *dev); /* * 3. Fill out a ss7if_register structure with the interface service * routines which would normally be in the device structure and * call ss7if_register() with a master device and and the register * structure. This is particularly useful for multichannel * devices which do not maintain a full device structure per * channel. */ #ifndef __LINUX_SS7LINK_H__ struct ss7if_reg { void (*destructor)(struct device *dev); int (*open)(struct device *dev); int (*stop)(struct device *dev); int (*hard_start_xmit)(struct sk_buff *skb, struct device *dev); int (*do_ioctl)(struct device *dev, struct ifreq *ifr, int cmd); }; #endif extern int ss7if_register(struct device *dev, struct ss7if_reg *regs); /* * There are (really) only two ways to detach from an SS7 interface and * undo what was done during the attach: * * 1. Deregister the device with unregister_netdevice() which will * automagically detach (from the destructor). * * 2. Call either ss7if_unregister() or ss7if_detach() (which are * really the same function). * * Note: devices should be closed with dev_close() before calling * unregister_netdevice(). dev_close() should never be called on an * operating signaling link (you'll get lots of error messages!) */ extern void ss7if_unregister(struct device *dev); extern void ss7if_detach(struct device *dev); /* * RECEIVE INTERRUPT SERVICE ROUTINE INTERFACE * * When delivering received packets in the driver, the driver should not * call netif_rx(), but, instead, and equivocally, should call ss7if_rx() * so that the SS7 L2 state machine has a crack at the packet. Failing to * do so will result in erroneous operation. ss7if_rx() processes each * frame through the L2 state machine before ultimately delivering them up * using the actuall netif_rx(). Please see the acb56.c file in drivers/ * net/ for more detail. * * Following is the Rx ISR API to the SS7 LINK state machines. There are * four functions which must be called in different circumstances and have * different behaviours which must be followed in the driver. To * summarize, they are: */ extern void ss7if_rx(struct sk_buff *skb); /* * ss7if_rx() Called with an sk_buff when the driver has a valid received * frame. A valid received frame is a frame which was * received without error and is between 3 and dev->mtu in * length and has a valid length indicator in the frame. If * the driver is in octet counting mode, it must stop octet * counting. */ extern void ss7if_los(struct device *device); /* * ss7if_los() Called with the device pointer when the driver loses flag * synchronization on the line. The driver must enter octet * counting mode after sending this indication. */ extern void ss7if_err(struct device *device); /* * ss7if_err() Called with the deivce pointer when the driver detects * frame-related error such as an abort, residue error, * frameing error, CRC error. The driver must enter octet * counting mode after sending this indication. */ extern void ss7if_oct(struct device *device); /* * ss7if_oct() Called with the device pointer when the driver is in octet * counting mode. It must be called every 16 octet times (128 * bit times) when the driver is in octet counting mode. */ extern void ss7if_rpt(struct device *device); /* * ss7if_rpt() Called with the device pointer when the driver receives a * repeat of a the last received FISU or LSSU (while not in * octet counting mode). This is used because the driver has * extremely critical timings while the line is idling FISUs * or LSSUs. The state machine doesn't do it's own FISU/LSSU * compression, it must be done in the driver. */ #endif __DRIVER_SS7IF_H__