From 7a4f7826927ce3948dbfd7e0dbcf070f660cae11 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 3 Apr 2017 16:25:49 +0200 Subject: Replace unused m3ua_types.h with protocol/m3ua.h This is more in line with what we do for SUA in protocol/sua.h Change-Id: I4a32cb698d28b4ccff9280b8512557ab5a353fe3 --- include/osmocom/sigtran/Makefile.am | 4 +- include/osmocom/sigtran/m3ua_types.h | 128 --------------------------- include/osmocom/sigtran/protocol/m3ua.h | 147 ++++++++++++++++++++++++++++++++ 3 files changed, 149 insertions(+), 130 deletions(-) delete mode 100644 include/osmocom/sigtran/m3ua_types.h create mode 100644 include/osmocom/sigtran/protocol/m3ua.h (limited to 'include/osmocom/sigtran') diff --git a/include/osmocom/sigtran/Makefile.am b/include/osmocom/sigtran/Makefile.am index e168256..ca7de0f 100644 --- a/include/osmocom/sigtran/Makefile.am +++ b/include/osmocom/sigtran/Makefile.am @@ -1,7 +1,7 @@ -sigtran_HEADERS = m3ua_types.h xua_types.h xua_msg.h m2ua_types.h sccp_sap.h \ +sigtran_HEADERS = xua_types.h xua_msg.h m2ua_types.h sccp_sap.h \ sua.h sigtran_sap.h sccp_helpers.h sigtrandir = $(includedir)/osmocom/sigtran -sigtran_prot_HEADERS = protocol/sua.h +sigtran_prot_HEADERS = protocol/sua.h protocol/m3ua.h sigtran_protdir = $(includedir)/osmocom/sigtran/protocol diff --git a/include/osmocom/sigtran/m3ua_types.h b/include/osmocom/sigtran/m3ua_types.h deleted file mode 100644 index c8e62b4..0000000 --- a/include/osmocom/sigtran/m3ua_types.h +++ /dev/null @@ -1,128 +0,0 @@ -#pragma once - -/** - * Types found in the M3UA RFC 4666 - */ - -#include - - -#define M3UA_VERSION 1 - -enum { - M3UA_CLS_MGMT, /* Management (MGMT) Message [IUA/M2UA/M3UA/SUA] */ - M3UA_CLS_TRANS, /* Transfer Messages [M3UA] */ - M3UA_CLS_SSNM, /* SS7 Signalling Network Management (SSNM) Messages [M3UA/SUA] */ - M3UA_CLS_ASPSM, /* ASP State Maintenance (ASPSM) Messages [IUA/M2UA/M3UA/SUA] */ - M3UA_CLS_ASPTM, /* ASP Traffic Maintenance (ASPTM) Messages [IUA/M2UA/M3UA/SUA] */ - M3UA_CLS_RESERVED1, /* Reserved for Other SIGTRAN Adaptation Layers */ - M3UA_CLS_RESERVED2, /* Reserved for Other SIGTRAN Adaptation Layers */ - M3UA_CLS_RESERVED3, /* Reserved for Other SIGTRAN Adaptation Layers */ - M3UA_CLS_RESERVED4, /* Reserved for Other SIGTRAN Adaptation Layers */ - M3UA_CLS_RKM, /* Routing Key Management (RKM) Messages (M3UA) */ -}; - -/** - * Management (MGMT) messages - */ -enum { - M3UA_MGMT_ERROR, /* Error (ERR) */ - M3UA_MGMT_NTFY, /* Notify (NTFY) */ -}; - -/** - * Transfer Messages - */ -enum { - M3UA_TRANS_RESERVED, /* Reserved */ - M3UA_TRANS_DATA, /* Payload Data (DATA) */ -}; - -/** - * SS7 Signalling Network Management (SSNM) Messages - */ -enum { - M3UA_SSNM_RESERVED, /* Reserved */ - M3UA_SSNM_DUNA, /* Destination Unavailable (DUNA) */ - M3UA_SSNM_DAVA, /* Destination Available (DAVA) */ - M3UA_SSNM_DAUD, /* Destination State Audit (DAUD) */ - M3UA_SSNM_SCON, /* Signalling Congestion (SCON) */ - M3UA_SSNM_DUPU, /* Destination User Part Unavailable (DUPU) */ - M3UA_SSNM_DRST, /* Destination Restricted (DRST) */ -}; - -/** - * Application Server Process State Maintaenance (ASPSM) messages - */ -enum { - M3UA_ASPSM_RESERVED, /* Reserved */ - M3UA_ASPSM_UP, /* ASP Up (UP) */ - M3UA_ASPSM_DOWN, /* ASP Down (DOWN) */ - M3UA_ASPSM_BEAT, /* Heartbeat (BEAT) */ - M3UA_ASPSM_UP_ACK, /* ASP Up Ack (UP ACK) */ - M3UA_ASPSM_DOWN_ACK, /* ASP Down Ack (DOWN ACK) */ - M3UA_ASPSM_BEAT_ACK, /* Heartbeat Ack (BEAT ACK) */ -}; - -/** - * Application Server Process Traffic Maintaenance (ASPTM) messages. - */ -enum { - M3UA_ASPTM_RESERVED, /* Reserved */ - M3UA_ASPTM_ACTIV, /* ASP Active (ACTIVE) */ - M3UA_ASPTM_INACTIV, /* ASP Inactive (INACTIVE) */ - M3UA_ASPTM_ACTIV_ACK, /* ASP Active Ack (ACTIVE ACK) */ - M3UA_ASPTM_INACTIV_ACK, /* ASP Inactive Ack (INACTIVE ACK) */ -}; - -/** - * Routing Key Management (RKM) Messages - */ -enum { - M3UA_RKM_RESERVED, /* Reserved */ - M3UA_RKM_REG_REQ, /* Registration Request (REG REQ) */ - M3UA_RKM_REG_RSP, /* Registration Response (REG RSP) */ - M3UA_RKM_DEREG_REQ, /* Deregistration Request (DEREG REQ) */ - M3UA_RKM_DEREG_RSP, /* Deregistration Response (DEREG RSP) */ -}; - -/** - * Tag Values for M3UA - */ -enum { - M3UA_TAG_NET_APPEAR = 0x0200, /* Network Appearance */ - M3UA_TAG_RESERVED1, /* Reserved */ - M3UA_TAG_RESERVED2, /* Reserved */ - M3UA_TAG_RESERVED3, /* Reserved */ - M3UA_TAG_USER_CAUSE, /* User/Cause */ - M3UA_TAG_CONGEST_IND, /* Congestion Indications */ - M3UA_TAG_CONCERN_DEST, /* Concerned Destination */ - M3UA_TAG_ROUTING_KEY, /* Routing Key */ - M3UA_TAG_REG_RESULT, /* Registration Result */ - M3UA_TAG_DEREG_RESULT, /* Deregistration Result */ - M3UA_TAG_LOCAL_ROUT_KEY_IDENT, /* Local Routing Key Identifier */ - M3UA_TAG_DEST_PC, /* Destination Point Code */ - M3UA_TAG_SERV_IND, /* Service Indicators */ - M3UA_TAG_RESERVED4, /* Reserved */ - M3UA_TAG_ORIG_PC_LIST, /* Originating Point Code List */ - M3UA_TAG_RESERVED5, /* Reserved */ - M3UA_TAG_PROTO_DATA, /* Protocol Data */ - M3UA_TAG_RESERVED6, /* Reserved */ - M3UA_TAG_REG_STATUS, /* Registration Status */ - M3UA_TAG_DEREG_STATUS, /* Deregistration Status */ -}; - - -/** - * Protocol data for transport messages. This is - * replacing the MTP L3 header - */ -struct m3ua_protocol_data { - uint32_t opc; - uint32_t dpc; - uint8_t si; - uint8_t ni; - uint8_t mp; - uint8_t sls; - uint8_t data[0]; -} __attribute__((packed)); diff --git a/include/osmocom/sigtran/protocol/m3ua.h b/include/osmocom/sigtran/protocol/m3ua.h new file mode 100644 index 0000000..43d18c5 --- /dev/null +++ b/include/osmocom/sigtran/protocol/m3ua.h @@ -0,0 +1,147 @@ +/* RFC 4666 M3UA SCCP User Adaption */ + +/* (C) 2017 by Harald Welte + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once +#include + +#define M3UA_VERSION 1 +#define M3UA_PPID 3 +#define M3UA_PORT 2905 + +/* 3.1.2 Message Classes */ +#define M3UA_MSGC_MGMT 0 +#define M3UA_MSGC_XFER 1 +#define M3UA_MSGC_SNM 2 +#define M3UA_MSGC_ASPSM 3 +#define M3UA_MSGC_ASPTM 4 +#define M3UA_MSGC_RKM 9 + +/* 3.1.3 Message Types */ +#define M3UA_MGMT_ERR 0 +#define M3UA_MGMT_NTFY 1 + +#define M3UA_XFER_DATA 1 + +#define M3UA_SNM_DUNA 1 +#define M3UA_SNM_DAVA 2 +#define M3UA_SNM_DAUD 3 +#define M3UA_SNM_SCON 4 +#define M3UA_SNM_DUPU 5 +#define M3UA_SNM_DRST 6 + +#define M3UA_ASPSM_UP 1 +#define M3UA_ASPSM_DOWN 2 +#define M3UA_ASPSM_BEAT 3 +#define M3UA_ASPSM_UP_ACK 4 +#define M3UA_ASPSM_DOWN_ACK 5 +#define M3UA_ASPSM_BEAT_ACK 6 + +#define M3UA_ASPTM_ACTIVE 1 +#define M3UA_ASPTM_INACTIVE 2 +#define M3UA_ASPTM_ACTIVE_ACK 3 +#define M3UA_ASPTM_INACTIVE_ACK 4 + +#define M3UA_RKM_REG_REQ 1 +#define M3UA_RKM_REG_RSP 2 +#define M3UA_RKM_DEREG_REQ 3 +#define M3UA_RKM_DEREG_RSP 4 + +#define M3UA_IEI_INFO_STRING 0x0004 +#define M3UA_IEI_ROUTE_CTX 0x0006 +#define M3UA_IEI_DIAG_INFO 0x0007 +#define M3UA_IEI_HEARDBT_DATA 0x0009 +#define M3UA_IEI_TRAF_MODE_TYP 0x000b +#define M3UA_IEI_ERR_CODE 0x000c +#define M3UA_IEI_STATUS 0x000d +#define M3UA_IEI_ASP_ID 0x0011 +#define M3UA_IEI_AFFECTED_PC 0x0012 +#define M3UA_IEI_CORR_ID 0x0013 + +/* 3.2 M3UA specific parameters */ + +#define M3UA_IEI_NET_APPEAR 0x0200 +#define M3UA_IEI_USER_CAUSE 0x0204 +#define M3UA_IEI_CONG_IND 0x0205 +#define M3UA_IEI_CONC_DEST 0x0206 +#define M3UA_IEI_ROUT_KEY 0x0207 +#define M3UA_IEI_REG_RESULT 0x0208 +#define M3UA_IEI_DEREG_RESULT 0x0209 +#define M3UA_IEI_LOC_RKEY_ID 0x020a +#define M3UA_IEI_DEST_PC 0x020b +#define M3UA_IEI_SVC_IND 0x020c +#define M3UA_IEI_ORIG_PC 0x020e +#define M3UA_IEI_PROT_DATA 0x0210 +#define M3UA_IEI_REG_STATUS 0x0212 +#define M3UA_IEI_DEREG_STATUS 0x0213 + +/* 3.3.1 Payload Data Message */ +struct m3ua_data_hdr { + uint32_t opc; /* Originating Point Code */ + uint32_t dpc; /* Destination Point Code */ + uint8_t si; /* Service Indicator */ + uint8_t ni; /* Network Indicator */ + uint8_t mp; /* Message Priority */ + uint8_t sls; /* Signalling Link Selection */ +} __attribute__ ((packed)); + +/* 3.8.2 Notify */ + +#define M3UA_NOTIFY(type, info) ((info) << 16 | (type)) +#define M3UA_NOTIFY_T_STATCHG 1 +#define M3UA_NOTIFY_T_OTHER 2 + +#define M3UA_NOTIFY_I_RESERVED 1 +#define M3UA_NOTIFY_I_AS_INACT 2 +#define M3UA_NOTIFY_I_AS_ACT 3 +#define M3UA_NOTIFY_I_AS_PEND 4 + +#define M3UA_NOTIFY_I_OT_INS_RES 1 +#define M3UA_NOTIFY_I_OT_ALT_ASP_ACT 2 +#define M3UA_NOTIFY_I_OT_ASP_FAILURE 3 + +/* 3.8.1 Error */ +enum m3ua_error_code { + M3UA_ERR_INVALID_VERSION = 0x01, + /* not used in M3UA */ + M3UA_ERR_UNSUPP_MSG_CLASS = 0x03, + M3UA_ERR_UNSUPP_MSG_TYPE = 0x04, + M3UA_ERR_UNSUPP_TRAF_MOD_TYP = 0x05, + M3UA_ERR_UNEXPECTED_MSG = 0x06, + M3UA_ERR_PROTOCOL_ERR = 0x07, + /* not used in M3UA */ + M3UA_ERR_INVAL_STREAM_ID = 0x09, + /* not used in M3UA */ + /* not used in M3UA */ + /* not used in M3UA */ + M3UA_ERR_REFUSED_MGMT_BLOCKING = 0x0d, + M3UA_ERR_ASP_ID_REQD = 0x0e, + M3UA_ERR_INVAL_ASP_ID = 0x0f, + /* not used in M3UA */ + M3UA_ERR_INVAL_PARAM_VAL = 0x11, + M3UA_ERR_PARAM_FIELD_ERR = 0x12, + M3UA_ERR_UNEXP_PARAM = 0x13, + M3UA_ERR_DEST_STATUS_UNKN = 0x14, + M3UA_ERR_INVAL_NET_APPEAR = 0x15, + M3UA_ERR_MISSING_PARAM = 0x16, + /* not used in M3UA */ + /* not used in M3UA */ + M3UA_ERR_INVAL_ROUT_CTX = 0x19, + M3UA_ERR_NO_CONFGD_AS_FOR_ASP = 0x1a, +}; -- cgit v1.2.3