- clone of D-channel stack also working now
This commit is contained in:
parent
920403ac53
commit
db925822e8
|
@ -18,7 +18,7 @@ char *pname;
|
|||
fprintf(stderr," -? Usage ; printout this information\n");
|
||||
fprintf(stderr," -c<n> use card number n (default 1)\n");
|
||||
fprintf(stderr," -v<n> Printing debug info level n\n");
|
||||
fprintf(stderr," 0 only recived messages are printed\n");
|
||||
fprintf(stderr," 0 only received messages are printed\n");
|
||||
fprintf(stderr," 1 send count\n");
|
||||
fprintf(stderr," 2 send status\n");
|
||||
fprintf(stderr," 3 send contens\n");
|
||||
|
@ -160,11 +160,11 @@ int do_setup(devinfo_t *di, int cardnr) {
|
|||
li.pid.layermask = ISDN_LAYER(3);
|
||||
li.st = di->b_stid[di->used_bchannel];
|
||||
ret = mISDN_new_layer(di->device, &li);
|
||||
if (ret<=0) {
|
||||
if (ret) {
|
||||
fprintf(stdout, "new_layer ret(%d)\n", ret);
|
||||
return(4);
|
||||
}
|
||||
di->b_adress[di->used_bchannel] = ret;
|
||||
di->b_adress[di->used_bchannel] = li.id;
|
||||
if (VerifyOn>2)
|
||||
fprintf(stdout,"b_adress%d %08x\n",
|
||||
di->used_bchannel+1, ret);
|
||||
|
|
|
@ -167,12 +167,12 @@ int setup_bchannel(devinfo_t *di) {
|
|||
li.pid.layermask = ISDN_LAYER(3);
|
||||
li.st = di->b_stid[di->used_bchannel];
|
||||
ret = mISDN_new_layer(di->device, &li);
|
||||
if (ret<0) {
|
||||
if (ret) {
|
||||
fprintf(stdout, "new_layer ret(%d)\n", ret);
|
||||
return(0);
|
||||
}
|
||||
if (ret) {
|
||||
di->b_adress[di->used_bchannel] = ret;
|
||||
if (li.id) {
|
||||
di->b_adress[di->used_bchannel] = li.id;
|
||||
if (VerifyOn>2)
|
||||
fprintf(stdout,"b_adress%d %08x\n",
|
||||
di->used_bchannel+1, ret);
|
||||
|
@ -206,9 +206,8 @@ int setup_bchannel(devinfo_t *di) {
|
|||
if (ret > 0)
|
||||
di->b_l2[di->used_bchannel] = ret;
|
||||
fprintf(stdout, "b_l2 id %08x\n", ret);
|
||||
|
||||
|
||||
}
|
||||
} else
|
||||
ret = 0;
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
@ -588,19 +587,34 @@ add_dlayer3(devinfo_t *di, int prot)
|
|||
{
|
||||
layer_info_t li;
|
||||
stack_info_t si;
|
||||
int lid, ret;
|
||||
int lid, stid, ret;
|
||||
|
||||
if (di->layer3) {
|
||||
memset(&si, 0, sizeof(stack_info_t));
|
||||
si.extentions = EXT_STACK_CLONE;
|
||||
si.mgr = -1;
|
||||
si.id = di->d_stid;
|
||||
ret = mISDN_new_stack(di->device, &si);
|
||||
if (ret <= 0) {
|
||||
fprintf(stdout, "clone stack failed ret(%d)\n", ret);
|
||||
stid = mISDN_new_stack(di->device, &si);
|
||||
if (stid <= 0) {
|
||||
fprintf(stdout, "clone stack failed ret(%d)\n", stid);
|
||||
return(11);
|
||||
}
|
||||
di->d_stid = ret;
|
||||
memset(&li, 0, sizeof(layer_info_t));
|
||||
li.object_id = -1;
|
||||
li.extentions = EXT_INST_CLONE;
|
||||
li.parent = di->layer2;
|
||||
li.st = stid;
|
||||
ret = mISDN_new_layer(di->device, &li);
|
||||
if (ret) {
|
||||
fprintf(stdout, "clone layer failed ret(%d)\n", ret);
|
||||
return(11);
|
||||
}
|
||||
if (!li.clone) {
|
||||
fprintf(stdout, "no cloned id\n");
|
||||
return(11);
|
||||
}
|
||||
di->layer2 = li.clone;
|
||||
di->d_stid = stid;
|
||||
}
|
||||
memset(&li, 0, sizeof(layer_info_t));
|
||||
strcpy(&li.name[0], "user L3");
|
||||
|
@ -609,10 +623,10 @@ add_dlayer3(devinfo_t *di, int prot)
|
|||
li.pid.protocol[3] = prot;
|
||||
li.pid.layermask = ISDN_LAYER(3);
|
||||
li.st = di->d_stid;
|
||||
lid = mISDN_new_layer(di->device, &li);
|
||||
if (lid<0)
|
||||
ret = mISDN_new_layer(di->device, &li);
|
||||
if (ret)
|
||||
return(12);
|
||||
di->layer3 = lid;
|
||||
di->layer3 = li.id;
|
||||
if (VerifyOn>1)
|
||||
fprintf(stdout,"new layer3 id %08x\n", di->layer3);
|
||||
if (!di->layer3)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: mISDNif.h,v 1.2 2005/05/13 10:38:24 keil Exp $
|
||||
/* $Id: mISDNif.h,v 1.3 2005/05/30 18:14:32 keil Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -33,8 +33,8 @@
|
|||
#define MISDN_MINOR_VERSION 0
|
||||
#define MISDN_VERSION ((MISDN_MAJOR_VERSION<<16) | MISDN_MINOR_VERSION)
|
||||
|
||||
#define MISDN_REVISION "$Revision: 1.2 $"
|
||||
#define MISDN_DATE "$Date: 2005/05/13 10:38:24 $"
|
||||
#define MISDN_REVISION "$Revision: 1.3 $"
|
||||
#define MISDN_DATE "$Date: 2005/05/30 18:14:32 $"
|
||||
|
||||
/* SUBCOMMANDS */
|
||||
#define REQUEST 0x80
|
||||
|
@ -448,7 +448,8 @@
|
|||
* FFFF FFFF CCCC CCCC SSSS SSSS RRRR LLLL
|
||||
*
|
||||
* L (bit 03-00) Layer ID
|
||||
* R (bit 07-04) reserved (0)
|
||||
* R (bit 06-04) reserved (0)
|
||||
* U (bit 07) user device id
|
||||
* S (bit 15-08) Stack ID/controller number
|
||||
* C (bit 23-16) Child/Clone ID
|
||||
* F (bit 31-24) Flags as defined below
|
||||
|
@ -480,6 +481,7 @@
|
|||
#define LAYER_ID_INC 0x00000001
|
||||
#define LAYER_ID_MAX MAX_LAYER_NR
|
||||
#define LAYER_ID_MASK 0x0000000F
|
||||
#define FLG_ID_USER 0x00000080
|
||||
#define INST_ID_MASK 0x70FFFFFF
|
||||
|
||||
#define DUMMY_CR_FLAG 0x7FFFFF00
|
||||
|
@ -496,7 +498,7 @@
|
|||
#define CHANNEL_EXT_PCM 0x01000000
|
||||
#define CHANNEL_EXT_REV 0x02000000
|
||||
|
||||
/* interface extentions */
|
||||
/* instance/stack extentions */
|
||||
#define EXT_STACK_CLONE 0x00000001
|
||||
#define EXT_INST_CLONE 0x00000100
|
||||
#define EXT_INST_MGR 0x00000200
|
||||
|
@ -578,6 +580,8 @@ typedef struct _stack_info {
|
|||
mISDN_stPara_t para;
|
||||
u_int extentions;
|
||||
u_int mgr;
|
||||
u_int master;
|
||||
u_int clone;
|
||||
int instcnt;
|
||||
int inst[MAX_LAYER_NR +1];
|
||||
int childcnt;
|
||||
|
@ -590,6 +594,8 @@ typedef struct _layer_info {
|
|||
int extentions;
|
||||
u_int id;
|
||||
u_int st;
|
||||
u_int clone;
|
||||
u_int parent;
|
||||
mISDN_pid_t pid;
|
||||
} layer_info_t;
|
||||
|
||||
|
|
|
@ -270,7 +270,9 @@ extern int mISDN_get_layerid(int fid, int stack, int layer);
|
|||
* l_info - info for the layer
|
||||
*
|
||||
* return:
|
||||
* layer id or negativ error code
|
||||
* 0 on success or error code
|
||||
* l_info->id the id of the new layer
|
||||
* l_info->clone the id of a cloned layer
|
||||
*
|
||||
*/
|
||||
extern int mISDN_new_layer(int fid, layer_info_t *l_info);
|
||||
|
@ -322,6 +324,20 @@ extern int mISDN_get_setstack_ind(int fid, u_int lid);
|
|||
*/
|
||||
extern int mISDN_get_layer_info(int fid, int lid, void *info, size_t max_len);
|
||||
|
||||
/* mISDNprint_layer_info(FILE *file, layer_info_t *l_info)
|
||||
*
|
||||
* print out the layer_info in readable output
|
||||
*
|
||||
* parameter:
|
||||
* file - stream to print to
|
||||
* l_info - layer_info
|
||||
*
|
||||
* return:
|
||||
* nothing
|
||||
*
|
||||
*/
|
||||
extern void mISDNprint_layer_info(FILE *file, layer_info_t *l_info);
|
||||
|
||||
/* mISDN_get_interface_info(int fid, interface_info_t *i_info)
|
||||
*
|
||||
* get the info about ISDN layer interface
|
||||
|
|
27
lib/layer.c
27
lib/layer.c
|
@ -37,6 +37,7 @@ mISDN_new_layer(int fid, layer_info_t *l_info)
|
|||
unsigned char buf[sizeof(layer_info_t) + mISDN_HEADER_LEN];
|
||||
iframe_t *ifr = (iframe_t *)buf;
|
||||
int ret;
|
||||
u_int *ip;
|
||||
|
||||
set_wrrd_atomic(fid);
|
||||
ret = mISDN_write_frame(fid, buf, 0, MGR_NEWLAYER | REQUEST,
|
||||
|
@ -52,13 +53,17 @@ mISDN_new_layer(int fid, layer_info_t *l_info)
|
|||
// fprintf(stderr, "%s: rret %d\n", __FUNCTION__, ret);
|
||||
if (ret<0)
|
||||
return(ret);
|
||||
if (ret < (mISDN_HEADER_LEN + sizeof(int))) {
|
||||
if (ret < (mISDN_HEADER_LEN + 2*sizeof(int))) {
|
||||
if (ret == mISDN_HEADER_LEN)
|
||||
ret = ifr->len;
|
||||
else if (ret>0)
|
||||
ret = -EINVAL;
|
||||
} else
|
||||
ret = ifr->data.i;
|
||||
} else {
|
||||
ret = 0;
|
||||
ip = &ifr->data.p;
|
||||
l_info->id = *ip++;
|
||||
l_info->clone = *ip;
|
||||
}
|
||||
// fprintf(stderr, "%s: ret %x\n", __FUNCTION__, ret);
|
||||
return(ret);
|
||||
}
|
||||
|
@ -183,6 +188,22 @@ mISDN_get_layer_info(int fid, int lid, void *info, size_t max_len)
|
|||
return(ret);
|
||||
}
|
||||
|
||||
void
|
||||
mISDNprint_layer_info(FILE *file, layer_info_t *l_info)
|
||||
{
|
||||
int i;
|
||||
|
||||
fprintf(file, "instance id %08x\n", l_info->id);
|
||||
fprintf(file, " name %s\n", l_info->name);
|
||||
fprintf(file, " obj %08x\n", l_info->object_id);
|
||||
fprintf(file, " ext %08x\n", l_info->extentions);
|
||||
fprintf(file, " stack %08x\n", l_info->st);
|
||||
fprintf(file, " clone %08x\n", l_info->clone);
|
||||
fprintf(file, " parent %08x\n", l_info->parent);
|
||||
for(i=0;i<=MAX_LAYER_NR;i++)
|
||||
fprintf(file, " prot%d %08x\n", i, l_info->pid.protocol[i]);
|
||||
}
|
||||
|
||||
#ifdef OBSOLATE
|
||||
int
|
||||
mISDN_get_interface_info(int fid, interface_info_t *i_info)
|
||||
|
|
|
@ -138,6 +138,8 @@ mISDNprint_stack_info(FILE *file, stack_info_t *s_info)
|
|||
for(i=0;i<s_info->instcnt;i++)
|
||||
fprintf(file, " inst%d %08x\n", i, s_info->inst[i]);
|
||||
fprintf(file, " mgr %08x\n", s_info->mgr);
|
||||
fprintf(file, " master %08x\n", s_info->master);
|
||||
fprintf(file, " clone %08x\n", s_info->clone);
|
||||
for(i=0;i<s_info->childcnt;i++)
|
||||
fprintf(file, " child%d %08x\n", i, s_info->child[i]);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue