linux/include/linux/mISDNif.h

/*
 *
 * Author	Karsten Keil <[email protected]>
 *
 * Copyright 2008  by Karsten Keil <[email protected]>
 *
 * This code is free software; you can redistribute it and/or modify
 * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE
 * version 2.1 as published by the Free Software Foundation.
 *
 * This code 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 LESSER GENERAL PUBLIC LICENSE for more details.
 *
 */

#ifndef mISDNIF_H
#define mISDNIF_H

#include <linux/types.h>
#include <linux/errno.h>
#include <linux/socket.h>

/*
 * ABI Version 32 bit
 *
 * <8 bit> Major version
 *		- changed if any interface become backwards incompatible
 *
 * <8 bit> Minor version
 *              - changed if any interface is extended but backwards compatible
 *
 * <16 bit> Release number
 *              - should be incremented on every checkin
 */
#define MISDN_MAJOR_VERSION
#define MISDN_MINOR_VERSION
#define MISDN_RELEASE

/* primitives for information exchange
 * generell format
 * <16  bit  0 >
 * <8  bit command>
 *    BIT 8 = 1 LAYER private
 *    BIT 7 = 1 answer
 *    BIT 6 = 1 DATA
 * <8  bit target layer mask>
 *
 * Layer = 00 is reserved for general commands
   Layer = 01  L2 -> HW
   Layer = 02  HW -> L2
   Layer = 04  L3 -> L2
   Layer = 08  L2 -> L3
 * Layer = FF is reserved for broadcast commands
 */

#define MISDN_CMDMASK
#define MISDN_LAYERMASK

/* generell commands */
#define OPEN_CHANNEL
#define CLOSE_CHANNEL
#define CONTROL_CHANNEL
#define CHECK_DATA

/* layer 2 -> layer 1 */
#define PH_ACTIVATE_REQ
#define PH_DEACTIVATE_REQ
#define PH_DATA_REQ
#define MPH_ACTIVATE_REQ
#define MPH_DEACTIVATE_REQ
#define MPH_INFORMATION_REQ
#define PH_CONTROL_REQ

/* layer 1 -> layer 2 */
#define PH_ACTIVATE_IND
#define PH_ACTIVATE_CNF
#define PH_DEACTIVATE_IND
#define PH_DEACTIVATE_CNF
#define PH_DATA_IND
#define PH_DATA_E_IND
#define MPH_ACTIVATE_IND
#define MPH_DEACTIVATE_IND
#define MPH_INFORMATION_IND
#define PH_DATA_CNF
#define PH_CONTROL_IND
#define PH_CONTROL_CNF

/* layer 3 -> layer 2 */
#define DL_ESTABLISH_REQ
#define DL_RELEASE_REQ
#define DL_DATA_REQ
#define DL_UNITDATA_REQ
#define DL_INFORMATION_REQ

/* layer 2 -> layer 3 */
#define DL_ESTABLISH_IND
#define DL_ESTABLISH_CNF
#define DL_RELEASE_IND
#define DL_RELEASE_CNF
#define DL_DATA_IND
#define DL_UNITDATA_IND
#define DL_INFORMATION_IND

/* intern layer 2 management */
#define MDL_ASSIGN_REQ
#define MDL_ASSIGN_IND
#define MDL_REMOVE_REQ
#define MDL_REMOVE_IND
#define MDL_STATUS_UP_IND
#define MDL_STATUS_DOWN_IND
#define MDL_STATUS_UI_IND
#define MDL_ERROR_IND
#define MDL_ERROR_RSP

/* intern layer 2 */
#define DL_TIMER200_IND
#define DL_TIMER203_IND
#define DL_INTERN_MSG

/* DL_INFORMATION_IND types */
#define DL_INFO_L2_CONNECT
#define DL_INFO_L2_REMOVED

/* PH_CONTROL types */
/* TOUCH TONE IS 0x20XX  XX "0"..."9", "A","B","C","D","*","#" */
#define DTMF_TONE_VAL
#define DTMF_TONE_MASK
#define DTMF_TONE_START
#define DTMF_TONE_STOP
#define DTMF_HFC_COEF
#define DSP_CONF_JOIN
#define DSP_CONF_SPLIT
#define DSP_RECEIVE_OFF
#define DSP_RECEIVE_ON
#define DSP_ECHO_ON
#define DSP_ECHO_OFF
#define DSP_MIX_ON
#define DSP_MIX_OFF
#define DSP_DELAY
#define DSP_JITTER
#define DSP_TXDATA_ON
#define DSP_TXDATA_OFF
#define DSP_TX_DEJITTER
#define DSP_TX_DEJ_OFF
#define DSP_TONE_PATT_ON
#define DSP_TONE_PATT_OFF
#define DSP_VOL_CHANGE_TX
#define DSP_VOL_CHANGE_RX
#define DSP_BF_ENABLE_KEY
#define DSP_BF_DISABLE
#define DSP_BF_ACCEPT
#define DSP_BF_REJECT
#define DSP_PIPELINE_CFG
#define HFC_VOL_CHANGE_TX
#define HFC_VOL_CHANGE_RX
#define HFC_SPL_LOOP_ON
#define HFC_SPL_LOOP_OFF
/* for T30 FAX and analog modem */
#define HW_MOD_FRM
#define HW_MOD_FRH
#define HW_MOD_FTM
#define HW_MOD_FTH
#define HW_MOD_FTS
#define HW_MOD_CONNECT
#define HW_MOD_OK
#define HW_MOD_NOCARR
#define HW_MOD_FCERROR
#define HW_MOD_READY
#define HW_MOD_LASTDATA

