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
changes/91/16491/1
Harald Welte 3 years ago
parent 602b6f7763
commit 3f9663215f
  1. 13
      asn1/RSPRO.asn
  2. 2
      include/osmocom/rspro/Makefile.am
  3. 39
      include/osmocom/rspro/ResetStateReq.h
  4. 41
      include/osmocom/rspro/ResetStateRes.h
  5. 6
      include/osmocom/rspro/RsproPDUchoice.h
  6. 2
      src/rspro/ConfigClientBankReq.c
  7. 2
      src/rspro/ConfigClientBankRes.c
  8. 2
      src/rspro/ConfigClientIdReq.c
  9. 2
      src/rspro/ConfigClientIdRes.c
  10. 4
      src/rspro/Makefile.am
  11. 44
      src/rspro/ResetStateReq.c
  12. 59
      src/rspro/ResetStateRes.c
  13. 40
      src/rspro/RsproPDUchoice.c
  14. 25
      src/rspro_util.c
  15. 2
      src/rspro_util.h

@ -308,6 +308,17 @@ ErrorInd ::= SEQUENCE {
...
}
-- 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 @@ RsproPDUchoice ::= CHOICE {
configClientBankReq [17] ConfigClientBankReq,
configClientBankRes [18] ConfigClientBankRes,
errorInd [16] ErrorInd,
resetStateReq [19] ResetStateReq,
resetStateRes [20] ResetStateRes,
-- APDUs etc.
setAtrReq [10] SetAtrReq,
setAtrRes [11] SetAtrRes,

@ -31,6 +31,8 @@ noinst_HEADERS = \
PortNumber.h \
RemoveMappingReq.h \
RemoveMappingRes.h \
ResetStateReq.h \
ResetStateRes.h \
ResultCode.h \
RsproPDU.h \
RsproPDUchoice.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>

@ -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>

@ -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 @@ typedef enum RsproPDUchoice_PR {
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 @@ typedef struct RsproPDUchoice {
ConfigClientBankReq_t configClientBankReq;
ConfigClientBankRes_t configClientBankRes;
ErrorInd_t errorInd;
ResetStateReq_t resetStateReq;
ResetStateRes_t resetStateRes;
SetAtrReq_t setAtrReq;
SetAtrRes_t setAtrRes;
TpduModemToCard_t tpduModemToCard;

@ -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),

@ -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),

@ -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),

@ -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),

@ -31,6 +31,8 @@ ASN_MODULE_SOURCES = \
PortNumber.c \
RemoveMappingReq.c \
RemoveMappingRes.c \
ResetStateReq.c \
ResetStateRes.c \
ResultCode.c \
RsproPDU.c \
RsproPDUchoice.c \
@ -76,6 +78,8 @@ ASN_MODULE_INC = \
PortNumber.h \
RemoveMappingReq.h \
RemoveMappingRes.h \
ResetStateReq.h \
ResetStateRes.h \
ResultCode.h \
RsproPDU.h \
RsproPDUchoice.h \

@ -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 */
};

@ -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 */
};

@ -124,6 +124,24 @@ static asn_TYPE_member_t asn_MBR_RsproPDUchoice_1[] = {
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 @@ static const asn_TYPE_tag2member_t asn_MAP_RsproPDUchoice_tag2el_1[] = {
{ (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 @@ static asn_CHOICE_specifics_t asn_SPC_RsproPDUchoice_specs_1 = {
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 @@ asn_TYPE_descriptor_t asn_DEF_RsproPDUchoice = {
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 */
};

@ -385,6 +385,29 @@ RsproPDU_t *rspro_gen_TpduCard2Modem(const BankSlot_t *bank, const ClientSlot_t
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 @@ e_ResultCode rspro_get_result(const RsproPDU_t *pdu)
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);
}

@ -42,6 +42,8 @@ RsproPDU_t *rspro_gen_TpduModem2Card(const ClientSlot_t *client, const BankSlot_
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);

Loading…
Cancel
Save