Keith Whyte has uploaded this change for review. ( 
https://gerrit.osmocom.org/11185


Change subject: mncc: Move definitions to header file
......................................................................

mncc: Move definitions to header file

This commit moves various gsm_mncc_* structs and
the MNCC_* defines from .c file to the header.
This paves the way to remove this duplicated code from the
osmo-sip-connector.

Change-Id: I62bc025369bd9ee9b134e064a8364aa4bd5de16e
---
M include/osmocom/gsm/mncc.h
M src/gsm/mncc.c
2 files changed, 150 insertions(+), 153 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/85/11185/1

diff --git a/include/osmocom/gsm/mncc.h b/include/osmocom/gsm/mncc.h
index 7e7d12c..e314163 100644
--- a/include/osmocom/gsm/mncc.h
+++ b/include/osmocom/gsm/mncc.h
@@ -8,6 +8,83 @@
 #define GSM_MAX_SSVERSION      128
 #define GSM_MAX_USERUSER       128

+#define MNCC_SETUP_REQ         0x0101
+#define MNCC_SETUP_IND         0x0102
+#define MNCC_SETUP_RSP         0x0103
+#define MNCC_SETUP_CNF         0x0104
+#define MNCC_SETUP_COMPL_REQ   0x0105
+#define MNCC_SETUP_COMPL_IND   0x0106
+/* MNCC_REJ_* is perfomed via MNCC_REL_* */
+#define MNCC_CALL_CONF_IND     0x0107
+#define MNCC_CALL_PROC_REQ     0x0108
+#define MNCC_PROGRESS_REQ      0x0109
+#define MNCC_ALERT_REQ         0x010a
+#define MNCC_ALERT_IND         0x010b
+#define MNCC_NOTIFY_REQ                0x010c
+#define MNCC_NOTIFY_IND                0x010d
+#define MNCC_DISC_REQ          0x010e
+#define MNCC_DISC_IND          0x010f
+#define MNCC_REL_REQ           0x0110
+#define MNCC_REL_IND           0x0111
+#define MNCC_REL_CNF           0x0112
+#define MNCC_FACILITY_REQ      0x0113
+#define MNCC_FACILITY_IND      0x0114
+#define MNCC_START_DTMF_IND    0x0115
+#define MNCC_START_DTMF_RSP    0x0116
+#define MNCC_START_DTMF_REJ    0x0117
+#define MNCC_STOP_DTMF_IND     0x0118
+#define MNCC_STOP_DTMF_RSP     0x0119
+#define MNCC_MODIFY_REQ                0x011a
+#define MNCC_MODIFY_IND                0x011b
+#define MNCC_MODIFY_RSP                0x011c
+#define MNCC_MODIFY_CNF                0x011d
+#define MNCC_MODIFY_REJ                0x011e
+#define MNCC_HOLD_IND          0x011f
+#define MNCC_HOLD_CNF          0x0120
+#define MNCC_HOLD_REJ          0x0121
+#define MNCC_RETRIEVE_IND      0x0122
+#define MNCC_RETRIEVE_CNF      0x0123
+#define MNCC_RETRIEVE_REJ      0x0124
+#define MNCC_USERINFO_REQ      0x0125
+#define MNCC_USERINFO_IND      0x0126
+#define MNCC_REJ_REQ           0x0127
+#define MNCC_REJ_IND           0x0128
+
+#define MNCC_BRIDGE            0x0200
+#define MNCC_FRAME_RECV                0x0201
+#define MNCC_FRAME_DROP                0x0202
+#define MNCC_LCHAN_MODIFY      0x0203
+#define MNCC_RTP_CREATE                0x0204
+#define MNCC_RTP_CONNECT       0x0205
+#define MNCC_RTP_FREE          0x0206
+
+#define GSM_TCHF_FRAME         0x0300
+#define GSM_TCHF_FRAME_EFR     0x0301
+#define GSM_TCHH_FRAME         0x0302
+#define GSM_TCH_FRAME_AMR      0x0303
+#define GSM_BAD_FRAME          0x03ff
+
+#define MNCC_SOCKET_HELLO      0x0400
+
+#define GSM_MAX_FACILITY       128
+#define GSM_MAX_SSVERSION      128
+#define GSM_MAX_USERUSER       128
+
+#define        MNCC_F_BEARER_CAP       0x0001
+#define MNCC_F_CALLED          0x0002
+#define MNCC_F_CALLING         0x0004
+#define MNCC_F_REDIRECTING     0x0008
+#define MNCC_F_CONNECTED       0x0010
+#define MNCC_F_CAUSE           0x0020
+#define MNCC_F_USERUSER                0x0040
+#define MNCC_F_PROGRESS                0x0080
+#define MNCC_F_EMERGENCY       0x0100
+#define MNCC_F_FACILITY                0x0200
+#define MNCC_F_SSVERSION       0x0400
+#define MNCC_F_CCCAP           0x0800
+#define MNCC_F_KEYPAD          0x1000
+#define MNCC_F_SIGNAL          0x2000
+
 /* Expanded fields from GSM TS 04.08, Table 10.5.102 */
 struct gsm_mncc_bearer_cap {
        int             transfer;       /* Information Transfer Capability */
@@ -74,6 +151,79 @@
        int             pcp;
 };

+struct gsm_mncc {
+       /* context based information */
+       uint32_t        msg_type;
+       uint32_t        callref;
+
+       /* which fields are present */
+       uint32_t        fields;
+
+       /* data derived informations (MNCC_F_ based) */
+       struct gsm_mncc_bearer_cap      bearer_cap;
+       struct gsm_mncc_number          called;
+       struct gsm_mncc_number          calling;
+       struct gsm_mncc_number          redirecting;
+       struct gsm_mncc_number          connected;
+       struct gsm_mncc_cause           cause;
+       struct gsm_mncc_progress        progress;
+       struct gsm_mncc_useruser        useruser;
+       struct gsm_mncc_facility        facility;
+       struct gsm_mncc_cccap           cccap;
+       struct gsm_mncc_ssversion       ssversion;
+       struct  {
+               int             sup;
+               int             inv;
+       } clir;
+       int             signal;
+
+       /* data derived information, not MNCC_F based */
+       int             keypad;
+       int             more;
+       int             notify; /* 0..127 */
+       int             emergency;
+       char            imsi[16];
+
+       unsigned char   lchan_type;
+       unsigned char   lchan_mode;
+};
+
+struct gsm_data_frame {
+       uint32_t        msg_type;
+       uint32_t        callref;
+       unsigned char   data[0];
+};
+
+#define MNCC_SOCK_VERSION      5
+struct gsm_mncc_hello {
+       uint32_t        msg_type;
+       uint32_t        version;
+
+       /* send the sizes of the structs */
+       uint32_t        mncc_size;
+       uint32_t        data_frame_size;
+
+       /* send some offsets */
+       uint32_t        called_offset;
+       uint32_t        signal_offset;
+       uint32_t        emergency_offset;
+       uint32_t        lchan_type_offset;
+};
+
+struct gsm_mncc_rtp {
+       uint32_t        msg_type;
+       uint32_t        callref;
+       uint32_t        ip;
+       uint16_t        port;
+       uint32_t        payload_type;
+       uint32_t        payload_msg_type;
+};
+
+struct gsm_mncc_bridge {
+       uint32_t        msg_type;
+       uint32_t        callref[2];
+};
+
 enum {
        GSM_MNCC_BCAP_SPEECH    = 0,
        GSM_MNCC_BCAP_UNR_DIG   = 1,
diff --git a/src/gsm/mncc.c b/src/gsm/mncc.c
index 938cf9a..a6c2f73 100644
--- a/src/gsm/mncc.c
+++ b/src/gsm/mncc.c
@@ -34,159 +34,6 @@
 #include <osmocom/core/logging.h>
 #include <osmocom/gsm/mncc.h>

-/* FIXME FIXME FIXME FIXME FIXME START */
-#define MNCC_SETUP_REQ         0x0101
-#define MNCC_SETUP_IND         0x0102
-#define MNCC_SETUP_RSP         0x0103
-#define MNCC_SETUP_CNF         0x0104
-#define MNCC_SETUP_COMPL_REQ   0x0105
-#define MNCC_SETUP_COMPL_IND   0x0106
-/* MNCC_REJ_* is perfomed via MNCC_REL_* */
-#define MNCC_CALL_CONF_IND     0x0107
-#define MNCC_CALL_PROC_REQ     0x0108
-#define MNCC_PROGRESS_REQ      0x0109
-#define MNCC_ALERT_REQ         0x010a
-#define MNCC_ALERT_IND         0x010b
-#define MNCC_NOTIFY_REQ                0x010c
-#define MNCC_NOTIFY_IND                0x010d
-#define MNCC_DISC_REQ          0x010e
-#define MNCC_DISC_IND          0x010f
-#define MNCC_REL_REQ           0x0110
-#define MNCC_REL_IND           0x0111
-#define MNCC_REL_CNF           0x0112
-#define MNCC_FACILITY_REQ      0x0113
-#define MNCC_FACILITY_IND      0x0114
-#define MNCC_START_DTMF_IND    0x0115
-#define MNCC_START_DTMF_RSP    0x0116
-#define MNCC_START_DTMF_REJ    0x0117
-#define MNCC_STOP_DTMF_IND     0x0118
-#define MNCC_STOP_DTMF_RSP     0x0119
-#define MNCC_MODIFY_REQ                0x011a
-#define MNCC_MODIFY_IND                0x011b
-#define MNCC_MODIFY_RSP                0x011c
-#define MNCC_MODIFY_CNF                0x011d
-#define MNCC_MODIFY_REJ                0x011e
-#define MNCC_HOLD_IND          0x011f
-#define MNCC_HOLD_CNF          0x0120
-#define MNCC_HOLD_REJ          0x0121
-#define MNCC_RETRIEVE_IND      0x0122
-#define MNCC_RETRIEVE_CNF      0x0123
-#define MNCC_RETRIEVE_REJ      0x0124
-#define MNCC_USERINFO_REQ      0x0125
-#define MNCC_USERINFO_IND      0x0126
-#define MNCC_REJ_REQ           0x0127
-#define MNCC_REJ_IND           0x0128
-
-#define MNCC_BRIDGE            0x0200
-#define MNCC_FRAME_RECV                0x0201
-#define MNCC_FRAME_DROP                0x0202
-#define MNCC_LCHAN_MODIFY      0x0203
-#define MNCC_RTP_CREATE                0x0204
-#define MNCC_RTP_CONNECT       0x0205
-#define MNCC_RTP_FREE          0x0206
-
-#define GSM_TCHF_FRAME         0x0300
-#define GSM_TCHF_FRAME_EFR     0x0301
-#define GSM_TCHH_FRAME         0x0302
-#define GSM_TCH_FRAME_AMR      0x0303
-#define GSM_BAD_FRAME          0x03ff
-
-#define MNCC_SOCKET_HELLO      0x0400
-
-#define GSM_MAX_FACILITY       128
-#define GSM_MAX_SSVERSION      128
-#define GSM_MAX_USERUSER       128
-
-#define        MNCC_F_BEARER_CAP       0x0001
-#define MNCC_F_CALLED          0x0002
-#define MNCC_F_CALLING         0x0004
-#define MNCC_F_REDIRECTING     0x0008
-#define MNCC_F_CONNECTED       0x0010
-#define MNCC_F_CAUSE           0x0020
-#define MNCC_F_USERUSER                0x0040
-#define MNCC_F_PROGRESS                0x0080
-#define MNCC_F_EMERGENCY       0x0100
-#define MNCC_F_FACILITY                0x0200
-#define MNCC_F_SSVERSION       0x0400
-#define MNCC_F_CCCAP           0x0800
-#define MNCC_F_KEYPAD          0x1000
-#define MNCC_F_SIGNAL          0x2000
-
-struct gsm_mncc {
-       /* context based information */
-       uint32_t        msg_type;
-       uint32_t        callref;
-
-       /* which fields are present */
-       uint32_t        fields;
-
-       /* data derived informations (MNCC_F_ based) */
-       struct gsm_mncc_bearer_cap      bearer_cap;
-       struct gsm_mncc_number          called;
-       struct gsm_mncc_number          calling;
-       struct gsm_mncc_number          redirecting;
-       struct gsm_mncc_number          connected;
-       struct gsm_mncc_cause           cause;
-       struct gsm_mncc_progress        progress;
-       struct gsm_mncc_useruser        useruser;
-       struct gsm_mncc_facility        facility;
-       struct gsm_mncc_cccap           cccap;
-       struct gsm_mncc_ssversion       ssversion;
-       struct  {
-               int             sup;
-               int             inv;
-       } clir;
-       int             signal;
-
-       /* data derived information, not MNCC_F based */
-       int             keypad;
-       int             more;
-       int             notify; /* 0..127 */
-       int             emergency;
-       char            imsi[16];
-
-       unsigned char   lchan_type;
-       unsigned char   lchan_mode;
-};
-
-struct gsm_data_frame {
-       uint32_t        msg_type;
-       uint32_t        callref;
-       unsigned char   data[0];
-};
-
-#define MNCC_SOCK_VERSION      5
-struct gsm_mncc_hello {
-       uint32_t        msg_type;
-       uint32_t        version;
-
-       /* send the sizes of the structs */
-       uint32_t        mncc_size;
-       uint32_t        data_frame_size;
-
-       /* send some offsets */
-       uint32_t        called_offset;
-       uint32_t        signal_offset;
-       uint32_t        emergency_offset;
-       uint32_t        lchan_type_offset;
-};
-
-struct gsm_mncc_rtp {
-       uint32_t        msg_type;
-       uint32_t        callref;
-       uint32_t        ip;
-       uint16_t        port;
-       uint32_t        payload_type;
-       uint32_t        payload_msg_type;
-};
-
-struct gsm_mncc_bridge {
-       uint32_t        msg_type;
-       uint32_t        callref[2];
-};
-
-/* FIXME FIXME FIXME FIXME FIXME END */
-
 const struct value_string osmo_mncc_names[] = {
        { MNCC_SETUP_REQ, "MNCC_SETUP_REQ" },
        { MNCC_SETUP_IND, "MNCC_SETUP_IND" },

--
To view, visit https://gerrit.osmocom.org/11185
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I62bc025369bd9ee9b134e064a8364aa4bd5de16e
Gerrit-Change-Number: 11185
Gerrit-PatchSet: 1
Gerrit-Owner: Keith Whyte <ke...@rhizomatica.org>

Reply via email to