/* DSP_TONE_PATT_ON parameter */
#define TONE_OFF
#define TONE_GERMAN_DIALTONE
#define TONE_GERMAN_OLDDIALTONE
#define TONE_AMERICAN_DIALTONE
#define TONE_GERMAN_DIALPBX
#define TONE_GERMAN_OLDDIALPBX
#define TONE_AMERICAN_DIALPBX
#define TONE_GERMAN_RINGING
#define TONE_GERMAN_OLDRINGING
#define TONE_AMERICAN_RINGPBX
#define TONE_GERMAN_RINGPBX
#define TONE_GERMAN_OLDRINGPBX
#define TONE_AMERICAN_RINGING
#define TONE_GERMAN_BUSY
#define TONE_GERMAN_OLDBUSY
#define TONE_AMERICAN_BUSY
#define TONE_GERMAN_HANGUP
#define TONE_GERMAN_OLDHANGUP
#define TONE_AMERICAN_HANGUP
#define TONE_SPECIAL_INFO
#define TONE_GERMAN_GASSENBESETZT
#define TONE_GERMAN_AUFSCHALTTON

/* MPH_INFORMATION_IND */
#define L1_SIGNAL_LOS_OFF
#define L1_SIGNAL_LOS_ON
#define L1_SIGNAL_AIS_OFF
#define L1_SIGNAL_AIS_ON
#define L1_SIGNAL_RDI_OFF
#define L1_SIGNAL_RDI_ON
#define L1_SIGNAL_SLIP_RX
#define L1_SIGNAL_SLIP_TX

/*
 * protocol ids
 * D channel 1-31
 * B channel 33 - 63
 */

#define ISDN_P_NONE
#define ISDN_P_BASE
#define ISDN_P_TE_S0
#define ISDN_P_NT_S0
#define ISDN_P_TE_E1
#define ISDN_P_NT_E1
#define ISDN_P_TE_UP0
#define ISDN_P_NT_UP0

#define IS_ISDN_P_TE(p)
#define IS_ISDN_P_NT(p)
#define IS_ISDN_P_S0(p)
#define IS_ISDN_P_E1(p)
#define IS_ISDN_P_UP0(p)


#define ISDN_P_LAPD_TE
#define ISDN_P_LAPD_NT

#define ISDN_P_B_MASK
#define ISDN_P_B_START

#define ISDN_P_B_RAW
#define ISDN_P_B_HDLC
#define ISDN_P_B_X75SLP
#define ISDN_P_B_L2DTMF
#define ISDN_P_B_L2DSP
#define ISDN_P_B_L2DSPHDLC
#define ISDN_P_B_T30_FAX
#define ISDN_P_B_MODEM_ASYNC

#define OPTION_L2_PMX
#define OPTION_L2_PTP
#define OPTION_L2_FIXEDTEI
#define OPTION_L2_CLEANUP
#define OPTION_L1_HOLD

/* should be in sync with linux/kobject.h:KOBJ_NAME_LEN */
#define MISDN_MAX_IDLEN

struct mISDNhead {}  __packed;

#define MISDN_HEADER_LEN
#define MAX_DATA_SIZE
#define MAX_DATA_MEM
#define MAX_DFRAME_LEN

#define MISDN_ID_ADDR_MASK
#define MISDN_ID_TEI_MASK
#define MISDN_ID_SAPI_MASK
#define MISDN_ID_TEI_ANY

#define MISDN_ID_ANY
#define MISDN_ID_NONE

#define GROUP_TEI
#define TEI_SAPI
#define CTRL_SAPI

#define MISDN_MAX_CHANNEL
#define MISDN_CHMAP_SIZE

#define SOL_MISDN

struct sockaddr_mISDN {};

struct mISDNversion {};

struct mISDN_devinfo {};

struct mISDN_devrename {};

/* MPH_INFORMATION_REQ payload */
struct ph_info_ch {};

struct ph_info_dch {};

struct ph_info {};

/* timer device ioctl */
#define IMADDTIMER
#define IMDELTIMER

/* socket ioctls */
#define IMGETVERSION
#define IMGETCOUNT
#define IMGETDEVINFO
#define IMCTRLREQ
#define IMCLEAR_L2
#define IMSETDEVNAME
#define IMHOLD_L1

static inline int
test_channelmap(u_int nr, u_char *map)
{}

static inline void
set_channelmap(u_int nr, u_char *map)
{}

