[PATCH] openbsc[master]: V42BIS integration

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

dexter gerrit-no-reply at lists.osmocom.org
Thu Aug 11 12:30:41 UTC 2016


Hello Harald Welte, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/644

to look at the new patch set (#16).

V42BIS integration

The previously committed SPANDSP v42bis implementation has been edited
to function outside the SPANDSP library. Debug printf statements were
changed into DEBUGP statements. Als removed the assembely code
in top_bit().

Change-Id: I689413f2541b6def0625ce6bd96f1f488f05f99d
---
M openbsc/include/openbsc/debug.h
M openbsc/include/openbsc/v42bis.h
R openbsc/include/openbsc/v42bis_private.h
M openbsc/src/gprs/v42bis.c
4 files changed, 20 insertions(+), 21 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/44/644/16

diff --git a/openbsc/include/openbsc/debug.h b/openbsc/include/openbsc/debug.h
index 90ddca5..ca3d4ad 100644
--- a/openbsc/include/openbsc/debug.h
+++ b/openbsc/include/openbsc/debug.h
@@ -37,6 +37,7 @@
 	DGTPHUB,
 	DRANAP,
 	DSUA,
+	DV42BIS,
 	Debug_LastEntry,
 };
 
diff --git a/openbsc/include/openbsc/v42bis.h b/openbsc/include/openbsc/v42bis.h
index f13e5c5..e7592e8 100644
--- a/openbsc/include/openbsc/v42bis.h
+++ b/openbsc/include/openbsc/v42bis.h
@@ -36,6 +36,8 @@
 #if !defined(_SPANDSP_V42BIS_H_)
 #define _SPANDSP_V42BIS_H_
 
+#define SPAN_DECLARE(x) x
+
 #define V42BIS_MAX_BITS         12
 #define V42BIS_MAX_CODEWORDS    4096    /* 2^V42BIS_MAX_BITS */
 #define V42BIS_TABLE_SIZE       5021    /* This should be a prime >(2^V42BIS_MAX_BITS) */
diff --git a/openbsc/include/openbsc/private_v42bis.h b/openbsc/include/openbsc/v42bis_private.h
similarity index 100%
rename from openbsc/include/openbsc/private_v42bis.h
rename to openbsc/include/openbsc/v42bis_private.h
diff --git a/openbsc/src/gprs/v42bis.c b/openbsc/src/gprs/v42bis.c
index 6d38916..de9c2af 100644
--- a/openbsc/src/gprs/v42bis.c
+++ b/openbsc/src/gprs/v42bis.c
@@ -31,9 +31,8 @@
 
 /*! \file */
 
-#if defined(HAVE_CONFIG_H)
-#include "config.h"
-#endif
+#define FALSE 0
+#define TRUE 1
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -44,13 +43,10 @@
 #include <ctype.h>
 #include <assert.h>
 
-#include "spandsp/telephony.h"
-#include "spandsp/logging.h"
-#include "spandsp/bit_operations.h"
-#include "spandsp/v42bis.h"
+#include <openbsc/v42bis.h>
+#include <openbsc/v42bis_private.h>
+#include <openbsc/debug.h>
 
-#include "spandsp/private/logging.h"
-#include "spandsp/private/v42bis.h"
 
 /* Fixed parameters from the spec. */
 #define V42BIS_N3               8   /* Character size (bits) */
