22 unsigned char buff[1025];
23 iframe_t *frm = (iframe_t *)buff;
28 if ((device = mISDN_open()) < 0)
30 fprintf(stderr,
"mISDN_open() failed: ret=%d errno=%d (%s) Check for mISDN modules and device.\n", device,
errno, strerror(
errno));
36 ii = mISDN_get_stack_count(device);
40 printf(
"Found no card. Please be sure to load card drivers.\n");
46 err = mISDN_get_stack_info(device, i, buff,
sizeof(buff));
49 fprintf(stderr,
"mISDN_get_stack_info() failed: port=%d err=%d\n", i, err);
52 stinf = (stack_info_t *)&frm->data.p;
58 printf(
"Port %2d: ", i);
59 switch(stinf->pid.protocol[0] & ~ISDN_PID_FEATURE_MASK)
61 case ISDN_PID_L0_TE_S0:
62 printf(
"TE-mode BRI S/T interface line (for phone lines)");
64 if (stinf->pid.protocol[0] & ISDN_PID_L0_TE_S0_HFC & ISDN_PID_FEATURE_MASK)
65 printf(
" HFC multiport card");
68 case ISDN_PID_L0_NT_S0:
70 printf(
"NT-mode BRI S/T interface port (for phones)");
72 if (stinf->pid.protocol[0] & ISDN_PID_L0_NT_S0_HFC & ISDN_PID_FEATURE_MASK)
73 printf(
" HFC multiport card");
76 case ISDN_PID_L0_TE_U:
77 printf(
"TE-mode BRI U interface line");
79 case ISDN_PID_L0_NT_U:
81 printf(
"NT-mode BRI U interface port");
83 case ISDN_PID_L0_TE_UP2:
84 printf(
"TE-mode BRI Up2 interface line");
86 case ISDN_PID_L0_NT_UP2:
88 printf(
"NT-mode BRI Up2 interface port");
90 case ISDN_PID_L0_TE_E1:
92 printf(
"TE-mode PRI E1 interface line (for phone lines)");
94 if (stinf->pid.protocol[0] & ISDN_PID_L0_TE_E1_HFC & ISDN_PID_FEATURE_MASK)
95 printf(
" HFC-E1 card");
98 case ISDN_PID_L0_NT_E1:
101 printf(
"NT-mode PRI E1 interface port (for phones)");
103 if (stinf->pid.protocol[0] & ISDN_PID_L0_NT_E1_HFC & ISDN_PID_FEATURE_MASK)
104 printf(
" HFC-E1 card");
109 printf(
"unknown type 0x%08x",stinf->pid.protocol[0]);
115 if (stinf->pid.protocol[1] == 0)
118 printf(
" -> Missing layer 1 NT-mode protocol.\n");
121 while(p <= MAX_LAYER_NR) {
122 if (stinf->pid.protocol[p])
125 printf(
" -> Layer %d protocol 0x%08x is detected, but not allowed for NT lib.\n", p, stinf->pid.protocol[p]);
132 printf(
" -> Interface is Point-To-Point (PRI).\n");
134 printf(
" -> Interface can be Poin-To-Point/Multipoint.\n");
138 if (stinf->pid.protocol[1] == 0)
141 printf(
" -> Missing layer 1 protocol.\n");
143 if (stinf->pid.protocol[2] == 0)
146 printf(
" -> Missing layer 2 protocol.\n");
148 if (stinf->pid.protocol[2] & ISDN_PID_L2_DF_PTP)
150 printf(
" -> Interface is Poin-To-Point.\n");
152 if (stinf->pid.protocol[3] == 0)
155 printf(
" -> Missing layer 3 protocol.\n");
158 printf(
" -> Protocol: ");
159 switch(stinf->pid.protocol[3] & ~ISDN_PID_FEATURE_MASK)
161 case ISDN_PID_L3_DSS1USER:
162 printf(
"DSS1 (Euro ISDN)");
167 printf(
"unknown protocol 0x%08x",stinf->pid.protocol[3]);
172 while(p <= MAX_LAYER_NR) {
173 if (stinf->pid.protocol[p])
176 printf(
" -> Layer %d protocol 0x%08x is detected, but not allowed for TE lib.\n", p, stinf->pid.protocol[p]);
180 printf(
" -> childcnt: %d\n",stinf->childcnt);
184 printf(
" * Port NOT useable for PBX\n");
186 printf(
"--------\n");
193 if ((err = mISDN_close(device)))
195 fprintf(stderr,
"mISDN_close() failed: err=%d '%s'\n", err, strerror(err));
void isdn_port_info(void)
static unsigned char * buff