static inline void
clear_channelmap(u_int nr, u_char *map)
{}

/* CONTROL_CHANNEL parameters */
#define MISDN_CTRL_GETOP
#define MISDN_CTRL_LOOP
#define MISDN_CTRL_CONNECT
#define MISDN_CTRL_DISCONNECT
#define MISDN_CTRL_RX_BUFFER
#define MISDN_CTRL_PCMCONNECT
#define MISDN_CTRL_PCMDISCONNECT
#define MISDN_CTRL_SETPEER
#define MISDN_CTRL_UNSETPEER
#define MISDN_CTRL_RX_OFF
#define MISDN_CTRL_FILL_EMPTY
#define MISDN_CTRL_GETPEER
#define MISDN_CTRL_L1_TIMER3
#define MISDN_CTRL_HW_FEATURES_OP
#define MISDN_CTRL_HW_FEATURES
#define MISDN_CTRL_HFC_OP
#define MISDN_CTRL_HFC_PCM_CONN
#define MISDN_CTRL_HFC_PCM_DISC
#define MISDN_CTRL_HFC_CONF_JOIN
#define MISDN_CTRL_HFC_CONF_SPLIT
#define MISDN_CTRL_HFC_RECEIVE_OFF
#define MISDN_CTRL_HFC_RECEIVE_ON
#define MISDN_CTRL_HFC_ECHOCAN_ON
#define MISDN_CTRL_HFC_ECHOCAN_OFF
#define MISDN_CTRL_HFC_WD_INIT
#define MISDN_CTRL_HFC_WD_RESET

/* special RX buffer value for MISDN_CTRL_RX_BUFFER request.p1 is the minimum
 * buffer size request.p2 the maximum. Using  MISDN_CTRL_RX_SIZE_IGNORE will
 * not change the value, but still read back the actual stetting.
 */
#define MISDN_CTRL_RX_SIZE_IGNORE

/* socket options */
#define MISDN_TIME_STAMP

struct mISDN_ctrl_req {};

/* muxer options */
#define MISDN_OPT_ALL
#define MISDN_OPT_TEIMGR

#ifdef __KERNEL__
#include <linux/list.h>
#include <linux/skbuff.h>
#include <linux/net.h>
#include <net/sock.h>
#include <linux/completion.h>

#define DEBUG_CORE
#define DEBUG_CORE_FUNC
#define DEBUG_SOCKET
#define DEBUG_MANAGER
#define DEBUG_SEND_ERR
#define DEBUG_MSG_THREAD
#define DEBUG_QUEUE_FUNC
#define DEBUG_L1
#define DEBUG_L1_FSM
#define DEBUG_L2
#define DEBUG_L2_FSM
#define DEBUG_L2_CTRL
#define DEBUG_L2_RECV
#define DEBUG_L2_TEI
#define DEBUG_L2_TEIFSM
#define DEBUG_TIMER
#define DEBUG_CLOCK

#define mISDN_HEAD_P(s)
#define mISDN_HEAD_PRIM(s)
#define mISDN_HEAD_ID(s)

/* socket states */
#define MISDN_OPEN
#define MISDN_BOUND
#define MISDN_CLOSED

struct mISDNchannel;
struct mISDNdevice;
struct mISDNstack;
struct mISDNclock;

struct channel_req {};

ctrl_func_t;
send_func_t;
create_func_t;

struct Bprotocol {};

struct mISDNchannel {};

struct mISDN_sock_list {};

struct mISDN_sock {};



struct mISDNdevice {};

struct mISDNstack {};

clockctl_func_t;

struct	mISDNclock {};

/* global alloc/queue functions */

static inline struct sk_buff *
mI_alloc_skb(unsigned int len, gfp_t gfp_mask)
{}

static inline struct sk_buff *
_alloc_mISDN_skb(u_int prim, u_int id, u_int len, void *dp, gfp_t gfp_mask)
{}

static inline void
_queue_data(struct mISDNchannel *ch, u_int prim,
    u_int id, u_int len, void *dp, gfp_t gfp_mask)
{}

/* global register/unregister functions */

extern int	mISDN_register_device(struct mISDNdevice *,
					struct device *parent, char *name);
extern void	mISDN_unregister_device(struct mISDNdevice *);
extern int	mISDN_register_Bprotocol(struct Bprotocol *);
extern void	mISDN_unregister_Bprotocol(struct Bprotocol *);
extern struct mISDNclock *mISDN_register_clock(char *, int, clockctl_func_t *,
						void *);
extern void	mISDN_unregister_clock(struct mISDNclock *);

static inline struct mISDNdevice *dev_to_mISDN(const struct device *dev)
{}

extern void	set_channel_address(struct mISDNchannel *, u_int, u_int);
extern void	mISDN_clock_update(struct mISDNclock *, int, ktime_t *);
extern unsigned short mISDN_clock_get(void);
extern const char *mISDNDevName4ch(struct mISDNchannel *);

#endif /* __KERNEL__ */
#endif /* mISDNIF_H */