@@ -310,7 +306,7 @@
                 {
                     if (ss->transparent)
                     {
-                        printf("Going compressed\n");
+                        DEBUGP(DV42BIS,"Going compressed\n");
                         /* 7.8.1 Transition to compressed mode */
                         /* Switch out of transparent now, between codes. We need to send the octet which did not
                         match, just before switching. */
@@ -332,7 +328,7 @@
                 {
                     if (!ss->transparent)
                     {
-                        printf("Going transparent\n");
+                        DEBUGP(DV42BIS,"Going transparent\n");
                         /* 7.8.2 Transition to transparent mode */
                         /* Switch into transparent now, between codes, and the unmatched octet should
                            go out in transparent mode, just below */
@@ -401,7 +397,7 @@
     {
         if (s->compress.dict[i].parent_code != 0xFFFF)
         {
-            printf("Entry %4x, prior %4x, leaves %d, octet %2x\n", i, s->compress.dict[i].parent_code, s->compress.dict[i].leaves, s->compress.dict[i].node_octet);
+            DEBUGP(DV42BIS,"Entry %4x, prior %4x, leaves %d, octet %2x\n", i, s->compress.dict[i].parent_code, s->compress.dict[i].leaves, s->compress.dict[i].node_octet);
         }
     }
     return 0;
@@ -454,13 +450,13 @@
                 ss->escaped = FALSE;
                 if (code == V42BIS_ECM)
                 {
-                    printf("Hit V42BIS_ECM\n");
+                    DEBUGP(DV42BIS,"Hit V42BIS_ECM\n");
                     ss->transparent = FALSE;
                     code_len = ss->v42bis_parm_c2;
                 }
                 else if (code == V42BIS_EID)
                 {
-                    printf("Hit V42BIS_EID\n");
+                    DEBUGP(DV42BIS,"Hit V42BIS_EID\n");
                     ss->output_buf[ss->output_octet_count++] = ss->escape_code - 1;
                     if (ss->output_octet_count >= ss->max_len - s->v42bis_parm_n7)
                     {
@@ -470,11 +466,11 @@
                 }
                 else if (code == V42BIS_RESET)
                 {
-                    printf("Hit V42BIS_RESET\n");
+                    DEBUGP(DV42BIS,"Hit V42BIS_RESET\n");
                 }
                 else
                 {
-                    printf("Hit V42BIS_???? - %" PRIu32 "\n", code);
+                    DEBUGP(DV42BIS,"Hit V42BIS_???? - %" PRIu32 "\n", code);
                 }
             }
             else if (code == ss->escape_code)
@@ -500,17 +496,17 @@
                 switch (new_code)
                 {
                 case V42BIS_ETM:
-                    printf("Hit V42BIS_ETM\n");
+                    DEBUGP(DV42BIS,"Hit V42BIS_ETM\n");
                     ss->transparent = TRUE;
                     code_len = 8;
                     break;
                 case V42BIS_FLUSH:
-                    printf("Hit V42BIS_FLUSH\n");
+                    DEBUGP(DV42BIS,"Hit V42BIS_FLUSH\n");
                     v42bis_decompress_flush(s);
                     break;
                 case V42BIS_STEPUP:
                     /* We need to increase the codeword size */
-                    printf("Hit V42BIS_STEPUP\n");
+                    DEBUGP(DV42BIS,"Hit V42BIS_STEPUP\n");
                     if (ss->v42bis_parm_c3 >= s->v42bis_parm_n2)
                     {
                         /* Invalid condition */
@@ -547,7 +543,7 @@
             /* Trace back through the octets which form the string, and output them. */
             while (code >= V42BIS_N5)
             {
-if (code > 4095) {printf("Code is 0x%" PRIu32 "\n", code); exit(2);}
+if (code > 4095) {DEBUGP(DV42BIS,"Code is 0x%" PRIu32 "\n", code); exit(2);}
                 *string-- = ss->dict[code].node_octet;
                 code = ss->dict[code].parent_code;
             }
@@ -631,7 +627,7 @@
     {
         if (s->decompress.dict[i].parent_code != 0xFFFF)
         {
-            printf("Entry %4x, prior %4x, leaves %d, octet %2x\n", i, s->decompress.dict[i].parent_code, s->decompress.dict[i].leaves, s->decompress.dict[i].node_octet);
+            DEBUGP(DV42BIS,"Entry %4x, prior %4x, leaves %d, octet %2x\n", i, s->decompress.dict[i].parent_code, s->decompress.dict[i].leaves, s->decompress.dict[i].node_octet);
         }
     }
     return 0;

-- 
To view, visit https://gerrit.osmocom.org/644
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I689413f2541b6def0625ce6bd96f1f488f05f99d
Gerrit-PatchSet: 16
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list