RSPRO: Add new ResetState{Req,Res}
These commands are introduced to enable the server to request the
full reset of all state in a client or bankd. This is particularly
useful in TTCN-3 tests, where we typically want to reset the state
between tests.
Change-Id: I442bab523486bbdf2faa8028f8972cd0af795303
diff --git a/asn1/RSPRO.asn b/asn1/RSPRO.asn
index 65152ec..1b1be6d 100644
--- a/asn1/RSPRO.asn
+++ b/asn1/RSPRO.asn
@@ -308,6 +308,17 @@
...
}
+-- SERVER->*: request reset of all state on peer side
+ResetStateReq ::= SEQUENCE {
+ ...
+}
+
+-- *->SERVER: confirm reset of all state on peer side
+ResetStateRes ::= SEQUENCE {
+ result ResultCode,
+ ...
+}
+
----------------------------------------------------------------------
-- PDU
@@ -328,6 +339,8 @@
configClientBankReq [17] ConfigClientBankReq,
configClientBankRes [18] ConfigClientBankRes,
errorInd [16] ErrorInd,
+ resetStateReq [19] ResetStateReq,
+ resetStateRes [20] ResetStateRes,
-- APDUs etc.
setAtrReq [10] SetAtrReq,
setAtrRes [11] SetAtrRes,
diff --git a/include/osmocom/rspro/Makefile.am b/include/osmocom/rspro/Makefile.am
index 4ffaa32..7549ffb 100644
--- a/include/osmocom/rspro/Makefile.am
+++ b/include/osmocom/rspro/Makefile.am
@@ -31,6 +31,8 @@
PortNumber.h \
RemoveMappingReq.h \
RemoveMappingRes.h \
+ ResetStateReq.h \
+ ResetStateRes.h \
ResultCode.h \
RsproPDU.h \
RsproPDUchoice.h \
diff --git a/include/osmocom/rspro/ResetStateReq.h b/include/osmocom/rspro/ResetStateReq.h
new file mode 100644
index 0000000..b56fe43
--- /dev/null
+++ b/include/osmocom/rspro/ResetStateReq.h
@@ -0,0 +1,39 @@
+/*
+ * Generated by asn1c-0.9.28 (http://lionet.info/asn1c)
+ * From ASN.1 module "RSPRO"
+ * found in "../../asn1/RSPRO.asn"
+ */
+
+#ifndef _ResetStateReq_H_
+#define _ResetStateReq_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <constr_SEQUENCE.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ResetStateReq */
+typedef struct ResetStateReq {
+ /*
+ * This type is extensible,
+ * possible extensions are below.
+ */
+
+ /* Context for parsing across buffer boundaries */
+ asn_struct_ctx_t _asn_ctx;
+} ResetStateReq_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_ResetStateReq;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ResetStateReq_H_ */
+#include <asn_internal.h>
diff --git a/include/osmocom/rspro/ResetStateRes.h b/include/osmocom/rspro/ResetStateRes.h
new file mode 100644
index 0000000..622375e
--- /dev/null
+++ b/include/osmocom/rspro/ResetStateRes.h
@@ -0,0 +1,41 @@
+/*
+ * Generated by asn1c-0.9.28 (http://lionet.info/asn1c)
+ * From ASN.1 module "RSPRO"
+ * found in "../../asn1/RSPRO.asn"
+ */
+
+#ifndef _ResetStateRes_H_
+#define _ResetStateRes_H_
+
+
+#include <asn_application.h>
+
+/* Including external dependencies */
+#include <osmocom/rspro/ResultCode.h>
+#include <constr_SEQUENCE.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ResetStateRes */
+typedef struct ResetStateRes {
+ ResultCode_t result;
+ /*
+ * This type is extensible,
+ * possible extensions are below.
+ */
+
+ /* Context for parsing across buffer boundaries */
+ asn_struct_ctx_t _asn_ctx;
+} ResetStateRes_t;
+
+/* Implementation */
+extern asn_TYPE_descriptor_t asn_DEF_ResetStateRes;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ResetStateRes_H_ */
+#include <asn_internal.h>
diff --git a/include/osmocom/rspro/RsproPDUchoice.h b/include/osmocom/rspro/RsproPDUchoice.h
index d603fa1..ebb2971 100644
--- a/include/osmocom/rspro/RsproPDUchoice.h
+++ b/include/osmocom/rspro/RsproPDUchoice.h
@@ -24,6 +24,8 @@
#include <osmocom/rspro/ConfigClientBankReq.h>
#include <osmocom/rspro/ConfigClientBankRes.h>
#include <osmocom/rspro/ErrorInd.h>
+#include <osmocom/rspro/ResetStateReq.h>
+#include <osmocom/rspro/ResetStateRes.h>
#include <osmocom/rspro/SetAtrReq.h>
#include <osmocom/rspro/SetAtrRes.h>
#include <osmocom/rspro/TpduModemToCard.h>
@@ -52,6 +54,8 @@
RsproPDUchoice_PR_configClientBankReq,
RsproPDUchoice_PR_configClientBankRes,
RsproPDUchoice_PR_errorInd,
+ RsproPDUchoice_PR_resetStateReq,
+ RsproPDUchoice_PR_resetStateRes,
RsproPDUchoice_PR_setAtrReq,
RsproPDUchoice_PR_setAtrRes,
RsproPDUchoice_PR_tpduModemToCard,
@@ -79,6 +83,8 @@
ConfigClientBankReq_t configClientBankReq;
ConfigClientBankRes_t configClientBankRes;
ErrorInd_t errorInd;
+ ResetStateReq_t resetStateReq;
+ ResetStateRes_t resetStateRes;
SetAtrReq_t setAtrReq;
SetAtrRes_t setAtrRes;
TpduModemToCard_t tpduModemToCard;
diff --git a/src/rspro/ConfigClientBankReq.c b/src/rspro/ConfigClientBankReq.c
index f19c9ee..a4cd21e 100644
--- a/src/rspro/ConfigClientBankReq.c
+++ b/src/rspro/ConfigClientBankReq.c
@@ -4,7 +4,7 @@
* found in "../../asn1/RSPRO.asn"
*/
-#include "ConfigClientBankReq.h"
+#include <osmocom/rspro/ConfigClientBankReq.h>
static asn_TYPE_member_t asn_MBR_ConfigClientBankReq_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct ConfigClientBankReq, bankSlot),
diff --git a/src/rspro/ConfigClientBankRes.c b/src/rspro/ConfigClientBankRes.c
index 4b3c18a..877100b 100644
--- a/src/rspro/ConfigClientBankRes.c
+++ b/src/rspro/ConfigClientBankRes.c
@@ -4,7 +4,7 @@
* found in "../../asn1/RSPRO.asn"
*/
-#include "ConfigClientBankRes.h"
+#include <osmocom/rspro/ConfigClientBankRes.h>
static asn_TYPE_member_t asn_MBR_ConfigClientBankRes_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct ConfigClientBankRes, result),
diff --git a/src/rspro/ConfigClientIdReq.c b/src/rspro/ConfigClientIdReq.c
index 570013a..548035c 100644
--- a/src/rspro/ConfigClientIdReq.c
+++ b/src/rspro/ConfigClientIdReq.c
@@ -4,7 +4,7 @@
* found in "../../asn1/RSPRO.asn"
*/
-#include "ConfigClientIdReq.h"
+#include <osmocom/rspro/ConfigClientIdReq.h>
static asn_TYPE_member_t asn_MBR_ConfigClientIdReq_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct ConfigClientIdReq, clientSlot),
diff --git a/src/rspro/ConfigClientIdRes.c b/src/rspro/ConfigClientIdRes.c
index a8b0691..23f2699 100644
--- a/src/rspro/ConfigClientIdRes.c
+++ b/src/rspro/ConfigClientIdRes.c
@@ -4,7 +4,7 @@
* found in "../../asn1/RSPRO.asn"
*/
-#include "ConfigClientIdRes.h"
+#include <osmocom/rspro/ConfigClientIdRes.h>
static asn_TYPE_member_t asn_MBR_ConfigClientIdRes_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct ConfigClientIdRes, result),
diff --git a/src/rspro/Makefile.am b/src/rspro/Makefile.am
index 91f0f35..df3ccf4 100644
--- a/src/rspro/Makefile.am
+++ b/src/rspro/Makefile.am
@@ -31,6 +31,8 @@
PortNumber.c \
RemoveMappingReq.c \
RemoveMappingRes.c \
+ ResetStateReq.c \
+ ResetStateRes.c \
ResultCode.c \
RsproPDU.c \
RsproPDUchoice.c \
@@ -76,6 +78,8 @@
PortNumber.h \
RemoveMappingReq.h \
RemoveMappingRes.h \
+ ResetStateReq.h \
+ ResetStateRes.h \
ResultCode.h \
RsproPDU.h \
RsproPDUchoice.h \
diff --git a/src/rspro/ResetStateReq.c b/src/rspro/ResetStateReq.c
new file mode 100644
index 0000000..538a18c
--- /dev/null
+++ b/src/rspro/ResetStateReq.c
@@ -0,0 +1,44 @@
+/*
+ * Generated by asn1c-0.9.28 (http://lionet.info/asn1c)
+ * From ASN.1 module "RSPRO"
+ * found in "../../asn1/RSPRO.asn"
+ */
+
+#include "ResetStateReq.h"
+
+static const ber_tlv_tag_t asn_DEF_ResetStateReq_tags_1[] = {
+ (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
+};
+static asn_SEQUENCE_specifics_t asn_SPC_ResetStateReq_specs_1 = {
+ sizeof(struct ResetStateReq),
+ offsetof(struct ResetStateReq, _asn_ctx),
+ 0, /* No top level tags */
+ 0, /* No tags in the map */
+ 0, 0, 0, /* Optional elements (not needed) */
+ -1, /* Start extensions */
+ -1 /* Stop extensions */
+};
+asn_TYPE_descriptor_t asn_DEF_ResetStateReq = {
+ "ResetStateReq",
+ "ResetStateReq",
+ SEQUENCE_free,
+ SEQUENCE_print,
+ SEQUENCE_constraint,
+ SEQUENCE_decode_ber,
+ SEQUENCE_encode_der,
+ SEQUENCE_decode_xer,
+ SEQUENCE_encode_xer,
+ 0, 0, /* No UPER support, use "-gen-PER" to enable */
+ 0, 0, /* No APER support, use "-gen-PER" to enable */
+ 0, /* Use generic outmost tag fetcher */
+ asn_DEF_ResetStateReq_tags_1,
+ sizeof(asn_DEF_ResetStateReq_tags_1)
+ /sizeof(asn_DEF_ResetStateReq_tags_1[0]), /* 1 */
+ asn_DEF_ResetStateReq_tags_1, /* Same as above */
+ sizeof(asn_DEF_ResetStateReq_tags_1)
+ /sizeof(asn_DEF_ResetStateReq_tags_1[0]), /* 1 */
+ 0, /* No PER visible constraints */
+ 0, 0, /* No members */
+ &asn_SPC_ResetStateReq_specs_1 /* Additional specs */
+};
+
diff --git a/src/rspro/ResetStateRes.c b/src/rspro/ResetStateRes.c
new file mode 100644
index 0000000..551dcc4
--- /dev/null
+++ b/src/rspro/ResetStateRes.c
@@ -0,0 +1,59 @@
+/*
+ * Generated by asn1c-0.9.28 (http://lionet.info/asn1c)
+ * From ASN.1 module "RSPRO"
+ * found in "../../asn1/RSPRO.asn"
+ */
+
+#include "ResetStateRes.h"
+
+static asn_TYPE_member_t asn_MBR_ResetStateRes_1[] = {
+ { ATF_NOFLAGS, 0, offsetof(struct ResetStateRes, result),
+ (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)),
+ 0,
+ &asn_DEF_ResultCode,
+ 0, /* Defer constraints checking to the member type */
+ 0, /* PER is not compiled, use -gen-PER */
+ 0,
+ "result"
+ },
+};
+static const ber_tlv_tag_t asn_DEF_ResetStateRes_tags_1[] = {
+ (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
+};
+static const asn_TYPE_tag2member_t asn_MAP_ResetStateRes_tag2el_1[] = {
+ { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, 0, 0 } /* result */
+};
+static asn_SEQUENCE_specifics_t asn_SPC_ResetStateRes_specs_1 = {
+ sizeof(struct ResetStateRes),
+ offsetof(struct ResetStateRes, _asn_ctx),
+ asn_MAP_ResetStateRes_tag2el_1,
+ 1, /* Count of tags in the map */
+ 0, 0, 0, /* Optional elements (not needed) */
+ 0, /* Start extensions */
+ 2 /* Stop extensions */
+};
+asn_TYPE_descriptor_t asn_DEF_ResetStateRes = {
+ "ResetStateRes",
+ "ResetStateRes",
+ SEQUENCE_free,
+ SEQUENCE_print,
+ SEQUENCE_constraint,
+ SEQUENCE_decode_ber,
+ SEQUENCE_encode_der,
+ SEQUENCE_decode_xer,
+ SEQUENCE_encode_xer,
+ 0, 0, /* No UPER support, use "-gen-PER" to enable */
+ 0, 0, /* No APER support, use "-gen-PER" to enable */
+ 0, /* Use generic outmost tag fetcher */
+ asn_DEF_ResetStateRes_tags_1,
+ sizeof(asn_DEF_ResetStateRes_tags_1)
+ /sizeof(asn_DEF_ResetStateRes_tags_1[0]), /* 1 */
+ asn_DEF_ResetStateRes_tags_1, /* Same as above */
+ sizeof(asn_DEF_ResetStateRes_tags_1)
+ /sizeof(asn_DEF_ResetStateRes_tags_1[0]), /* 1 */
+ 0, /* No PER visible constraints */
+ asn_MBR_ResetStateRes_1,
+ 1, /* Elements count */
+ &asn_SPC_ResetStateRes_specs_1 /* Additional specs */
+};
+
diff --git a/src/rspro/RsproPDUchoice.c b/src/rspro/RsproPDUchoice.c
index a5f7161..0d19180 100644
--- a/src/rspro/RsproPDUchoice.c
+++ b/src/rspro/RsproPDUchoice.c
@@ -124,6 +124,24 @@
0,
"errorInd"
},
+ { ATF_NOFLAGS, 0, offsetof(struct RsproPDUchoice, choice.resetStateReq),
+ (ASN_TAG_CLASS_CONTEXT | (19 << 2)),
+ -1, /* IMPLICIT tag at current level */
+ &asn_DEF_ResetStateReq,
+ 0, /* Defer constraints checking to the member type */
+ 0, /* PER is not compiled, use -gen-PER */
+ 0,
+ "resetStateReq"
+ },
+ { ATF_NOFLAGS, 0, offsetof(struct RsproPDUchoice, choice.resetStateRes),
+ (ASN_TAG_CLASS_CONTEXT | (20 << 2)),
+ -1, /* IMPLICIT tag at current level */
+ &asn_DEF_ResetStateRes,
+ 0, /* Defer constraints checking to the member type */
+ 0, /* PER is not compiled, use -gen-PER */
+ 0,
+ "resetStateRes"
+ },
{ ATF_NOFLAGS, 0, offsetof(struct RsproPDUchoice, choice.setAtrReq),
(ASN_TAG_CLASS_CONTEXT | (10 << 2)),
-1, /* IMPLICIT tag at current level */
@@ -190,15 +208,17 @@
{ (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* removeMappingRes */
{ (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* configClientIdReq */
{ (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 }, /* configClientIdRes */
- { (ASN_TAG_CLASS_CONTEXT | (10 << 2)), 13, 0, 0 }, /* setAtrReq */
- { (ASN_TAG_CLASS_CONTEXT | (11 << 2)), 14, 0, 0 }, /* setAtrRes */
- { (ASN_TAG_CLASS_CONTEXT | (12 << 2)), 15, 0, 0 }, /* tpduModemToCard */
- { (ASN_TAG_CLASS_CONTEXT | (13 << 2)), 16, 0, 0 }, /* tpduCardToModem */
- { (ASN_TAG_CLASS_CONTEXT | (14 << 2)), 17, 0, 0 }, /* clientSlotStatusInd */
- { (ASN_TAG_CLASS_CONTEXT | (15 << 2)), 18, 0, 0 }, /* bankSlotStatusInd */
+ { (ASN_TAG_CLASS_CONTEXT | (10 << 2)), 15, 0, 0 }, /* setAtrReq */
+ { (ASN_TAG_CLASS_CONTEXT | (11 << 2)), 16, 0, 0 }, /* setAtrRes */
+ { (ASN_TAG_CLASS_CONTEXT | (12 << 2)), 17, 0, 0 }, /* tpduModemToCard */
+ { (ASN_TAG_CLASS_CONTEXT | (13 << 2)), 18, 0, 0 }, /* tpduCardToModem */
+ { (ASN_TAG_CLASS_CONTEXT | (14 << 2)), 19, 0, 0 }, /* clientSlotStatusInd */
+ { (ASN_TAG_CLASS_CONTEXT | (15 << 2)), 20, 0, 0 }, /* bankSlotStatusInd */
{ (ASN_TAG_CLASS_CONTEXT | (16 << 2)), 12, 0, 0 }, /* errorInd */
{ (ASN_TAG_CLASS_CONTEXT | (17 << 2)), 10, 0, 0 }, /* configClientBankReq */
- { (ASN_TAG_CLASS_CONTEXT | (18 << 2)), 11, 0, 0 } /* configClientBankRes */
+ { (ASN_TAG_CLASS_CONTEXT | (18 << 2)), 11, 0, 0 }, /* configClientBankRes */
+ { (ASN_TAG_CLASS_CONTEXT | (19 << 2)), 13, 0, 0 }, /* resetStateReq */
+ { (ASN_TAG_CLASS_CONTEXT | (20 << 2)), 14, 0, 0 } /* resetStateRes */
};
static asn_CHOICE_specifics_t asn_SPC_RsproPDUchoice_specs_1 = {
sizeof(struct RsproPDUchoice),
@@ -206,9 +226,9 @@
offsetof(struct RsproPDUchoice, present),
sizeof(((struct RsproPDUchoice *)0)->present),
asn_MAP_RsproPDUchoice_tag2el_1,
- 19, /* Count of tags in the map */
+ 21, /* Count of tags in the map */
0,
- 19 /* Extensions start */
+ 21 /* Extensions start */
};
asn_TYPE_descriptor_t asn_DEF_RsproPDUchoice = {
"RsproPDUchoice",
@@ -229,7 +249,7 @@
0, /* No tags (count) */
0, /* No PER visible constraints */
asn_MBR_RsproPDUchoice_1,
- 19, /* Elements count */
+ 21, /* Elements count */
&asn_SPC_RsproPDUchoice_specs_1 /* Additional specs */
};
diff --git a/src/rspro_util.c b/src/rspro_util.c
index 5c78b60..422aef4 100644
--- a/src/rspro_util.c
+++ b/src/rspro_util.c
@@ -385,6 +385,29 @@
return pdu;
}
+RsproPDU_t *rspro_gen_ResetStateReq(void)
+{
+ RsproPDU_t *pdu = CALLOC(1, sizeof(*pdu));
+ if (!pdu)
+ return NULL;
+ pdu->version = 2;
+ pdu->msg.present = RsproPDUchoice_PR_resetStateReq;
+
+ return pdu;
+}
+
+RsproPDU_t *rspro_gen_ResetStateRes(e_ResultCode res)
+{
+ RsproPDU_t *pdu = CALLOC(1, sizeof(*pdu));
+ if (!pdu)
+ return NULL;
+ pdu->version = 2;
+ pdu->msg.present = RsproPDUchoice_PR_resetStateRes;
+ pdu->msg.choice.resetStateRes.result = res;
+
+ return pdu;
+}
+
e_ResultCode rspro_get_result(const RsproPDU_t *pdu)
{
switch (pdu->msg.present) {
@@ -402,6 +425,8 @@
return pdu->msg.choice.configClientBankRes.result;
case RsproPDUchoice_PR_setAtrRes:
return pdu->msg.choice.setAtrRes.result;
+ case RsproPDUchoice_PR_resetStateRes:
+ return pdu->msg.choice.resetStateRes.result;
default:
OSMO_ASSERT(0);
}
diff --git a/src/rspro_util.h b/src/rspro_util.h
index 444d34a..8c6ae3b 100644
--- a/src/rspro_util.h
+++ b/src/rspro_util.h
@@ -42,6 +42,8 @@
const uint8_t *tpdu, unsigned int tpdu_len);
RsproPDU_t *rspro_gen_TpduCard2Modem(const BankSlot_t *bank, const ClientSlot_t *client,
const uint8_t *tpdu, unsigned int tpdu_len);
+RsproPDU_t *rspro_gen_ResetStateReq(void);
+RsproPDU_t *rspro_gen_ResetStateRes(e_ResultCode res);
e_ResultCode rspro_get_result(const RsproPDU_t *pdu);