Last changes for proposed standards (CAPI 2.0):
- AK1-148 "Linux Extention" - AK1-155 "Support of 64-bit Applications"
This commit is contained in:
parent
44aa7ebb3b
commit
03e393cd08
107
capi20/capi20.c
107
capi20/capi20.c
|
@ -1,7 +1,12 @@
|
|||
/*
|
||||
* $Id: capi20.c,v 1.6 1999/09/06 17:40:07 calle Exp $
|
||||
* $Id: capi20.c,v 1.7 1999/09/10 17:20:33 calle Exp $
|
||||
*
|
||||
* $Log: capi20.c,v $
|
||||
* Revision 1.7 1999/09/10 17:20:33 calle
|
||||
* Last changes for proposed standards (CAPI 2.0):
|
||||
* - AK1-148 "Linux Extention"
|
||||
* - AK1-155 "Support of 64-bit Applications"
|
||||
*
|
||||
* Revision 1.6 1999/09/06 17:40:07 calle
|
||||
* Changes for CAPI 2.0 Spec.
|
||||
*
|
||||
|
@ -40,16 +45,18 @@ static capi_ioctl_struct ioctl_data;
|
|||
static unsigned char rcvbuf[128+2048]; /* message + data */
|
||||
static unsigned char sndbuf[128+2048]; /* message + data */
|
||||
|
||||
unsigned short capi20_isinstalled (void)
|
||||
unsigned capi20_isinstalled (void)
|
||||
{
|
||||
if (capi_fd >= 0)
|
||||
return 1;
|
||||
|
||||
/*----- open managment link -----*/
|
||||
if ((capi_fd = open("/dev/capi20", O_RDWR, 0666)) < 0)
|
||||
return 0;
|
||||
return CapiRegNotInstalled;
|
||||
|
||||
return ioctl(capi_fd, CAPI_INSTALLED, 0) == 0;
|
||||
if (ioctl(capi_fd, CAPI_INSTALLED, 0) == 0)
|
||||
return CapiNoError;
|
||||
return CapiRegNotInstalled;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -61,9 +68,9 @@ static struct capi_applidmap {
|
|||
int fd;
|
||||
} capi_applidmap[CAPI_MAXAPPL] = {{0,0}};
|
||||
|
||||
static inline unsigned short allocapplid(int fd)
|
||||
static inline unsigned allocapplid(int fd)
|
||||
{
|
||||
unsigned short i;
|
||||
unsigned i;
|
||||
for (i=0; i < CAPI_MAXAPPL; i++) {
|
||||
if (capi_applidmap[i].used == 0) {
|
||||
capi_applidmap[i].used = 1;
|
||||
|
@ -74,19 +81,19 @@ static inline unsigned short allocapplid(int fd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline void freeapplid(unsigned short applid)
|
||||
static inline void freeapplid(unsigned applid)
|
||||
{
|
||||
capi_applidmap[applid-1].used = 0;
|
||||
capi_applidmap[applid-1].fd = -1;
|
||||
}
|
||||
|
||||
static inline int validapplid(unsigned short applid)
|
||||
static inline int validapplid(unsigned applid)
|
||||
{
|
||||
return applid > 0 && applid <= CAPI_MAXAPPL
|
||||
&& capi_applidmap[applid-1].used;
|
||||
}
|
||||
|
||||
static inline int applid2fd(unsigned short applid)
|
||||
static inline int applid2fd(unsigned applid)
|
||||
{
|
||||
if (applid < CAPI_MAXAPPL)
|
||||
return capi_applidmap[applid-1].fd;
|
||||
|
@ -97,22 +104,20 @@ static inline int applid2fd(unsigned short applid)
|
|||
* CAPI2.0 functions
|
||||
*/
|
||||
|
||||
unsigned short
|
||||
unsigned
|
||||
capi20_register (unsigned MaxB3Connection,
|
||||
unsigned MaxB3Blks,
|
||||
unsigned MaxSizeB3,
|
||||
unsigned short *ErrorCode)
|
||||
unsigned *ApplID)
|
||||
{
|
||||
unsigned short applid;
|
||||
unsigned applid = 0;
|
||||
char buf[PATH_MAX];
|
||||
int i, fd = -1;
|
||||
|
||||
if (!capi20_isinstalled()) {
|
||||
*ErrorCode = CapiRegNotInstalled;
|
||||
return 0;
|
||||
}
|
||||
*ApplID = applid;
|
||||
|
||||
*ErrorCode = CapiRegOSResourceErr;
|
||||
if (!capi20_isinstalled())
|
||||
return CapiRegNotInstalled;
|
||||
|
||||
for (i=0; fd < 0; i++) {
|
||||
/*----- open pseudo-clone device -----*/
|
||||
|
@ -122,13 +127,13 @@ capi20_register (unsigned MaxB3Connection,
|
|||
case EEXIST:
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
return CapiRegOSResourceErr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((applid = allocapplid(fd)) == 0)
|
||||
return 0;
|
||||
return CapiRegOSResourceErr;
|
||||
|
||||
ioctl_data.rparams.level3cnt = MaxB3Connection;
|
||||
ioctl_data.rparams.datablkcnt = MaxB3Blks;
|
||||
|
@ -137,16 +142,16 @@ capi20_register (unsigned MaxB3Connection,
|
|||
if (ioctl(fd, CAPI_REGISTER, &ioctl_data) < 0) {
|
||||
if (errno == EIO) {
|
||||
if (ioctl(fd, CAPI_GET_ERRCODE, &ioctl_data) < 0)
|
||||
return 0;
|
||||
*ErrorCode = ioctl_data.errcode;
|
||||
return CapiRegOSResourceErr;
|
||||
return (unsigned)ioctl_data.errcode;
|
||||
}
|
||||
return 0;
|
||||
return CapiRegOSResourceErr;
|
||||
}
|
||||
*ErrorCode = CapiNoError;
|
||||
return applid;
|
||||
*ApplID = applid;
|
||||
return CapiNoError;
|
||||
}
|
||||
|
||||
unsigned short
|
||||
unsigned
|
||||
capi20_release (unsigned ApplID)
|
||||
{
|
||||
if (!capi20_isinstalled())
|
||||
|
@ -158,10 +163,10 @@ capi20_release (unsigned ApplID)
|
|||
return CapiNoError;
|
||||
}
|
||||
|
||||
unsigned short
|
||||
unsigned
|
||||
capi20_put_message (unsigned char *Msg, unsigned ApplID)
|
||||
{
|
||||
unsigned short ret;
|
||||
unsigned ret;
|
||||
int len = (Msg[0] | (Msg[1] << 8));
|
||||
int cmd = Msg[4];
|
||||
int subcmd = Msg[5];
|
||||
|
@ -181,10 +186,20 @@ capi20_put_message (unsigned char *Msg, unsigned ApplID)
|
|||
if (cmd == CAPI_DATA_B3 && subcmd == CAPI_REQ) {
|
||||
int datalen = (Msg[16] | (Msg[17] << 8));
|
||||
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));
|
||||
if (sizeof(void *) != 4) {
|
||||
if (len > 22) { /* 64Bit CAPI-extention */
|
||||
u_int64_t data64;
|
||||
memcpy(&data64,Msg+22, sizeof(u_int64_t));
|
||||
if (data64 != 0) dataptr = (void *)data64;
|
||||
else dataptr = Msg + len; /* Assume data after message */
|
||||
} else {
|
||||
dataptr = Msg + len; /* Assume data after message */
|
||||
}
|
||||
} else {
|
||||
u_int32_t data;
|
||||
memcpy(&data,Msg+12, sizeof(u_int32_t));
|
||||
if (data != 0) dataptr = (void *)data;
|
||||
else dataptr = Msg + len; /* Assume data after message */
|
||||
}
|
||||
memcpy(sndbuf+len, dataptr, datalen);
|
||||
len += datalen;
|
||||
|
@ -205,7 +220,7 @@ capi20_put_message (unsigned char *Msg, unsigned ApplID)
|
|||
case EIO:
|
||||
if (ioctl(fd, CAPI_GET_ERRCODE, &ioctl_data) < 0)
|
||||
ret = CapiMsgOSResourceErr;
|
||||
else ret = (unsigned short)ioctl_data.errcode;
|
||||
else ret = (unsigned)ioctl_data.errcode;
|
||||
break;
|
||||
default:
|
||||
ret = CapiMsgOSResourceErr;
|
||||
|
@ -216,10 +231,10 @@ capi20_put_message (unsigned char *Msg, unsigned ApplID)
|
|||
return ret;
|
||||
}
|
||||
|
||||
unsigned short
|
||||
unsigned
|
||||
capi20_get_message (unsigned ApplID, unsigned char **Buf)
|
||||
{
|
||||
unsigned short ret;
|
||||
unsigned ret;
|
||||
int rc, fd;
|
||||
|
||||
if (!capi20_isinstalled())
|
||||
|
@ -234,15 +249,25 @@ capi20_get_message (unsigned ApplID, unsigned char **Buf)
|
|||
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;
|
||||
if (sizeof(void *) == 4) {
|
||||
u_int32_t data = (u_int32_t)rcvbuf + CAPIMSG_LEN(rcvbuf);
|
||||
rcvbuf[12] = data & 0xff;
|
||||
rcvbuf[13] = (data >> 8) & 0xff;
|
||||
rcvbuf[14] = (data >> 16) & 0xff;
|
||||
rcvbuf[15] = (data >> 24) & 0xff;
|
||||
} else {
|
||||
} else {
|
||||
/* 64Bit CAPI-extention */
|
||||
u_int64_t data = (u_int64_t)rcvbuf + CAPIMSG_LEN(rcvbuf);
|
||||
rcvbuf[12] = rcvbuf[13] = rcvbuf[14] = rcvbuf[15] = 0;
|
||||
}
|
||||
rcvbuf[22] = data & 0xff;
|
||||
rcvbuf[23] = (data >> 8) & 0xff;
|
||||
rcvbuf[24] = (data >> 16) & 0xff;
|
||||
rcvbuf[25] = (data >> 24) & 0xff;
|
||||
rcvbuf[26] = (data >> 32) & 0xff;
|
||||
rcvbuf[27] = (data >> 40) & 0xff;
|
||||
rcvbuf[28] = (data >> 48) & 0xff;
|
||||
rcvbuf[29] = (data >> 56) & 0xff;
|
||||
}
|
||||
}
|
||||
return CapiNoError;
|
||||
}
|
||||
|
@ -300,7 +325,7 @@ capi20_get_serial_number(unsigned Ctrl, unsigned char *Buf)
|
|||
return Buf;
|
||||
}
|
||||
|
||||
unsigned short
|
||||
unsigned
|
||||
capi20_get_profile(unsigned Ctrl, unsigned char *Buf)
|
||||
{
|
||||
if (!capi20_isinstalled())
|
||||
|
@ -312,7 +337,7 @@ capi20_get_profile(unsigned Ctrl, unsigned char *Buf)
|
|||
return CapiMsgOSResourceErr;
|
||||
if (ioctl(capi_fd, CAPI_GET_ERRCODE, &ioctl_data) < 0)
|
||||
return CapiMsgOSResourceErr;
|
||||
return (unsigned short)ioctl_data.errcode;
|
||||
return (unsigned)ioctl_data.errcode;
|
||||
}
|
||||
if (Ctrl)
|
||||
memcpy(Buf, &ioctl_data.profile, sizeof(struct capi_profile));
|
||||
|
@ -325,7 +350,7 @@ capi20_get_profile(unsigned Ctrl, unsigned char *Buf)
|
|||
* functions added to the CAPI2.0 spec
|
||||
*/
|
||||
|
||||
unsigned short
|
||||
unsigned
|
||||
capi20_waitformessage(unsigned ApplID, struct timeval *TimeOut)
|
||||
{
|
||||
int fd;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef __CAPI20_H
|
||||
#define __CAPI20_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
|
||||
|
@ -38,18 +39,18 @@ extern "C" {
|
|||
|
||||
/* standard CAPI2.0 functions */
|
||||
|
||||
unsigned short capi20_register (unsigned MaxLogicalConnection,
|
||||
unsigned capi20_register (unsigned MaxLogicalConnection,
|
||||
unsigned MaxBDataBlocks,
|
||||
unsigned MaxBDataLen,
|
||||
unsigned short *ErrorCode);
|
||||
unsigned *ApplIDp);
|
||||
|
||||
unsigned short capi20_release (unsigned ApplID);
|
||||
unsigned capi20_release (unsigned ApplID);
|
||||
|
||||
unsigned short capi20_put_message (unsigned char *Msg, unsigned ApplID);
|
||||
unsigned capi20_put_message (unsigned char *Msg, unsigned ApplID);
|
||||
|
||||
unsigned short capi20_get_message (unsigned ApplID, unsigned char **Buf);
|
||||
unsigned capi20_get_message (unsigned ApplID, unsigned char **Buf);
|
||||
|
||||
unsigned short capi20_waitformessage(unsigned ApplID, struct timeval *TimeOut);
|
||||
unsigned capi20_waitformessage(unsigned ApplID, struct timeval *TimeOut);
|
||||
|
||||
unsigned char *capi20_get_manufacturer (unsigned Ctrl, unsigned char *Buf);
|
||||
|
||||
|
@ -57,9 +58,9 @@ 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 capi20_get_profile (unsigned Controller, unsigned char *Buf);
|
||||
|
||||
unsigned short capi20_isinstalled (void);
|
||||
unsigned capi20_isinstalled (void);
|
||||
|
||||
int capi20_fileno(unsigned ApplID);
|
||||
|
||||
|
@ -76,14 +77,15 @@ int capi20_fileno(unsigned ApplID);
|
|||
|
||||
/* end standard CAPI2.0 functions */
|
||||
|
||||
#define CAPI_REGISTER_ERROR unsigned short
|
||||
#define MESSAGE_EXCHANGE_ERROR unsigned short
|
||||
#define CAPI_REGISTER_ERROR unsigned
|
||||
#define MESSAGE_EXCHANGE_ERROR unsigned
|
||||
|
||||
|
||||
typedef unsigned char *CAPI_MESSAGE;
|
||||
typedef unsigned char _cbyte;
|
||||
typedef unsigned short _cword;
|
||||
typedef unsigned long _cdword;
|
||||
typedef __uint8_t _cbyte;
|
||||
typedef __uint16_t _cword;
|
||||
typedef __uint32_t _cdword;
|
||||
typedef __uint64_t _cqword;
|
||||
typedef CAPI_MESSAGE _cstruct;
|
||||
typedef enum { CAPI_COMPOSE = 0, CAPI_DEFAULT = 1 } _cmstruct;
|
||||
|
||||
|
@ -154,7 +156,8 @@ typedef struct {
|
|||
_cdword Class;
|
||||
_cstruct ConnectedNumber;
|
||||
_cstruct ConnectedSubaddress;
|
||||
_cdword Data;
|
||||
_cdword Data32;
|
||||
_cqword Data64;
|
||||
_cword DataHandle;
|
||||
_cword DataLength;
|
||||
_cstruct FacilityConfirmationParameter;
|
||||
|
@ -179,6 +182,7 @@ typedef struct {
|
|||
_cword Reason_B3;
|
||||
_cword Reject;
|
||||
_cstruct Useruserdata;
|
||||
unsigned char *Data;
|
||||
|
||||
/* intern */
|
||||
unsigned l,p;
|
||||
|
@ -203,7 +207,7 @@ unsigned capi20_message2cmsg (_cmsg *cmsg, unsigned char *msg);
|
|||
#define CAPI_PUT_CMSG capi20_put_cmsg
|
||||
#define capi_put_cmsg capi20_put_cmsg
|
||||
|
||||
unsigned short capi20_put_cmsg(_cmsg *cmsg);
|
||||
unsigned capi20_put_cmsg(_cmsg *cmsg);
|
||||
|
||||
/*
|
||||
* capi20_get_cmsg() works like capi20_get_message() and converts the
|
||||
|
@ -214,7 +218,7 @@ unsigned short capi20_put_cmsg(_cmsg *cmsg);
|
|||
#define CAPI_GET_CMSG capi20_get_cmsg
|
||||
#define capi_get_cmsg capi20_get_cmsg
|
||||
|
||||
unsigned short capi20_get_cmsg(_cmsg *cmsg, unsigned applid);
|
||||
unsigned capi20_get_cmsg(_cmsg *cmsg, unsigned applid);
|
||||
|
||||
/*
|
||||
* capi20_cmsg_header() fills the _cmsg structure with default values,
|
||||
|
@ -872,7 +876,7 @@ unsigned CONNECT_B3_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber
|
|||
,_cstruct NCPI);
|
||||
unsigned DATA_B3_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber
|
||||
,_cdword adr
|
||||
,_cdword Data
|
||||
,void * Data
|
||||
,_cword DataLength
|
||||
,_cword DataHandle
|
||||
,_cword Flags);
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
/*
|
||||
* $Id: capifunc.c,v 1.3 1998/08/30 09:57:17 calle Exp $
|
||||
* $Id: capifunc.c,v 1.4 1999/09/10 17:20:33 calle Exp $
|
||||
*
|
||||
* $Log: capifunc.c,v $
|
||||
* Revision 1.4 1999/09/10 17:20:33 calle
|
||||
* Last changes for proposed standards (CAPI 2.0):
|
||||
* - AK1-148 "Linux Extention"
|
||||
* - AK1-155 "Support of 64-bit Applications"
|
||||
*
|
||||
* Revision 1.3 1998/08/30 09:57:17 calle
|
||||
* I hope it is know readable for everybody.
|
||||
*
|
||||
|
@ -78,7 +83,7 @@ unsigned CONNECT_B3_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber,
|
|||
|
||||
unsigned DATA_B3_REQ (_cmsg *cmsg, _cword ApplId, _cword Messagenumber,
|
||||
_cdword adr,
|
||||
_cdword Data,
|
||||
void *Data,
|
||||
_cword DataLength,
|
||||
_cword DataHandle,
|
||||
_cword Flags) {
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
/*
|
||||
* $Id: convert.c,v 1.5 1999/09/06 17:40:07 calle Exp $
|
||||
* $Id: convert.c,v 1.6 1999/09/10 17:20:33 calle Exp $
|
||||
*
|
||||
* $Log: convert.c,v $
|
||||
* Revision 1.6 1999/09/10 17:20:33 calle
|
||||
* Last changes for proposed standards (CAPI 2.0):
|
||||
* - AK1-148 "Linux Extention"
|
||||
* - AK1-155 "Support of 64-bit Applications"
|
||||
*
|
||||
* Revision 1.5 1999/09/06 17:40:07 calle
|
||||
* Changes for CAPI 2.0 Spec.
|
||||
*
|
||||
|
@ -33,9 +38,10 @@ typedef struct {
|
|||
#define _CBYTE 1
|
||||
#define _CWORD 2
|
||||
#define _CDWORD 3
|
||||
#define _CSTRUCT 4
|
||||
#define _CMSTRUCT 5
|
||||
#define _CEND 6
|
||||
#define _CQWORD 4
|
||||
#define _CSTRUCT 5
|
||||
#define _CMSTRUCT 6
|
||||
#define _CEND 7
|
||||
|
||||
static _cdef cdef[] = {
|
||||
/*00*/{_CEND},
|
||||
|
@ -62,7 +68,7 @@ static _cdef cdef[] = {
|
|||
/*15*/{_CDWORD, offsetof(_cmsg,Class) },
|
||||
/*16*/{_CSTRUCT, offsetof(_cmsg,ConnectedNumber) },
|
||||
/*17*/{_CSTRUCT, offsetof(_cmsg,ConnectedSubaddress) },
|
||||
/*18*/{_CDWORD, offsetof(_cmsg,Data) },
|
||||
/*18*/{_CDWORD, offsetof(_cmsg,Data32) },
|
||||
/*19*/{_CWORD, offsetof(_cmsg,DataHandle) },
|
||||
/*1a*/{_CWORD, offsetof(_cmsg,DataLength) },
|
||||
/*1b*/{_CSTRUCT, offsetof(_cmsg,FacilityConfirmationParameter) },
|
||||
|
@ -115,7 +121,7 @@ static unsigned char *cpars[] = {
|
|||
(unsigned char*)"\x03\x2c\x01",
|
||||
/*0e*/ 0,
|
||||
/*0f DATA_B3_REQ*/
|
||||
(unsigned char*)"\x03\x18\x1a\x19\x21\x01",
|
||||
(unsigned char*)"\x03\x18\x1a\x19\x21\x31\x01",
|
||||
/*10 RESET_B3_REQ*/
|
||||
(unsigned char*)"\x03\x2c\x01",
|
||||
/*11*/ 0,
|
||||
|
@ -174,7 +180,7 @@ static unsigned char *cpars[] = {
|
|||
(unsigned char*)"\x03\x2e\x2c\x01",
|
||||
/*32*/ 0,
|
||||
/*33 DATA_B3_IND*/
|
||||
(unsigned char*)"\x03\x18\x1a\x19\x21\x01",
|
||||
(unsigned char*)"\x03\x18\x1a\x19\x21\x31\x01",
|
||||
/*34 RESET_B3_IND*/
|
||||
(unsigned char*)"\x03\x2c\x01",
|
||||
/*35 CONNECT_B3_T90_ACTIVE_IND*/
|
||||
|
@ -224,12 +230,14 @@ static unsigned char *cpars[] = {
|
|||
#define byteTLcpy(x,y) *(_cbyte *)(x)=*(_cbyte *)(y);
|
||||
#define wordTLcpy(x,y) *(_cword *)(x)=*(_cword *)(y);
|
||||
#define dwordTLcpy(x,y) memcpy(x,y,4);
|
||||
#define qwordTLcpy(x,y) memcpy(x,y,8);
|
||||
#define structTLcpy(x,y,l) memcpy (x,y,l)
|
||||
#define structTLcpyovl(x,y,l) memmove (x,y,l)
|
||||
|
||||
#define byteTRcpy(x,y) *(_cbyte *)(y)=*(_cbyte *)(x);
|
||||
#define wordTRcpy(x,y) *(_cword *)(y)=*(_cword *)(x);
|
||||
#define dwordTRcpy(x,y) memcpy(y,x,4);
|
||||
#define qwordTRcpy(x,y) memcpy(y,x,8);
|
||||
#define structTRcpy(x,y,l) memcpy (y,x,l)
|
||||
#define structTRcpyovl(x,y,l) memmove (y,x,l)
|
||||
|
||||
|
@ -278,6 +286,10 @@ static void PARS_2_MESSAGE (_cmsg *cmsg) {
|
|||
dwordTLcpy (cmsg->m+cmsg->l, OFF);
|
||||
cmsg->l+=4;
|
||||
break;
|
||||
case _CQWORD:
|
||||
qwordTLcpy (cmsg->m+cmsg->l, OFF);
|
||||
cmsg->l+=4;
|
||||
break;
|
||||
case _CSTRUCT:
|
||||
if (*(CAPI_MESSAGE *) OFF == 0) {
|
||||
*(cmsg->m+cmsg->l)='\0';
|
||||
|
@ -330,6 +342,17 @@ unsigned capi_cmsg2message (_cmsg *cmsg, CAPI_MESSAGE msg)
|
|||
cmsg->p = 0;
|
||||
cmsg->par = cpars [command_2_index (cmsg->Command,cmsg->Subcommand)];
|
||||
|
||||
if ( cmsg->Command == CAPI_DATA_B3
|
||||
&& (cmsg->Subcommand == CAPI_REQ || cmsg->Subcommand == CAPI_IND)) {
|
||||
if (sizeof(void *) == 4) {
|
||||
cmsg->Data32 = (_cdword)cmsg->Data;
|
||||
cmsg->Data64 = 0;
|
||||
} else {
|
||||
cmsg->Data32 = 0;
|
||||
cmsg->Data64 = (_cqword)cmsg->Data;
|
||||
}
|
||||
}
|
||||
|
||||
PARS_2_MESSAGE (cmsg);
|
||||
|
||||
wordTLcpy (msg+0, &cmsg->l);
|
||||
|
@ -358,6 +381,10 @@ static void MESSAGE_2_PARS (_cmsg *cmsg) {
|
|||
dwordTRcpy (cmsg->m+cmsg->l, OFF);
|
||||
cmsg->l+=4;
|
||||
break;
|
||||
case _CQWORD:
|
||||
qwordTRcpy (cmsg->m+cmsg->l, OFF);
|
||||
cmsg->l+=8;
|
||||
break;
|
||||
case _CSTRUCT:
|
||||
*(CAPI_MESSAGE *)OFF = cmsg->m+cmsg->l;
|
||||
|
||||
|
@ -398,10 +425,20 @@ unsigned capi_message2cmsg (_cmsg *cmsg, CAPI_MESSAGE msg)
|
|||
|
||||
MESSAGE_2_PARS (cmsg);
|
||||
|
||||
if ( cmsg->Command == CAPI_DATA_B3
|
||||
&& (cmsg->Subcommand == CAPI_REQ || cmsg->Subcommand == CAPI_IND)) {
|
||||
if (sizeof(void *) == 4) {
|
||||
cmsg->Data = (void *)cmsg->Data32;
|
||||
} else {
|
||||
cmsg->Data = (void *)cmsg->Data64;
|
||||
}
|
||||
}
|
||||
|
||||
wordTRcpy (msg+0, &cmsg->l);
|
||||
wordTRcpy (cmsg->m+2, &cmsg->ApplId);
|
||||
wordTRcpy (cmsg->m+6, &cmsg->Messagenumber);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -426,7 +463,7 @@ unsigned capi20_cmsg_header (_cmsg *cmsg, unsigned _ApplId,
|
|||
}
|
||||
|
||||
/*-------------------------------------------------------*/
|
||||
unsigned short capi20_put_cmsg (_cmsg *cmsg)
|
||||
unsigned capi20_put_cmsg (_cmsg *cmsg)
|
||||
{
|
||||
static unsigned char msg[2048];
|
||||
|
||||
|
@ -435,7 +472,7 @@ unsigned short capi20_put_cmsg (_cmsg *cmsg)
|
|||
}
|
||||
|
||||
/*-------------------------------------------------------*/
|
||||
unsigned short capi20_get_cmsg (_cmsg *cmsg, unsigned applid)
|
||||
unsigned capi20_get_cmsg (_cmsg *cmsg, unsigned applid)
|
||||
{
|
||||
MESSAGE_EXCHANGE_ERROR rtn;
|
||||
CAPI_MESSAGE msg;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: init.c,v 1.2 1998/10/23 12:50:57 fritz Exp $
|
||||
/* $Id: init.c,v 1.3 1999/09/10 17:20:34 calle Exp $
|
||||
*
|
||||
* CAPI registration/deregistration.
|
||||
* This stuff is based heavily on AVM's CAPI-adk for linux.
|
||||
|
@ -15,6 +15,11 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log: init.c,v $
|
||||
* Revision 1.3 1999/09/10 17:20:34 calle
|
||||
* Last changes for proposed standards (CAPI 2.0):
|
||||
* - AK1-148 "Linux Extention"
|
||||
* - AK1-155 "Support of 64-bit Applications"
|
||||
*
|
||||
* Revision 1.2 1998/10/23 12:50:57 fritz
|
||||
* Added RCS keywords and GPL notice.
|
||||
*
|
||||
|
@ -32,7 +37,7 @@
|
|||
/*
|
||||
* defines needed by InitISDN
|
||||
*/
|
||||
unsigned short Appl_Id = 0;
|
||||
unsigned Appl_Id = 0;
|
||||
|
||||
#define MaxNumBChan 2 /* max. number of B-channels */
|
||||
#define MaxNumB3DataBlocks 7 /* max. number of unconfirmed B3-datablocks */
|
||||
|
@ -51,7 +56,7 @@ unsigned RegisterCAPI (void) {
|
|||
CAPI_REGISTER_ERROR ErrorCode;
|
||||
int numController;
|
||||
|
||||
if (!CAPI20_ISINSTALLED()) {
|
||||
if (CAPI20_ISINSTALLED() != CapiNoError) {
|
||||
fprintf(stderr, "No CAPI support on this system.\n");
|
||||
return 0;
|
||||
}
|
||||
|
@ -59,9 +64,9 @@ unsigned RegisterCAPI (void) {
|
|||
fprintf(stderr, "RegisterCAPI: No ISDN-controller installed\n");
|
||||
return 0;
|
||||
}
|
||||
Appl_Id = CAPI20_REGISTER(MaxNumBChan, MaxNumB3DataBlocks,
|
||||
MaxB3DataBlockSize, &ErrorCode);
|
||||
if (!Appl_Id) {
|
||||
ErrorCode = CAPI20_REGISTER(MaxNumBChan, MaxNumB3DataBlocks,
|
||||
MaxB3DataBlockSize, &Appl_Id);
|
||||
if (ErrorCode != CapiNoError) {
|
||||
fprintf(stderr, "RegisterCAPI: error: %04x\n", ErrorCode);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: init.h,v 1.2 1998/10/23 12:50:58 fritz Exp $
|
||||
/* $Id: init.h,v 1.3 1999/09/10 17:20:34 calle Exp $
|
||||
*
|
||||
* CAPI registration/deregistration.
|
||||
* This stuff is based heavily on AVM's CAPI-adk for linux.
|
||||
|
@ -15,6 +15,11 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log: init.h,v $
|
||||
* Revision 1.3 1999/09/10 17:20:34 calle
|
||||
* Last changes for proposed standards (CAPI 2.0):
|
||||
* - AK1-148 "Linux Extention"
|
||||
* - AK1-155 "Support of 64-bit Applications"
|
||||
*
|
||||
* Revision 1.2 1998/10/23 12:50:58 fritz
|
||||
* Added RCS keywords and GPL notice.
|
||||
*
|
||||
|
@ -22,7 +27,7 @@
|
|||
#ifndef _init_h_
|
||||
#define _init_h_
|
||||
|
||||
extern unsigned short Appl_Id;
|
||||
extern unsigned Appl_Id;
|
||||
|
||||
/*
|
||||
* RegisterCAPI: Check for CAPI, allocate memory for CAPI-buffer and
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: capiinfo.c,v 1.1 1999/04/16 15:40:48 calle Exp $
|
||||
/* $Id: capiinfo.c,v 1.2 1999/09/10 17:20:33 calle Exp $
|
||||
*
|
||||
* A CAPI application to get infomation about installed controllers
|
||||
*
|
||||
|
@ -14,6 +14,11 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Log: capiinfo.c,v $
|
||||
* Revision 1.2 1999/09/10 17:20:33 calle
|
||||
* Last changes for proposed standards (CAPI 2.0):
|
||||
* - AK1-148 "Linux Extention"
|
||||
* - AK1-155 "Support of 64-bit Applications"
|
||||
*
|
||||
* Revision 1.1 1999/04/16 15:40:48 calle
|
||||
* Added first version of capiinfo.
|
||||
*
|
||||
|
@ -95,10 +100,11 @@ int main(int argc, char **argv)
|
|||
unsigned char buf[64];
|
||||
unsigned long *vbuf;
|
||||
unsigned char *s;
|
||||
int ncontr, i, j;
|
||||
int ncontr, i;
|
||||
unsigned j;
|
||||
int isAVM;
|
||||
|
||||
if (!CAPI20_ISINSTALLED()) {
|
||||
if (CAPI20_ISINSTALLED() != CapiNoError) {
|
||||
fprintf(stderr, "capi not installed - %s (%d)\n", strerror(errno), errno);
|
||||
return 2;
|
||||
}
|
||||
|
|
|
@ -13,3 +13,10 @@
|
|||
|
||||
/* Define if you have the <linux/capi.h> header file. */
|
||||
#undef HAVE_LINUX_CAPI_H
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
|
|
Loading…
Reference in New Issue