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/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);