[asterisk-commits] tilghman: branch group/issue10217 r204982 - /team/group/issue10217/channels/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jul 6 15:17:55 CDT 2009
Author: tilghman
Date: Mon Jul 6 15:17:51 2009
New Revision: 204982
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=204982
Log:
Complete decode of all layers
Modified:
team/group/issue10217/channels/chan_dahdi.c
Modified: team/group/issue10217/channels/chan_dahdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/issue10217/channels/chan_dahdi.c?view=diff&rev=204982&r1=204981&r2=204982
==============================================================================
--- team/group/issue10217/channels/chan_dahdi.c (original)
+++ team/group/issue10217/channels/chan_dahdi.c Mon Jul 6 15:17:51 2009
@@ -1552,16 +1552,16 @@
char rate[12];
snprintf(rate, sizeof(rate), "%d", llc->llc[recnum].transmultiplier);
value = rate;
- } else if (!strcasecmp(args.name, "layer1proto")) {
- const char *proto[32] = { "", "V.110", "G.711u", "G.711a", "G.721", "H.221", "H.223", "NON-ITU",
- "V.120", "X.31", };
- value = proto[llc->llc[recnum].layer1proto];
} else if (!strncasecmp(args.name, "layer1.", 7)) {
/* LAYER 1 SUBSET */
char *subset = args.name + 7;
int proto = llc->llc[recnum].layer1proto;
- if (!strcasecmp(subset, "async")) {
+ if (!strcasecmp(subset, "proto")) {
+ const char *proto[32] = { "", "V.110", "G.711u", "G.711a", "G.721", "H.221", "H.223", "NON-ITU",
+ "V.120", "X.31", };
+ value = proto[llc->llc[recnum].layer1proto];
+ } else if (!strcasecmp(subset, "async")) {
value = llc->llc[recnum].layer1.async ? "1" : "0";
} else if (!strcasecmp(subset, "inband")) {
value = llc->llc[recnum].layer1.negot ? "1" : "0";
@@ -1571,11 +1571,125 @@
"64K", "", "57.6K", "28.8K", "24K", "0.1345K", "0.100K", "0.075/1.2K",
"1.2/0.075K", "0.050K", "0.075K", "0.110K", "0.150K", "0.200K", "0.300K", "12K" };
value = rate[llc->llc[recnum].layer1.userrate];
+
+ /* V.110, I.460, X.30 subsets */
} else if (!strcasecmp(subset, "interrate")) {
const char *rate[4] = { "UNSPEC", "8K", "16K", "32K" };
- } /* TODO Remaining layer 1 subset */
- } /* TODO Layers 2 and 3 subsets */
- ast_str_set(buf, len, "%s", value);
+ value = rate[llc->llc[recnum].layer1.interrate];
+ } else if (!strcasecmp(subset, "nicontx")) {
+ value = llc->llc[recnum].layer1.nicontx ? "1" : "0";
+ } else if (!strcasecmp(subset, "niconrx")) {
+ value = llc->llc[recnum].layer1.niconrx ? "1" : "0";
+ } else if (!strcasecmp(subset, "flowontx")) {
+ value = llc->llc[recnum].layer1.flowontx ? "1" : "0";
+ } else if (!strcasecmp(subset, "flowonrx")) {
+ value = llc->llc[recnum].layer1.flowonrx ? "1" : "0";
+
+ /* V.120 subset only */
+ } else if (!strcasecmp(subset, "header")) {
+ value = llc->llc[recnum].layer1.header ? "1" : "0";
+ } else if (!strcasecmp(subset, "multiframe")) {
+ value = llc->llc[recnum].layer1.multiframe ? "1" : "0";
+ } else if (!strcasecmp(subset, "mode")) {
+ value = llc->llc[recnum].layer1.multiframe ? "PROTO" : "TRANSPARENT";
+ } else if (!strcasecmp(subset, "negotlli")) {
+ value = llc->llc[recnum].layer1.negotlli ? "1" : "0";
+ } else if (!strcasecmp(subset, "assignor")) {
+ value = llc->llc[recnum].layer1.assignor ? "1" : "0";
+ } else if (!strcasecmp(subset, "inbandnegot")) {
+ value = llc->llc[recnum].layer1.inbandnegot ? "1" : "0";
+
+ } else if (!strcasecmp(subset, "stopbits")) {
+ const char *rate[4] = { "0", "1", "1.5", "2" };
+ value = rate[llc->llc[recnum].layer1.stopbits];
+ } else if (!strcasecmp(subset, "databits")) {
+ const char *rate[4] = { "UNSPEC", "5", "7", "8" };
+ value = rate[llc->llc[recnum].layer1.databits];
+ } else if (!strcasecmp(subset, "parity")) {
+ const char *rate[8] = { "ODD", "", "EVEN", "NONE", "FORCE0", "FORCE1", "", "" };
+ value = rate[llc->llc[recnum].layer1.parity];
+ } else if (!strcasecmp(subset, "duplex")) {
+ value = llc->llc[recnum].layer1.duplex ? "FULL" : "HALF";
+ } else if (!strcasecmp(subset, "modemtype")) {
+ const char *rate[128] = { "NATIONAL-0", "NATIONAL-1", "NATIONAL-2", "NATIONAL-3", "NATIONAL-4", "NATIONAL-5", "", "",
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "",
+ "", "V.21", "V.22", "V.22bis", "V.23", "V.26", "V.26bis", "V.26ter",
+ "V.27", "V.27bis", "V.27ter", "V.29", "V.32", "", "V.34", "",
+ "NATIONAL-64", "NATIONAL-65", "NATIONAL-66", "NATIONAL-67", "NATIONAL-68", "NATIONAL-69", "NATIONAL-70", "NATIONAL-71",
+ "NATIONAL-72", "NATIONAL-73", "NATIONAL-74", "NATIONAL-75", "NATIONAL-76", "NATIONAL-77", "NATIONAL-78", "NATIONAL-79",
+ "NATIONAL-80", "NATIONAL-81", "NATIONAL-82", "NATIONAL-83", "NATIONAL-84", "NATIONAL-85", "NATIONAL-86", "NATIONAL-87",
+ "NATIONAL-88", "NATIONAL-89", "NATIONAL-90", "NATIONAL-91", "NATIONAL-92", "NATIONAL-93", "NATIONAL-94", "NATIONAL-95",
+ "USER-96", "USER-97", "USER-98", "USER-99", "USER-100", "USER-101", "USER-102", "USER-103",
+ "USER-104", "USER-105", "USER-106", "USER-107", "USER-108", "USER-109", "USER-110", "USER-111",
+ "USER-112", "USER-113", "USER-114", "USER-115", "USER-116", "USER-117", "USER-118", "USER-119",
+ "USER-120", "USER-121", "USER-122", "USER-123", "USER-124", "USER-125", "USER-126", "USER-127" };
+ value = rate[llc->llc[recnum].layer1.modemtype];
+ }
+ } else if (!strncasecmp(args.name, "layer2.", 7)) {
+ /* LAYER 2 SUBSET */
+ char *subset = args.name + 7;
+ int proto = llc->llc[recnum].layer2proto;
+
+ if (!strcasecmp(subset, "proto")) {
+ const char *protos[32] = { "", "ISO_1745", "Q.921", "", "", "", "X.25", "X.25_MULTILINK",
+ "EXTENDED_LAPB", "HDLC_ARM", "HDLC_NRM", "HDLC_ABM", "LAN_LOGICAL", "X.75", "Q.922", "Q.922_CORE",
+ "USERSPEC", "DTE_DCE", };
+ value = protos[llc->llc[recnum].layer2proto];
+ } else if (!strcasecmp(subset, "mode")) {
+ const char *modes[4] = { "", "NORMAL", "EXTENDED", "" };
+ value = modes[llc->llc[recnum].layer2.mode];
+ } else if (!strcasecmp(subset, "q933")) {
+ char buffer[2];
+ snprintf(buffer, sizeof(buffer), "%d", llc->llc[recnum].layer2.q933);
+ value = buffer;
+ } else if (!strcasecmp(subset, "windowsize")) {
+ char buffer[4];
+ snprintf(buffer, sizeof(buffer), "%d", llc->llc[recnum].layer2.windowsize);
+ value = buffer;
+ } else if (!strcasecmp(subset, "userproto")) {
+ char buffer[4];
+ snprintf(buffer, sizeof(buffer), "%d", llc->llc[recnum].layer2.userproto);
+ value = buffer;
+ } /* END LAYER 2 SUBSET */
+ } else if (!strncasecmp(args.name, "layer3.", 7)) {
+ /* LAYER 3 SUBSET */
+ char *subset = args.name + 7;
+ int proto = llc->llc[recnum].layer3proto;
+
+ if (!strcasecmp(subset, "proto")) {
+ const char *protos[32] = { "", "", "Q.931", "", "", "", "X.25", "X.25_DTE",
+ "X223", "OSI_CONNECTIONLESS", "T.70", "NET_LAYER", "", "", "", "",
+ "USERSPEC", };
+ value = protos[llc->llc[recnum].layer3proto];
+ } else if (!strcasecmp(subset, "mode")) {
+ const char *modes[4] = { "", "NORMAL", "EXTENDED", "" };
+ value = modes[llc->llc[recnum].layer3.mode];
+ } else if (!strcasecmp(subset, "packetsize")) {
+ const char *sizes[16] = { "", "", "", "", "16", "32", "64", "128",
+ "256", "512", "1024", "2048", "4096", };
+ value = sizes[llc->llc[recnum].layer3.packetsize];
+ } else if (!strcasecmp(subset, "windowsize")) {
+ char buffer[4];
+ snprintf(buffer, sizeof(buffer), "%d", llc->llc[recnum].layer3.windowsize);
+ value = buffer;
+ } else if (!strcasecmp(subset, "optional")) {
+ char buffer[4];
+ snprintf(buffer, sizeof(buffer), "%d", llc->llc[recnum].layer3.optional);
+ value = buffer;
+ } else if (!strcasecmp(subset, "info")) {
+ value = "";
+ if (llc->llc[recnum].layer3.infomsb == 0xc) {
+ if (llc->llc[recnum].layer3.infolsb == 0xc) {
+ value = "IP";
+ } else if (llc->llc[recnum].layer3.infolsb == 0xf) {
+ value = "PPP";
+ }
+ }
+ } /* END LAYER 3 SUBSET */
+ }
+ ast_str_set(buf, len, "%s", S_OR(value, ""));
return 0;
}
More information about the asterisk-commits
mailing list