Changes for CAPI 2.0 Spec.
This commit is contained in:
parent
9cd74b6b3b
commit
459d007e40
141
capi20/capi20.c
141
capi20/capi20.c
|
@ -2,6 +2,10 @@
|
|||
* $Id$
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.5 1999/04/20 19:52:19 calle
|
||||
* Bugfix in capi20_get_profile: wrong size in memcpy from
|
||||
* Kai Germaschewski <kai@thphy.uni-duesseldorf.de>
|
||||
*
|
||||
* Revision 1.4 1998/11/18 17:05:44 paul
|
||||
* fixed a (harmless) warning
|
||||
*
|
||||
|
@ -23,12 +27,17 @@
|
|||
#include <linux/capi.h>
|
||||
#include "capi20.h"
|
||||
|
||||
#define CAPIMSG_LEN(m) (m[0] | (m[1] << 8))
|
||||
#define CAPIMSG_COMMAND(m) (m[4])
|
||||
#define CAPIMSG_SUBCOMMAND(m) (m[5])
|
||||
|
||||
|
||||
static int capi_fd = -1;
|
||||
static capi_ioctl_struct ioctl_data;
|
||||
static unsigned char rcvbuf[128+2048]; /* message + data */
|
||||
static unsigned char sndbuf[128+2048]; /* message + data */
|
||||
|
||||
unsigned capi20_isinstalled (void)
|
||||
unsigned short capi20_isinstalled (void)
|
||||
{
|
||||
if (capi_fd >= 0)
|
||||
return 1;
|
||||
|
@ -49,9 +58,9 @@ static struct capi_applidmap {
|
|||
int fd;
|
||||
} capi_applidmap[CAPI_MAXAPPL] = {{0,0}};
|
||||
|
||||
static inline _cword allocapplid(int fd)
|
||||
static inline unsigned short allocapplid(int fd)
|
||||
{
|
||||
_cword i;
|
||||
unsigned short i;
|
||||
for (i=0; i < CAPI_MAXAPPL; i++) {
|
||||
if (capi_applidmap[i].used == 0) {
|
||||
capi_applidmap[i].used = 1;
|
||||
|
@ -62,19 +71,19 @@ static inline _cword allocapplid(int fd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline void freeapplid(_cword applid)
|
||||
static inline void freeapplid(unsigned short applid)
|
||||
{
|
||||
capi_applidmap[applid-1].used = 0;
|
||||
capi_applidmap[applid-1].fd = -1;
|
||||
}
|
||||
|
||||
static inline int validapplid(_cword applid)
|
||||
static inline int validapplid(unsigned short applid)
|
||||
{
|
||||
return applid > 0 && applid <= CAPI_MAXAPPL
|
||||
&& capi_applidmap[applid-1].used;
|
||||
}
|
||||
|
||||
static inline int applid2fd(_cword applid)
|
||||
static inline int applid2fd(unsigned short applid)
|
||||
{
|
||||
if (applid < CAPI_MAXAPPL)
|
||||
return capi_applidmap[applid-1].fd;
|
||||
|
@ -85,13 +94,13 @@ static inline int applid2fd(_cword applid)
|
|||
* CAPI2.0 functions
|
||||
*/
|
||||
|
||||
_cword
|
||||
unsigned short
|
||||
capi20_register (unsigned MaxB3Connection,
|
||||
unsigned MaxB3Blks,
|
||||
unsigned MaxSizeB3,
|
||||
CAPI_REGISTER_ERROR *ErrorCode)
|
||||
unsigned short *ErrorCode)
|
||||
{
|
||||
_cword applid;
|
||||
unsigned short applid;
|
||||
char buf[PATH_MAX];
|
||||
int i, fd = -1;
|
||||
|
||||
|
@ -130,25 +139,26 @@ capi20_register (unsigned MaxB3Connection,
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
*ErrorCode = CapiNoError;
|
||||
return applid;
|
||||
}
|
||||
|
||||
MESSAGE_EXCHANGE_ERROR
|
||||
capi20_release (unsigned Appl_Id)
|
||||
unsigned short
|
||||
capi20_release (unsigned ApplID)
|
||||
{
|
||||
if (!capi20_isinstalled())
|
||||
return CapiRegNotInstalled;
|
||||
if (!validapplid(Appl_Id))
|
||||
if (!validapplid(ApplID))
|
||||
return CapiIllAppNr;
|
||||
(void)close(applid2fd(Appl_Id));
|
||||
freeapplid(Appl_Id);
|
||||
(void)close(applid2fd(ApplID));
|
||||
freeapplid(ApplID);
|
||||
return CapiNoError;
|
||||
}
|
||||
|
||||
MESSAGE_EXCHANGE_ERROR
|
||||
capi20_put_message (CAPI_MESSAGE Msg, unsigned Appl_Id)
|
||||
unsigned short
|
||||
capi20_put_message (unsigned char *Msg, unsigned ApplID)
|
||||
{
|
||||
MESSAGE_EXCHANGE_ERROR ret;
|
||||
unsigned short ret;
|
||||
int len = (Msg[0] | (Msg[1] << 8));
|
||||
int cmd = Msg[4];
|
||||
int subcmd = Msg[5];
|
||||
|
@ -158,16 +168,21 @@ capi20_put_message (CAPI_MESSAGE Msg, unsigned Appl_Id)
|
|||
if (!capi20_isinstalled())
|
||||
return CapiRegNotInstalled;
|
||||
|
||||
if (!validapplid(Appl_Id))
|
||||
if (!validapplid(ApplID))
|
||||
return CapiIllAppNr;
|
||||
|
||||
fd = applid2fd(Appl_Id);
|
||||
fd = applid2fd(ApplID);
|
||||
|
||||
memcpy(sndbuf, Msg, len);
|
||||
|
||||
if (cmd == CAPI_DATA_B3 && subcmd == CAPI_REQ) {
|
||||
int datalen = (Msg[16] | (Msg[17] << 8));
|
||||
void *dataptr = (void *)(Msg[12]|(Msg[13]<<8)|(Msg[14]<<16)|(Msg[15]<<24));
|
||||
void *dataptr;
|
||||
if (sizeof(void *) > 4) {
|
||||
dataptr = Msg + len; /* Assume data after message */
|
||||
} else {
|
||||
dataptr =(void *)(Msg[12]|(Msg[13]<<8)|(Msg[14]<<16)|(Msg[15]<<24));
|
||||
}
|
||||
memcpy(sndbuf+len, dataptr, datalen);
|
||||
len += datalen;
|
||||
}
|
||||
|
@ -187,7 +202,7 @@ capi20_put_message (CAPI_MESSAGE Msg, unsigned Appl_Id)
|
|||
case EIO:
|
||||
if (ioctl(fd, CAPI_GET_ERRCODE, &ioctl_data) < 0)
|
||||
ret = CapiMsgOSResourceErr;
|
||||
else ret = (MESSAGE_EXCHANGE_ERROR)ioctl_data.errcode;
|
||||
else ret = (unsigned short)ioctl_data.errcode;
|
||||
break;
|
||||
default:
|
||||
ret = CapiMsgOSResourceErr;
|
||||
|
@ -198,22 +213,34 @@ capi20_put_message (CAPI_MESSAGE Msg, unsigned Appl_Id)
|
|||
return ret;
|
||||
}
|
||||
|
||||
MESSAGE_EXCHANGE_ERROR
|
||||
capi20_get_message (unsigned Appl_Id, CAPI_MESSAGE *ReturnMessage)
|
||||
unsigned short
|
||||
capi20_get_message (unsigned ApplID, unsigned char **Buf)
|
||||
{
|
||||
MESSAGE_EXCHANGE_ERROR ret;
|
||||
unsigned short ret;
|
||||
int rc, fd;
|
||||
|
||||
if (!capi20_isinstalled())
|
||||
return CapiRegNotInstalled;
|
||||
|
||||
if (!validapplid(Appl_Id))
|
||||
if (!validapplid(ApplID))
|
||||
return CapiIllAppNr;
|
||||
|
||||
fd = applid2fd(Appl_Id);
|
||||
fd = applid2fd(ApplID);
|
||||
|
||||
*ReturnMessage = rcvbuf;
|
||||
*Buf = rcvbuf;
|
||||
if ((rc = read(fd, rcvbuf, sizeof(rcvbuf))) > 0) {
|
||||
if ( CAPIMSG_COMMAND(rcvbuf) == CAPI_DATA_B3
|
||||
&& CAPIMSG_SUBCOMMAND(rcvbuf) == CAPI_IND) {
|
||||
if (sizeof(void *) == 4) {
|
||||
u_int32_t data = (u_int32_t)rcvbuf;
|
||||
rcvbuf[12] = data & 0xff;
|
||||
rcvbuf[13] = (data >> 8) & 0xff;
|
||||
rcvbuf[14] = (data >> 16) & 0xff;
|
||||
rcvbuf[15] = (data >> 24) & 0xff;
|
||||
} else {
|
||||
rcvbuf[12] = rcvbuf[13] = rcvbuf[14] = rcvbuf[15] = 0;
|
||||
}
|
||||
}
|
||||
return CapiNoError;
|
||||
}
|
||||
|
||||
|
@ -234,60 +261,60 @@ capi20_get_message (unsigned Appl_Id, CAPI_MESSAGE *ReturnMessage)
|
|||
return ret;
|
||||
}
|
||||
|
||||
CAPI_MESSAGE
|
||||
capi20_get_manufacturer(unsigned contr, CAPI_MESSAGE LpBuffer)
|
||||
unsigned char *
|
||||
capi20_get_manufacturer(unsigned Ctrl, unsigned char *Buf)
|
||||
{
|
||||
if (!capi20_isinstalled())
|
||||
return 0;
|
||||
ioctl_data.contr = contr;
|
||||
ioctl_data.contr = Ctrl;
|
||||
if (ioctl(capi_fd, CAPI_GET_MANUFACTURER, &ioctl_data) < 0)
|
||||
return 0;
|
||||
strncpy(LpBuffer, ioctl_data.manufacturer, CAPI_MANUFACTURER_LEN);
|
||||
return LpBuffer;
|
||||
strncpy(Buf, ioctl_data.manufacturer, CAPI_MANUFACTURER_LEN);
|
||||
return Buf;
|
||||
}
|
||||
|
||||
CAPI_MESSAGE
|
||||
capi20_get_version(unsigned contr, CAPI_MESSAGE version)
|
||||
unsigned char *
|
||||
capi20_get_version(unsigned Ctrl, unsigned char *Buf)
|
||||
{
|
||||
if (!capi20_isinstalled())
|
||||
return 0;
|
||||
ioctl_data.contr = contr;
|
||||
ioctl_data.contr = Ctrl;
|
||||
if (ioctl(capi_fd, CAPI_GET_VERSION, &ioctl_data) < 0)
|
||||
return 0;
|
||||
memcpy(version, &ioctl_data.version, sizeof(capi_version));
|
||||
return version;
|
||||
memcpy(Buf, &ioctl_data.version, sizeof(capi_version));
|
||||
return Buf;
|
||||
}
|
||||
|
||||
CAPI_MESSAGE
|
||||
capi20_get_serial_number(unsigned contr, CAPI_MESSAGE LpBuffer)
|
||||
unsigned char *
|
||||
capi20_get_serial_number(unsigned Ctrl, unsigned char *Buf)
|
||||
{
|
||||
if (!capi20_isinstalled())
|
||||
return 0;
|
||||
ioctl_data.contr = contr;
|
||||
ioctl_data.contr = Ctrl;
|
||||
if (ioctl(capi_fd, CAPI_GET_SERIAL, &ioctl_data) < 0)
|
||||
return 0;
|
||||
memcpy(LpBuffer, &ioctl_data.serial, CAPI_SERIAL_LEN);
|
||||
return LpBuffer;
|
||||
memcpy(Buf, &ioctl_data.serial, CAPI_SERIAL_LEN);
|
||||
return Buf;
|
||||
}
|
||||
|
||||
MESSAGE_EXCHANGE_ERROR
|
||||
capi20_get_profile(unsigned Controller, CAPI_MESSAGE LpBuffer)
|
||||
unsigned short
|
||||
capi20_get_profile(unsigned Ctrl, unsigned char *Buf)
|
||||
{
|
||||
if (!capi20_isinstalled())
|
||||
return CapiMsgNotInstalled;
|
||||
|
||||
ioctl_data.contr = Controller;
|
||||
ioctl_data.contr = Ctrl;
|
||||
if (ioctl(capi_fd, CAPI_GET_PROFILE, &ioctl_data) < 0) {
|
||||
if (errno != EIO)
|
||||
return CapiMsgOSResourceErr;
|
||||
if (ioctl(capi_fd, CAPI_GET_ERRCODE, &ioctl_data) < 0)
|
||||
return CapiMsgOSResourceErr;
|
||||
return (MESSAGE_EXCHANGE_ERROR)ioctl_data.errcode;
|
||||
return (unsigned short)ioctl_data.errcode;
|
||||
}
|
||||
if (Controller)
|
||||
memcpy(LpBuffer, &ioctl_data.profile, sizeof(struct capi_profile));
|
||||
if (Ctrl)
|
||||
memcpy(Buf, &ioctl_data.profile, sizeof(struct capi_profile));
|
||||
else
|
||||
memcpy(LpBuffer, &ioctl_data.profile.ncontroller,
|
||||
memcpy(Buf, &ioctl_data.profile.ncontroller,
|
||||
sizeof(ioctl_data.profile.ncontroller));
|
||||
return CapiNoError;
|
||||
}
|
||||
|
@ -295,8 +322,8 @@ capi20_get_profile(unsigned Controller, CAPI_MESSAGE LpBuffer)
|
|||
* functions added to the CAPI2.0 spec
|
||||
*/
|
||||
|
||||
MESSAGE_EXCHANGE_ERROR
|
||||
capi20_waitformessage(_cword Appl_Id, struct timeval *tvp)
|
||||
unsigned short
|
||||
capi20_waitformessage(unsigned ApplID, struct timeval *TimeOut)
|
||||
{
|
||||
int fd;
|
||||
fd_set rfds;
|
||||
|
@ -307,23 +334,21 @@ capi20_waitformessage(_cword Appl_Id, struct timeval *tvp)
|
|||
if(!capi20_isinstalled())
|
||||
return CapiRegNotInstalled;
|
||||
|
||||
if(!validapplid(Appl_Id))
|
||||
if(!validapplid(ApplID))
|
||||
return CapiIllAppNr;
|
||||
|
||||
fd = applid2fd(Appl_Id);
|
||||
fd = applid2fd(ApplID);
|
||||
|
||||
FD_SET(fd, &rfds);
|
||||
|
||||
fcntl(fd, F_SETFL, !O_NONBLOCK);
|
||||
retval = select(fd + 1, &rfds, NULL, NULL, tvp);
|
||||
fcntl(fd, F_SETFL, O_NONBLOCK);
|
||||
retval = select(fd + 1, &rfds, NULL, NULL, TimeOut);
|
||||
|
||||
return(CapiNoError);
|
||||
}
|
||||
|
||||
int
|
||||
capi20_fileno(_cword applid)
|
||||
capi20_fileno(unsigned ApplID)
|
||||
{
|
||||
return applid2fd(applid);
|
||||
return applid2fd(ApplID);
|
||||
}
|
||||
|
||||
|
|
198
capi20/capi20.h
198
capi20/capi20.h
|
@ -8,7 +8,77 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*----- basic-type definitions -----*/
|
||||
/*----- errornumbers -----*/
|
||||
|
||||
#define CapiToManyAppls 0x1001
|
||||
#define CapiLogBlkSizeToSmall 0x1002
|
||||
#define CapiBuffExeceeds64k 0x1003
|
||||
#define CapiMsgBufSizeToSmall 0x1004
|
||||
#define CapiAnzLogConnNotSupported 0x1005
|
||||
#define CapiRegReserved 0x1006
|
||||
#define CapiRegBusy 0x1007
|
||||
#define CapiRegOSResourceErr 0x1008
|
||||
#define CapiRegNotInstalled 0x1009
|
||||
#define CapiRegCtrlerNotSupportExtEquip 0x100a
|
||||
#define CapiRegCtrlerOnlySupportExtEquip 0x100b
|
||||
|
||||
|
||||
#define CapiNoError 0x0000
|
||||
#define CapiIllAppNr 0x1101
|
||||
#define CapiIllCmdOrSubcmdOrMsgToSmall 0x1102
|
||||
#define CapiSendQueueFull 0x1103
|
||||
#define CapiReceiveQueueEmpty 0x1104
|
||||
#define CapiReceiveOverflow 0x1105
|
||||
#define CapiUnknownNotPar 0x1106
|
||||
#define CapiMsgBusy 0x1107
|
||||
#define CapiMsgOSResourceErr 0x1108
|
||||
#define CapiMsgNotInstalled 0x1109
|
||||
#define CapiMsgCtrlerNotSupportExtEquip 0x110a
|
||||
#define CapiMsgCtrlerOnlySupportExtEquip 0x110b
|
||||
|
||||
/* standard CAPI2.0 functions */
|
||||
|
||||
unsigned short capi20_register (unsigned MaxLogicalConnection,
|
||||
unsigned MaxBDataBlocks,
|
||||
unsigned MaxBDataLen,
|
||||
unsigned short *ErrorCode);
|
||||
|
||||
unsigned short capi20_release (unsigned ApplID);
|
||||
|
||||
unsigned short capi20_put_message (unsigned char *Msg, unsigned ApplID);
|
||||
|
||||
unsigned short capi20_get_message (unsigned ApplID, unsigned char **Buf);
|
||||
|
||||
unsigned short capi20_waitformessage(unsigned ApplID, struct timeval *TimeOut);
|
||||
|
||||
unsigned char *capi20_get_manufacturer (unsigned Ctrl, unsigned char *Buf);
|
||||
|
||||
unsigned char *capi20_get_version (unsigned Ctrl, unsigned char *Buf);
|
||||
|
||||
unsigned char *capi20_get_serial_number (unsigned Ctrl, unsigned char *Buf);
|
||||
|
||||
unsigned short capi20_get_profile (unsigned Controller, unsigned char *Buf);
|
||||
|
||||
unsigned short capi20_isinstalled (void);
|
||||
|
||||
int capi20_fileno(unsigned ApplID);
|
||||
|
||||
#define CAPI20_REGISTER capi20_register
|
||||
#define CAPI20_RELEASE capi20_release
|
||||
#define CAPI20_PUT_MESSAGE capi20_put_message
|
||||
#define CAPI20_GET_MESSAGE capi20_get_message
|
||||
#define CAPI20_WaitforMessage capi20_waitformessage
|
||||
#define CAPI20_GET_MANUFACTURER capi20_get_manufacturer
|
||||
#define CAPI20_GET_VERSION capi20_get_version
|
||||
#define CAPI20_GET_SERIAL_NUMBER capi20_get_serial_number
|
||||
#define CAPI20_GET_PROFILE capi20_get_profile
|
||||
#define CAPI20_ISINSTALLED capi20_isinstalled
|
||||
|
||||
/* end standard CAPI2.0 functions */
|
||||
|
||||
#define CAPI_REGISTER_ERROR unsigned short
|
||||
#define MESSAGE_EXCHANGE_ERROR unsigned short
|
||||
|
||||
|
||||
typedef unsigned char *CAPI_MESSAGE;
|
||||
typedef unsigned char _cbyte;
|
||||
|
@ -17,37 +87,6 @@ typedef unsigned long _cdword;
|
|||
typedef CAPI_MESSAGE _cstruct;
|
||||
typedef enum { CAPI_COMPOSE = 0, CAPI_DEFAULT = 1 } _cmstruct;
|
||||
|
||||
/*----- errornumbers -----*/
|
||||
|
||||
typedef enum {
|
||||
CapiToManyAppls =0x1001,
|
||||
CapiLogBlkSizeToSmall =0x1002,
|
||||
CapiBuffExeceeds64k =0x1003,
|
||||
CapiMsgBufSizeToSmall =0x1004,
|
||||
CapiAnzLogConnNotSupported =0x1005,
|
||||
CapiRegReserved =0x1006,
|
||||
CapiRegBusy =0x1007,
|
||||
CapiRegOSResourceErr =0x1008,
|
||||
CapiRegNotInstalled =0x1009,
|
||||
CapiRegCtrlerNotSupportExtEquip =0x100a,
|
||||
CapiRegCtrlerOnlySupportExtEquip =0x100b
|
||||
} CAPI_REGISTER_ERROR;
|
||||
|
||||
typedef enum {
|
||||
CapiNoError =0x0000,
|
||||
CapiIllAppNr =0x1101,
|
||||
CapiIllCmdOrSubcmdOrMsgToSmall =0x1102,
|
||||
CapiSendQueueFull =0x1103,
|
||||
CapiReceiveQueueEmpty =0x1104,
|
||||
CapiReceiveOverflow =0x1105,
|
||||
CapiUnknownNotPar =0x1106,
|
||||
CapiMsgBusy =0x1107,
|
||||
CapiMsgOSResourceErr =0x1108,
|
||||
CapiMsgNotInstalled =0x1109,
|
||||
CapiMsgCtrlerNotSupportExtEquip =0x110a,
|
||||
CapiMsgCtrlerOnlySupportExtEquip =0x110b
|
||||
} MESSAGE_EXCHANGE_ERROR;
|
||||
|
||||
/*----- CAPI commands -----*/
|
||||
|
||||
#define CAPI_ALERT 0x01
|
||||
|
@ -73,49 +112,6 @@ typedef enum {
|
|||
#define CAPI_IND 0x82
|
||||
#define CAPI_RESP 0x83
|
||||
|
||||
/* standard CAPI2.0 functions */
|
||||
|
||||
unsigned capi20_isinstalled (void);
|
||||
|
||||
_cword capi20_register (unsigned MaxB3Connection,
|
||||
unsigned MaxB3Blks,
|
||||
unsigned MaxSizeB3,
|
||||
CAPI_REGISTER_ERROR *ErrorCode);
|
||||
|
||||
MESSAGE_EXCHANGE_ERROR capi20_release (unsigned Appl_Id);
|
||||
|
||||
MESSAGE_EXCHANGE_ERROR capi20_put_message (CAPI_MESSAGE Msg, unsigned Appl_Id);
|
||||
|
||||
MESSAGE_EXCHANGE_ERROR capi20_get_message (unsigned Appl_Id, CAPI_MESSAGE *ReturnMessage);
|
||||
|
||||
CAPI_MESSAGE capi20_get_manufacturer (unsigned contr, CAPI_MESSAGE LpBuffer);
|
||||
|
||||
CAPI_MESSAGE capi20_get_version (unsigned contr, CAPI_MESSAGE version);
|
||||
|
||||
CAPI_MESSAGE capi20_get_serial_number (unsigned contr, CAPI_MESSAGE LpBuffer);
|
||||
|
||||
MESSAGE_EXCHANGE_ERROR capi20_get_profile (unsigned Controller, CAPI_MESSAGE LpBuffer);
|
||||
|
||||
/* CAPI2.0 Spec names */
|
||||
#define CAPI20_REGISTER capi20_register
|
||||
#define CAPI20_RELEASE capi20_release
|
||||
#define CAPI20_PUT_MESSAGE capi20_put_message
|
||||
#define CAPI20_GET_MESSAGE capi20_get_message
|
||||
#define CAPI20_GET_MANUFACTURER capi20_get_manufacturer
|
||||
#define CAPI20_GET_VERSION capi20_get_version
|
||||
#define CAPI20_GET_SERIAL_NUMBER capi20_get_serial_number
|
||||
#define CAPI20_GET_PROFILE capi20_get_profile
|
||||
#define CAPI20_ISINSTALLED capi20_isinstalled
|
||||
#define CAPI_CMSG_HEADER capi_cmsg_header
|
||||
#define CAPI_GET_CMSG capi_get_cmsg
|
||||
#define CAPI_PUT_CMSG capi_put_cmsg
|
||||
|
||||
/* extra functions */
|
||||
#define CAPI20_WaitforMessage capi20_waitformessage
|
||||
MESSAGE_EXCHANGE_ERROR capi20_waitformessage(_cword Appl_Id, struct timeval *tvp);
|
||||
|
||||
int capi20_fileno(_cword applid);
|
||||
|
||||
/*
|
||||
* The _cmsg structure contains all possible CAPI 2.0 parameter.
|
||||
* All parameters are stored here first. The function capi_cmsg2message()
|
||||
|
@ -187,40 +183,58 @@ typedef struct {
|
|||
/* intern */
|
||||
unsigned l,p;
|
||||
unsigned char *par;
|
||||
CAPI_MESSAGE m;
|
||||
unsigned char *m;
|
||||
} _cmsg;
|
||||
|
||||
unsigned capi_cmsg2message(_cmsg *cmsg, CAPI_MESSAGE msg);
|
||||
|
||||
unsigned capi_message2cmsg (_cmsg *cmsg, CAPI_MESSAGE msg);
|
||||
#define capi_cmsg2message capi20_cmsg2message
|
||||
#define capi_message2cmsg capi20_message2cmsg
|
||||
|
||||
unsigned capi20_cmsg2message(_cmsg *cmsg, unsigned char *msg);
|
||||
|
||||
unsigned capi20_message2cmsg (_cmsg *cmsg, unsigned char *msg);
|
||||
|
||||
/*
|
||||
* capi_put_cmsg() works like capi_put_message() but it converts the _cmsg
|
||||
* first with capi_cmsg2message(). Possible errors from capi_put_message()
|
||||
* will be returned.
|
||||
* capi20_put_cmsg() works like capi20_put_message() but it converts the
|
||||
* _cmsg * first with capi20_cmsg2message(). Possible errors from
|
||||
* capi20_put_message() will be returned.
|
||||
*/
|
||||
|
||||
unsigned capi_put_cmsg(_cmsg *cmsg);
|
||||
#define CAPI_PUT_CMSG capi20_put_cmsg
|
||||
#define capi_put_cmsg capi20_put_cmsg
|
||||
|
||||
unsigned short capi20_put_cmsg(_cmsg *cmsg);
|
||||
|
||||
/*
|
||||
* capi_get_cmsg() works like capi_get_message() and converts the CAPI message
|
||||
* to a _cmsg with capi_message2cmsg(). Possible errors from capi_get_message()
|
||||
* will be returned.
|
||||
* capi20_get_cmsg() works like capi20_get_message() and converts the
|
||||
* CAPI message * to a _cmsg with capi20_message2cmsg().
|
||||
* Possible errors from capi20_get_message() will be returned.
|
||||
*/
|
||||
unsigned capi_get_cmsg(_cmsg *cmsg, unsigned applid);
|
||||
|
||||
#define CAPI_GET_CMSG capi20_get_cmsg
|
||||
#define capi_get_cmsg capi20_get_cmsg
|
||||
|
||||
unsigned short capi20_get_cmsg(_cmsg *cmsg, unsigned applid);
|
||||
|
||||
/*
|
||||
* capi_cmsg_header() fills the _cmsg structure with default values, so only
|
||||
* parameter with non default values must be changed before sending the
|
||||
* message.
|
||||
* capi20_cmsg_header() fills the _cmsg structure with default values,
|
||||
* so only parameter with non default values must be changed before
|
||||
* sending the message.
|
||||
*/
|
||||
unsigned capi_cmsg_header (_cmsg *cmsg, _cword _ApplId, _cbyte _Command, _cbyte _Subcommand, _cword _Messagenumber, _cdword _Controller);
|
||||
|
||||
#define CAPI_CMSG_HEADER capi20_cmsg_header
|
||||
#define capi_cmsg_header capi20_cmsg_header
|
||||
|
||||
unsigned capi20_cmsg_header (_cmsg *cmsg, unsigned _ApplId, _cbyte _Command, _cbyte _Subcommand, _cword _Messagenumber, _cdword _Controller);
|
||||
|
||||
/*
|
||||
* capi_cmsg_answer() is used to answer indications. It changes the header
|
||||
* capi20_cmsg_answer() is used to answer indications. It changes the header
|
||||
* of an indication to a response, and leaves all other parameters the same
|
||||
*/
|
||||
unsigned capi_cmsg_answer (_cmsg *cmsg);
|
||||
|
||||
#define capi_cmsg_answer capi20_cmsg_answer
|
||||
|
||||
unsigned capi20_cmsg_answer (_cmsg *cmsg);
|
||||
|
||||
/*----- defines to access specific parameter -----*/
|
||||
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
* $Id$
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.4 1998/10/23 12:20:44 fritz
|
||||
* Added some missing functions.
|
||||
*
|
||||
* Revision 1.3 1998/08/30 09:57:21 calle
|
||||
* I hope it is know readable for everybody.
|
||||
*
|
||||
|
@ -407,7 +410,7 @@ unsigned capi_cmsg_answer (_cmsg *cmsg)
|
|||
}
|
||||
|
||||
/*-------------------------------------------------------*/
|
||||
unsigned capi_cmsg_header (_cmsg *cmsg, _cword _ApplId,
|
||||
unsigned capi20_cmsg_header (_cmsg *cmsg, unsigned _ApplId,
|
||||
_cbyte _Command, _cbyte _Subcommand,
|
||||
_cword _Messagenumber, _cdword _Controller) {
|
||||
memset (cmsg, 0, sizeof(_cmsg));
|
||||
|
@ -420,7 +423,7 @@ unsigned capi_cmsg_header (_cmsg *cmsg, _cword _ApplId,
|
|||
}
|
||||
|
||||
/*-------------------------------------------------------*/
|
||||
unsigned capi_put_cmsg (_cmsg *cmsg)
|
||||
unsigned short capi20_put_cmsg (_cmsg *cmsg)
|
||||
{
|
||||
static unsigned char msg[2048];
|
||||
|
||||
|
@ -429,7 +432,7 @@ unsigned capi_put_cmsg (_cmsg *cmsg)
|
|||
}
|
||||
|
||||
/*-------------------------------------------------------*/
|
||||
unsigned capi_get_cmsg (_cmsg *cmsg, unsigned applid)
|
||||
unsigned short capi20_get_cmsg (_cmsg *cmsg, unsigned applid)
|
||||
{
|
||||
MESSAGE_EXCHANGE_ERROR rtn;
|
||||
CAPI_MESSAGE msg;
|
||||
|
|
Loading…
Reference in New Issue