自主协议库编译通过
This commit is contained in:
1346
mmslib/mmsl/mms_adl.c
Normal file
1346
mmslib/mmsl/mms_adl.c
Normal file
File diff suppressed because it is too large
Load Diff
934
mmslib/mmsl/mms_alta.c
Normal file
934
mmslib/mmsl/mms_alta.c
Normal file
@@ -0,0 +1,934 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2006, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : mms_alta.c */
|
||||
/* PRODUCT(S) : MMSEASE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* Function to decode ASN.1 type definitions into Runtime typedefs */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 08/09/06 JRB 20 Add ms_aa_to_asn1_2. */
|
||||
/* 02/22/05 JRB 19 Make "sp" local to avoid VXWORKS conflict. */
|
||||
/* 02/06/02 JRB 18 Move ms_mk_rt_aa* to new mms_rtaa.c. */
|
||||
/* 12/20/01 JRB 17 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 11/15/01 EJV 16 Added support for new MMS type UtcTime: */
|
||||
/* find_named_comp: added case for RT_UTC_TIME; */
|
||||
/* _ms_log_runtime_aa: add case for RT_UTC_TIME;*/
|
||||
/* 09/26/00 JRB 15 Add SD_CONST on ms_mk_rt_aa* */
|
||||
/* 07/28/00 JRB 14 Use ms_comp_name_find for everyone. */
|
||||
/* 07/13/00 JRB 13 Use new ms_comp_name_find for MMS LITE. */
|
||||
/* 04/28/00 JRB 12 Lint cleanup */
|
||||
/* 09/13/99 RKR 11 Respaced a macro for the install utility */
|
||||
/* 09/13/99 MDE 10 Added SD_CONST modifiers */
|
||||
/* 07/30/99 MDE 09 Replaced CSTR_DONE_FUN macro use */
|
||||
/* 09/21/98 MDE 08 Minor lint cleanup */
|
||||
/* 09/10/98 MDE 07 Changes to work better with MMS-LITE */
|
||||
/* 06/15/98 MDE 06 Changes to allow compile under C++ */
|
||||
/* 03/12/98 MDE 05 '_ms_m_get_rt_info' use change */
|
||||
/* 03/11/98 MDE 04 Removed NEST_RT_TYPES */
|
||||
/* 02/10/98 MDE 03 No longer use runtime type 'loops' element */
|
||||
/* rearranged for MMS-LITE (MMS_ALTA_DATA) */
|
||||
/* 12/29/97 MDE 02 Corrected LOCK/UNLOCK problems */
|
||||
/* 06/09/97 MDE 01 Modified Runtime Type handling */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
#include "glbsem.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pvar.h"
|
||||
#include "mms_vvar.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* For debug version, use a static pointer to avoid duplication of */
|
||||
/* __FILE__ strings. */
|
||||
|
||||
#ifdef DEBUG_SISCO
|
||||
SD_CONST static ST_CHAR *SD_CONST thisFileName = __FILE__;
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
static ST_RET wr_altAcc (ASN1_ENC_CTXT *aCtx, ALT_ACC_EL **aap, ALT_ACC_EL *last_aa);
|
||||
static ST_RET wr_altAccSel (ASN1_ENC_CTXT *aCtx, ALT_ACC_EL **aap, ALT_ACC_EL *last_aa);
|
||||
static ALT_ACC_EL *find_start_aa_nest (ALT_ACC_EL *aa, ALT_ACC_EL *last_aa);
|
||||
static ST_VOID alt_acc_seq_start (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID alt_acc_seq_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID add_alt_acc_tags (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID named_start (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID get_component_name (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID named_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID sel_acc_comp (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID sel_acc_index (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID sel_acc_index_range (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID sel_acc_ir_low (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID sel_acc_ir_num (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID sel_acc_ir_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID sel_acc_all (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID sel_alt_acc (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID sel_alt_acc_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID sel_alt_acc_comp (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID sel_alt_acc_index (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID sel_alt_acc_index_range (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID sel_alt_acc_ir_low (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID sel_alt_acc_ir_num (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID sel_alt_acc_ir_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID sel_alt_acc_all (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID alt_acc_dec_done_ok (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID inc_dest_aa (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* Static internal variables, used during decode */
|
||||
|
||||
static ALT_ACC_EL *dest_aa;
|
||||
static ALT_ACC_EL *end_dest_aa;
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* ms_asn1_to_aa */
|
||||
/* Convert an ASN.1 encoded AA to an array of 'ALT_ACC_EL' */
|
||||
/* Allocates an array of 'm_max_dec_aa' elements, using chk_calloc, */
|
||||
/* does not realloc to correct size. */
|
||||
/************************************************************************/
|
||||
|
||||
|
||||
ST_RET ms_asn1_to_aa (ST_UCHAR *asn1ptr, ST_INT asn1len, ALT_ACCESS *alt_acc_out)
|
||||
{
|
||||
ALT_ACC_EL *dest_aa_head;
|
||||
ASN1_DEC_CTXT localDecCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_DEC_CTXT *aCtx = &localDecCtx;
|
||||
|
||||
memset (aCtx, 0, sizeof (ASN1_DEC_CTXT)); /* CRITICAL: start clean. */
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
|
||||
/* Allocate the output AA array */
|
||||
dest_aa = (ALT_ACC_EL *) chk_calloc (m_max_dec_aa, sizeof (ALT_ACC_EL));
|
||||
end_dest_aa = dest_aa + (m_max_dec_aa -1);
|
||||
dest_aa_head = dest_aa;
|
||||
|
||||
/* Set up ASN.1 decode tools */
|
||||
aCtx->asn1r_decode_method = ASN1_TAG_METHOD; /* select tag method */
|
||||
aCtx->asn1r_decode_done_fun = asn1r_done_err;/* not legal to be done at this time */
|
||||
aCtx->asn1r_err_fun = NULL;
|
||||
|
||||
/* We are using an alternate entry point into the ASN.1 decode, where */
|
||||
/* the outer tag is not required. */
|
||||
|
||||
add_alt_acc_tags (aCtx);
|
||||
aCtx->asn1r_c_done_fun[0] = NULL;
|
||||
aCtx->asn1r_decode_done_fun = alt_acc_dec_done_ok;
|
||||
asn1r_decode_asn1_seq (aCtx, asn1ptr, asn1len); /* decode ASN.1 'Data' entity */
|
||||
|
||||
if (aCtx->asn1r_pdu_dec_err != NO_DECODE_ERR) /* check for sucess or return error */
|
||||
{
|
||||
chk_free (dest_aa_head);
|
||||
MLOG_NERR0 ("ASN.1 to AA Decode Error");
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (MVE_DATA_CONVERT);
|
||||
}
|
||||
|
||||
alt_acc_out->aa = dest_aa_head;
|
||||
alt_acc_out->num_aa = dest_aa - dest_aa_head;
|
||||
|
||||
/* Log the alternate access, if selected */
|
||||
if (mms_debug_sel & MMS_LOG_AA)
|
||||
ms_log_alt_access (alt_acc_out);
|
||||
|
||||
/* save the high water mark */
|
||||
if (alt_acc_out->num_aa > m_hw_dec_aa)
|
||||
m_hw_dec_aa = alt_acc_out->num_aa;
|
||||
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* alt_acc_seq_start */
|
||||
/* This function is called whe the outer UNI SEQ constructor of the */
|
||||
/* AlternateAcess is found. Used only for continuing the decode for a */
|
||||
/* nested AA spec, as the outer constructor is stripped */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID alt_acc_seq_start (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
add_alt_acc_tags (aCtx);
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = alt_acc_seq_cstr_done;
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* alt_acc_seq_cstr_done */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID alt_acc_seq_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("alt_acc_seq_cstr_done");
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* add_alt_acc_tags */
|
||||
/* Add appropriate tags for the outer 'AlternateAccess' */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID add_alt_acc_tags (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 0, sel_alt_acc);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 1, sel_acc_comp);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 2, sel_acc_index);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 3, sel_acc_index_range);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 4, sel_acc_all);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 5, named_start);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* named_start */
|
||||
/* Constructor for the 'named' element of the 'AlternateAccess' */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID named_start (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("named_start");
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 0, get_component_name);
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = named_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* get_component_name */
|
||||
/* The 'componentName' element of the 'named' element */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID get_component_name (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("get_component_name");
|
||||
if (asn1r_get_identifier (aCtx, dest_aa->comp_name))
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
else
|
||||
{
|
||||
dest_aa->comp_name_pres = SD_TRUE;
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 0, sel_alt_acc);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 1, sel_acc_comp);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 2, sel_acc_index);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 3, sel_acc_index_range);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 4, sel_acc_all);
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* named_cstr_done */
|
||||
/* End of 'named' constructor */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID named_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("named_cstr_done");
|
||||
add_alt_acc_tags (aCtx);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* sel_acc_comp */
|
||||
/* The 'component' of the 'selectAccess' has been encountered */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID sel_acc_comp (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("sel_acc_comp");
|
||||
if (asn1r_get_identifier (aCtx, dest_aa->u.component))
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
else
|
||||
{
|
||||
dest_aa->sel_type = AA_COMP;
|
||||
inc_dest_aa (aCtx);
|
||||
add_alt_acc_tags (aCtx);
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* sel_acc_index */
|
||||
/* The 'index' of the 'selectAccess' has been encountered */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID sel_acc_index (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("sel_acc_index");
|
||||
if (asn1r_get_u32 (aCtx, &dest_aa->u.index))
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
else
|
||||
{
|
||||
dest_aa->sel_type = AA_INDEX;
|
||||
inc_dest_aa (aCtx);
|
||||
add_alt_acc_tags (aCtx);
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* sel_acc_index_range */
|
||||
/* The 'indexRange' of the 'selectAccess' has been encountered */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID sel_acc_index_range (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("sel_acc_index_range");
|
||||
|
||||
dest_aa->sel_type = AA_INDEX_RANGE;
|
||||
ASN1R_TAG_ADD (aCtx, CTX,0, sel_acc_ir_low);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* sel_acc_ir_low */
|
||||
/* The 'low_index' of the 'indexRange' has been encountered */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID sel_acc_ir_low (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("sel_acc_ir_low");
|
||||
if (asn1r_get_u32 (aCtx, &dest_aa->u.ir.low_index))
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
else
|
||||
{
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 1, sel_acc_ir_num);
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* sel_acc_ir_num */
|
||||
/* The 'numberOfElements' of the 'indexRange' has been encountered */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID sel_acc_ir_num (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("sel_acc_ir_num");
|
||||
if (asn1r_get_u32 (aCtx, &dest_aa->u.ir.num_elmnts))
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
else
|
||||
{
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = sel_acc_ir_cstr_done;
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* sel_acc_ir_cstr_done */
|
||||
/* End of the 'indexRange' constructor */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID sel_acc_ir_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("sel_acc_ir_cstr_done");
|
||||
inc_dest_aa (aCtx);
|
||||
add_alt_acc_tags (aCtx);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* sel_acc_all */
|
||||
/* The 'allElements' of the 'selectAccess' has been encountered */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID sel_acc_all (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("sel_acc_all");
|
||||
dest_aa->sel_type = AA_ALL;
|
||||
inc_dest_aa (aCtx);
|
||||
add_alt_acc_tags (aCtx);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* sel_alt_acc */
|
||||
/* The 'selectAlternateAccess' constructor has been encountered */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID sel_alt_acc (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("sel_alt_acc");
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 0, sel_alt_acc_comp);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 1, sel_alt_acc_index);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 2, sel_alt_acc_index_range);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 3, sel_alt_acc_all);
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = sel_alt_acc_cstr_done;
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* sel_alt_acc_cstr_done */
|
||||
/* End of the 'selectAlternateAccess' constructor */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID sel_alt_acc_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("sel_alt_acc_cstr_done");
|
||||
dest_aa->sel_type = AA_END_NEST;
|
||||
inc_dest_aa (aCtx);
|
||||
add_alt_acc_tags (aCtx);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* sel_alt_acc_comp */
|
||||
/* The 'component' of the 'selectAlternateAccesss' has been encountered */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID sel_alt_acc_comp (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("sel_alt_acc_comp");
|
||||
if (asn1r_get_identifier (aCtx, dest_aa->u.component))
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
else
|
||||
{
|
||||
dest_aa->sel_type = AA_COMP_NEST;
|
||||
inc_dest_aa (aCtx);
|
||||
ASN1R_TAG_ADD (aCtx, UNI | CONSTR, SEQ_CODE, alt_acc_seq_start);
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* sel_alt_acc_index */
|
||||
/* The 'index' of the 'selectAlternateAccesss' has been encountered */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID sel_alt_acc_index (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("sel_alt_acc_index");
|
||||
if (asn1r_get_u32 (aCtx, &dest_aa->u.index))
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
else
|
||||
{
|
||||
dest_aa->sel_type = AA_INDEX_NEST;
|
||||
inc_dest_aa (aCtx);
|
||||
ASN1R_TAG_ADD (aCtx, UNI | CONSTR, SEQ_CODE, alt_acc_seq_start);
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* sel_alt_acc_index_range */
|
||||
/* The 'indexRange' of 'selectAlternateAccesss' has been encountered */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID sel_alt_acc_index_range (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("sel_alt_acc_index_range");
|
||||
dest_aa->sel_type = AA_INDEX_RANGE_NEST;
|
||||
ASN1R_TAG_ADD (aCtx, CTX,0, sel_alt_acc_ir_low);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* sel_alt_acc_ir_low */
|
||||
/* The 'low_index' of the 'indexRange' has been encountered */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID sel_alt_acc_ir_low (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("sel_alt_acc_ir_low");
|
||||
if (asn1r_get_u32 (aCtx, &dest_aa->u.ir.low_index))
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
else
|
||||
{
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 1, sel_alt_acc_ir_num);
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* sel_alt_acc_ir_num */
|
||||
/* The 'numberOfElements' of the 'indexRange' has been encountered */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID sel_alt_acc_ir_num (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("sel_alt_acc_ir_num");
|
||||
if (asn1r_get_u32 (aCtx, &dest_aa->u.ir.num_elmnts))
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
else
|
||||
{
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = sel_alt_acc_ir_cstr_done;
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* sel_alt_acc_ir_cstr_done */
|
||||
/* End of the 'indexRange' constructor */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID sel_alt_acc_ir_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("sel_alt_acc_ir_cstr_done");
|
||||
inc_dest_aa (aCtx);
|
||||
ASN1R_TAG_ADD (aCtx, UNI | CONSTR, SEQ_CODE, alt_acc_seq_start);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* sel_alt_acc_all */
|
||||
/* The 'allElements' of 'selectAlternateAccesss' has been encountered */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID sel_alt_acc_all (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("sel_alt_acc_all");
|
||||
dest_aa->sel_type = AA_ALL_NEST;
|
||||
inc_dest_aa (aCtx);
|
||||
ASN1R_TAG_ADD (aCtx, UNI | CONSTR, SEQ_CODE, alt_acc_seq_start);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* inc_dest_aa */
|
||||
/* Increment the destination AA pointer, verify no overrun */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID inc_dest_aa (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
if (++dest_aa > end_dest_aa)
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* alt_acc_dec_done_ok */
|
||||
/* 'decode done fun' for the ASN.1 to AA decode */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID alt_acc_dec_done_ok (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("alt_dec_done_ok");
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* ms_aa_to_asn1 */
|
||||
/* Encode Alternate Access, assume that the encode tools have been */
|
||||
/* initalized */
|
||||
/* NOTE: The higher level function "ms_aa_to_asn1_2" is more convenient.*/
|
||||
/* Call this directly only if "AA" encode is in the middle of a */
|
||||
/* larger encode. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_INT encodeDone;
|
||||
|
||||
ST_RET ms_aa_to_asn1 (ASN1_ENC_CTXT *aCtx, ALT_ACCESS *alt_acc)
|
||||
{
|
||||
ALT_ACC_EL *aa;
|
||||
ALT_ACC_EL *last_aa;
|
||||
ST_RET ret;
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
aa = alt_acc->aa;
|
||||
last_aa = aa; /* save pointer to aa[0] */
|
||||
aa += (alt_acc->num_aa-1); /* go from bottom to top */
|
||||
|
||||
/* Write the AlternateAccess 'Seq Of Choice' elements until we have */
|
||||
/* gone through all AA elements */
|
||||
ret = SD_SUCCESS;
|
||||
encodeDone = SD_FALSE;
|
||||
while (!encodeDone && ret == SD_SUCCESS)
|
||||
{
|
||||
if (aa == last_aa)
|
||||
encodeDone = SD_TRUE;
|
||||
ret = wr_altAcc (aCtx, &aa, last_aa);
|
||||
}
|
||||
|
||||
/* Verify no asn.1 encode buffer overrun */
|
||||
if (aCtx->asn1r_encode_overrun)
|
||||
{
|
||||
MLOG_NERR0 ("AA to ASN.1 : buffer overrun");
|
||||
ret = ME_ASN1_ENCODE_OVERRUN;
|
||||
}
|
||||
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* wr_altAcc */
|
||||
/************************************************************************/
|
||||
|
||||
/* NOTE : This function is entered recursively to encode parts of the */
|
||||
/* AlternateAccess */
|
||||
|
||||
static ST_RET wr_altAcc (ASN1_ENC_CTXT *aCtx, ALT_ACC_EL **aap, ALT_ACC_EL *last_aa)
|
||||
{
|
||||
ALT_ACC_EL *aa;
|
||||
ALT_ACC_EL *aa_start_nest;
|
||||
ST_RET ret;
|
||||
|
||||
/* get a working pointer */
|
||||
aa = *aap;
|
||||
|
||||
/* Write the AlternateAccess sequence of choice element */
|
||||
|
||||
/* First need to see if this is the start of a named component, so */
|
||||
/* we can start the constructor if so */
|
||||
|
||||
/* If this is a nested AA element, need to find the start element */
|
||||
if (aa->sel_type == AA_END_NEST)
|
||||
{
|
||||
aa_start_nest = find_start_aa_nest (aa, last_aa);
|
||||
if (!aa_start_nest)
|
||||
{
|
||||
MLOG_NERR0 ("AA to ASN.1 : Bad AA");
|
||||
return (MVE_AA_SELECT);
|
||||
}
|
||||
|
||||
if (aa_start_nest->comp_name_pres)
|
||||
asn1r_strt_constr (aCtx); /* Start 'named' seq cstr */
|
||||
}
|
||||
else /* not the start of a nested */
|
||||
{
|
||||
if (aa->comp_name_pres)
|
||||
asn1r_strt_constr (aCtx); /* Start 'named' seq cstr */
|
||||
}
|
||||
|
||||
/* OK, if this was a named component, the constructor has been started */
|
||||
/* Go ahead and write the AlternateAccessSelection element */
|
||||
|
||||
ret = wr_altAccSel (aCtx, &aa, last_aa); /* write the altAccSel */
|
||||
|
||||
*aap = aa;
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* wr_altAccSel */
|
||||
/************************************************************************/
|
||||
|
||||
/* NOTE : This function is entered recursively to encode parts of the */
|
||||
/* AlternateAccess */
|
||||
|
||||
static ST_RET wr_altAccSel (ASN1_ENC_CTXT *aCtx, ALT_ACC_EL **aap, ALT_ACC_EL *last_aa)
|
||||
{
|
||||
ALT_ACC_EL *aa;
|
||||
ALT_ACC_EL *aa_start_nest;
|
||||
ST_RET ret;
|
||||
|
||||
ret = SD_SUCCESS;
|
||||
aa = *aap; /* get working pointer */
|
||||
switch (aa->sel_type)
|
||||
{
|
||||
case AA_COMP :
|
||||
asn1r_wr_vstr (aCtx, aa->u.component);
|
||||
asn1r_fin_prim (aCtx, 1,CTX);
|
||||
break;
|
||||
|
||||
case AA_INDEX :
|
||||
asn1r_wr_u32 (aCtx, aa->u.index);
|
||||
asn1r_fin_prim (aCtx, 2,CTX);
|
||||
break;
|
||||
|
||||
case AA_INDEX_RANGE :
|
||||
asn1r_strt_constr (aCtx);
|
||||
asn1r_wr_u32 (aCtx, aa->u.ir.num_elmnts);
|
||||
asn1r_fin_prim (aCtx, 1,CTX);
|
||||
asn1r_wr_u32 (aCtx, aa->u.ir.low_index);
|
||||
asn1r_fin_prim (aCtx, 0,CTX);
|
||||
asn1r_fin_constr (aCtx, 3,CTX,DEF);
|
||||
break;
|
||||
|
||||
case AA_ALL :
|
||||
asn1r_fin_prim (aCtx, 4,CTX);
|
||||
break;
|
||||
|
||||
case AA_END_NEST :
|
||||
|
||||
/* First we need to find the NEST START element so that we can */
|
||||
/* encode all elements on this level before returning, so that we */
|
||||
/* can add the outer constructor */
|
||||
|
||||
aa_start_nest = find_start_aa_nest (aa, last_aa);
|
||||
if (!aa_start_nest)
|
||||
{
|
||||
MLOG_NERR0 ("AA to ASN.1 : Bad AA");
|
||||
return (MVE_AA_SELECT);
|
||||
}
|
||||
|
||||
asn1r_strt_constr (aCtx); /* Start SelectAlternateAccess constructor */
|
||||
asn1r_strt_constr (aCtx); /* Start outer AlternateAccess constructor */
|
||||
--aa; /* Begin with next element */
|
||||
while (aa != aa_start_nest)
|
||||
{
|
||||
ret = wr_altAcc (aCtx, &aa, last_aa); /* wr_altAcc will decrement aa */
|
||||
if (aa == last_aa)
|
||||
encodeDone = SD_TRUE;
|
||||
|
||||
if (ret != SD_SUCCESS)
|
||||
return (ret);
|
||||
}
|
||||
asn1r_fin_constr (aCtx, SEQ_CODE,UNI,DEF); /* Outer AlternateAccess cstr */
|
||||
|
||||
/* Now write the accessSelection */
|
||||
switch (aa->sel_type)
|
||||
{
|
||||
case AA_COMP_NEST :
|
||||
asn1r_wr_vstr (aCtx, aa->u.component);
|
||||
asn1r_fin_prim (aCtx, 0,CTX);
|
||||
break;
|
||||
|
||||
case AA_INDEX_NEST :
|
||||
asn1r_wr_u32 (aCtx, aa->u.index);
|
||||
asn1r_fin_prim (aCtx, 1,CTX);
|
||||
break;
|
||||
|
||||
case AA_INDEX_RANGE_NEST :
|
||||
asn1r_strt_constr (aCtx);
|
||||
asn1r_wr_u32 (aCtx, aa->u.ir.num_elmnts);
|
||||
asn1r_fin_prim (aCtx, 1,CTX);
|
||||
asn1r_wr_u32 (aCtx, aa->u.ir.low_index);
|
||||
asn1r_fin_prim (aCtx, 0,CTX);
|
||||
asn1r_fin_constr (aCtx, 2,CTX,DEF);
|
||||
break;
|
||||
|
||||
case AA_ALL_NEST :
|
||||
asn1r_fin_prim (aCtx, 3,CTX);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Finish the accessSelection constructor */
|
||||
asn1r_fin_constr (aCtx, 0,CTX,DEF);
|
||||
break;
|
||||
|
||||
/* These should never be encountered at this level */
|
||||
case AA_COMP_NEST :
|
||||
case AA_INDEX_NEST :
|
||||
case AA_INDEX_RANGE_NEST :
|
||||
case AA_ALL_NEST :
|
||||
default :
|
||||
MLOG_NERR0 ("AA to ASN.1 : Bad AA sel_type value");
|
||||
return SD_FAILURE;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* For the elements that are not 'end nest', add the 'named' element */
|
||||
/* as required */
|
||||
|
||||
if (aa->sel_type != AA_END_NEST)
|
||||
{
|
||||
if (aa->comp_name_pres)
|
||||
{
|
||||
asn1r_wr_vstr (aCtx, aa->comp_name); /* Write the name */
|
||||
asn1r_fin_prim (aCtx, 0,CTX);
|
||||
asn1r_fin_constr (aCtx, 5,CTX,DEF); /* Finish the 'named' cstr */
|
||||
}
|
||||
}
|
||||
|
||||
if (aa > last_aa)
|
||||
--aa;
|
||||
*aap = aa;
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* find_start_aa_nest */
|
||||
/************************************************************************/
|
||||
|
||||
static ALT_ACC_EL *find_start_aa_nest (ALT_ACC_EL *aa,
|
||||
ALT_ACC_EL *last_aa)
|
||||
{
|
||||
ALT_ACC_EL *aa2;
|
||||
ST_INT nest;
|
||||
|
||||
aa2 = aa-1; /* Start with the element above */
|
||||
nest = 0; /* keep track of nesting level */
|
||||
while (SD_TRUE)
|
||||
{
|
||||
if (aa2->sel_type == AA_COMP_NEST ||
|
||||
aa2->sel_type == AA_INDEX_NEST ||
|
||||
aa2->sel_type == AA_INDEX_RANGE_NEST ||
|
||||
aa2->sel_type == AA_ALL_NEST)
|
||||
{
|
||||
if (nest == 0) /* we found the matching start nest */
|
||||
break;
|
||||
|
||||
--nest; /* point to the next above element */
|
||||
if (nest < 0) /* sanity check - users make this tbl */
|
||||
{
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
else /* not a start nest element, check to */
|
||||
{ /* see if we are nesting further */
|
||||
if (aa2->sel_type == AA_END_NEST)
|
||||
nest++;
|
||||
}
|
||||
|
||||
/* OK, we did not find the start element for the end nest, look */
|
||||
/* some more */
|
||||
if (aa2 == last_aa) /* sanity check - users make this tbl */
|
||||
{
|
||||
MLOG_NERR0 ("AA to ASN.1 : Bad AA");
|
||||
return (NULL);
|
||||
}
|
||||
--aa2;
|
||||
}
|
||||
return (aa2);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* ms_log_alt_access */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID ms_log_alt_access (ALT_ACCESS *alt_acc)
|
||||
{
|
||||
#ifdef DEBUG_SISCO
|
||||
ALT_ACC_EL *aa;
|
||||
ST_INT num_aa;
|
||||
ST_INT i;
|
||||
ST_INT indent;
|
||||
/* Use these strings to keep logging aligned and indented as desired */
|
||||
#define MAX_INDENT 5
|
||||
SD_CONST ST_CHAR *sp[MAX_INDENT] =
|
||||
{
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
};
|
||||
SD_CONST ST_CHAR *sp2[MAX_INDENT] =
|
||||
{
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
"",
|
||||
};
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
aa = alt_acc->aa;
|
||||
num_aa = alt_acc->num_aa;
|
||||
indent = 0;
|
||||
MLOG_ALWAYS1 ("Alternate Access : %d elements", num_aa);
|
||||
|
||||
for (i = 0; i < num_aa; ++i, ++aa)
|
||||
{
|
||||
if (aa->comp_name_pres)
|
||||
{
|
||||
MLOG_CALWAYS3 ("%sNamed %s: %s",
|
||||
sp[indent],
|
||||
sp2[indent],
|
||||
aa->comp_name);
|
||||
}
|
||||
|
||||
switch (aa->sel_type)
|
||||
{
|
||||
case AA_COMP :
|
||||
MLOG_CALWAYS3 ("%sComp %s: %s",
|
||||
sp[indent],
|
||||
sp2[indent],
|
||||
aa->u.component);
|
||||
break;
|
||||
case AA_INDEX :
|
||||
MLOG_CALWAYS3 ("%sIndex %s: %ld",
|
||||
sp[indent],
|
||||
sp2[indent],
|
||||
aa->u.index);
|
||||
if (--indent < 0)
|
||||
indent++;
|
||||
break;
|
||||
case AA_INDEX_RANGE :
|
||||
MLOG_CALWAYS4 ("%sIndex Range%s: Low = %ld, Num = %ld",
|
||||
sp[indent],
|
||||
sp2[indent],
|
||||
aa->u.ir.low_index,
|
||||
aa->u.ir.num_elmnts);
|
||||
if (--indent < 0)
|
||||
indent++;
|
||||
break;
|
||||
case AA_ALL :
|
||||
MLOG_CALWAYS2 ("%sAll %s:",
|
||||
sp[indent],
|
||||
sp2[indent]);
|
||||
if (--indent < 0)
|
||||
indent++;
|
||||
break;
|
||||
case AA_ALL_NEST :
|
||||
MLOG_CALWAYS2 ("%sAll Nest %s:",
|
||||
sp[indent],
|
||||
sp2[indent]);
|
||||
if (++indent >= MAX_INDENT)
|
||||
indent--;
|
||||
break;
|
||||
case AA_COMP_NEST :
|
||||
MLOG_CALWAYS3 ("%sComp Nest %s: %s",
|
||||
sp[indent],
|
||||
sp2[indent],
|
||||
aa->u.component);
|
||||
if (++indent >= MAX_INDENT)
|
||||
indent--;
|
||||
break;
|
||||
case AA_INDEX_NEST :
|
||||
MLOG_CALWAYS3 ("%sIndex Nest %s: %ld",
|
||||
sp[indent],
|
||||
sp2[indent],
|
||||
aa->u.index);
|
||||
if (++indent >= MAX_INDENT)
|
||||
indent--;
|
||||
break;
|
||||
case AA_INDEX_RANGE_NEST :
|
||||
MLOG_CALWAYS4 ("%sRange Nest %s: Low = %ld, Num = %ld",
|
||||
sp[indent],
|
||||
sp2[indent],
|
||||
aa->u.ir.low_index,
|
||||
aa->u.ir.num_elmnts);
|
||||
if (++indent >= MAX_INDENT)
|
||||
indent--;
|
||||
break;
|
||||
case AA_END_NEST :
|
||||
MLOG_CALWAYS2 ("%sEnd Nest %s:",
|
||||
sp[indent],
|
||||
sp2[indent]);
|
||||
if (--indent < 0)
|
||||
indent++;
|
||||
break;
|
||||
|
||||
default : /* should not be any other tag */
|
||||
MLOG_CALWAYS1 (" **** UNKNOWN ELEMENT %02d ",i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
#endif
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* ms_aa_to_asn1_2 */
|
||||
/************************************************************************/
|
||||
ST_RET ms_aa_to_asn1_2 (ALT_ACCESS *alt_acc, /* info to be encoded */
|
||||
ST_UCHAR *buf_ptr, /* buffer in which to encode */
|
||||
ST_INT buf_len, /* buffer length */
|
||||
ST_UCHAR **asn1_ptr_out, /* ptr to ptr to encoded data */
|
||||
ST_INT *asn1_len_out) /* ptr to encoded length */
|
||||
{
|
||||
ASN1_ENC_CTXT aCtx;
|
||||
ST_RET retcode;
|
||||
|
||||
asn1r_strt_asn1_bld (&aCtx, buf_ptr, buf_len); /* start build*/
|
||||
retcode = ms_aa_to_asn1 (&aCtx, alt_acc);
|
||||
if (retcode == SD_SUCCESS)
|
||||
{
|
||||
*asn1_ptr_out = ASN1_ENC_PTR(&aCtx);
|
||||
*asn1_len_out = ASN1_ENC_LEN(&aCtx);
|
||||
}
|
||||
return (retcode);
|
||||
}
|
||||
390
mmslib/mmsl/mms_aref.c
Normal file
390
mmslib/mmsl/mms_aref.c
Normal file
@@ -0,0 +1,390 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2005, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : mms_aref.c */
|
||||
/* PRODUCT(S) : MMS-EASE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains functions for encoding and decoding and the */
|
||||
/* general manipulation of Application References. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 04/04/05 EJV 07 MMSEASE: needs suicscse.h. */
|
||||
/* 02/28/05 EJV 05 Elim Linux warnings in if (a=b) */
|
||||
/* 03/28/05 JRB 05 Del suicacse header. */
|
||||
/* 03/11/04 GLB 04 Cleaned up "thisFileName" */
|
||||
/* 12/20/01 JRB 03 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 02 Added SD_CONST modifiers */
|
||||
/* 07/29/97 DSF 01 Moved some of this functionality to SUIC */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
|
||||
#include "sysincs.h"
|
||||
#include "glbsem.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pcon.h"
|
||||
#include "asn1defs.h"
|
||||
#ifndef MMS_LITE
|
||||
#include "suicacse.h"
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/* For debug version, use a static pointer to avoid duplication of */
|
||||
/* __FILE__ strings. */
|
||||
|
||||
#if defined(DEBUG_SISCO) && defined(S_MT_SUPPORT)
|
||||
SD_CONST static ST_CHAR *SD_CONST thisFileName = __FILE__;
|
||||
#endif
|
||||
|
||||
static APP_REF *ar_fill_ptr;
|
||||
|
||||
static ST_VOID ap_title_strt (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID ap_invoke_strt (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID ae_qual_strt (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID ae_invoke_strt (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID ar_ref_asn1_decode_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID ae_invoke_get (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID ae_qual_cnstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID ae_qual_get (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID ap_invoke_cnstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID ap_invoke_get (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID ap_cnstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID ap_title_get (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID ar_cnstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID ar_ref_strt (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
/**************************************************************************/
|
||||
/* ms_appref_to_asn1 */
|
||||
/* Function to convert from an intermediate for of an ApplicationReference*/
|
||||
/* to ASN.1. Function only supports FORM_2 of and ApplicationReference */
|
||||
/**************************************************************************/
|
||||
|
||||
ST_RET ms_appref_to_asn1 (APP_REF *ar_ref_ptr, ST_UCHAR *build_buf_ptr,
|
||||
ST_INT build_buf_len, ST_UCHAR **ret_ptr,
|
||||
ST_INT *ret_len)
|
||||
{
|
||||
ST_INT ret_val;
|
||||
ASN1_ENC_CTXT localEncCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_ENC_CTXT *aCtx = &localEncCtx;
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
if (ar_ref_ptr->form == APP_REF_FORM2)
|
||||
{
|
||||
asn1r_strt_asn1_bld (aCtx, build_buf_ptr,build_buf_len);
|
||||
asn1r_strt_constr (aCtx);
|
||||
|
||||
if (ar_ref_ptr->ae_invoke_pres)
|
||||
{
|
||||
asn1r_strt_constr (aCtx);
|
||||
asn1r_wr_i32 (aCtx, ar_ref_ptr->ae_invoke);
|
||||
asn1r_fin_prim (aCtx, INT_CODE,UNI);
|
||||
asn1r_fin_constr (aCtx, 3,CTX,DEF);
|
||||
}
|
||||
|
||||
if (ar_ref_ptr->ae_qual_pres)
|
||||
{
|
||||
asn1r_strt_constr (aCtx);
|
||||
asn1r_wr_i32 (aCtx, ar_ref_ptr->ae_qual.form_2);
|
||||
asn1r_fin_prim (aCtx, INT_CODE,UNI);
|
||||
asn1r_fin_constr (aCtx, 2,CTX,DEF);
|
||||
}
|
||||
|
||||
if (ar_ref_ptr->ap_invoke_pres)
|
||||
{
|
||||
asn1r_strt_constr (aCtx);
|
||||
asn1r_wr_i32 (aCtx, ar_ref_ptr->ap_invoke);
|
||||
asn1r_fin_prim (aCtx, INT_CODE,UNI);
|
||||
asn1r_fin_constr (aCtx, 1,CTX,DEF);
|
||||
}
|
||||
|
||||
if ((ar_ref_ptr->ap_title.form_2.num_comps) &&
|
||||
(ar_ref_ptr->ap_title_pres))
|
||||
{
|
||||
asn1r_strt_constr (aCtx);
|
||||
asn1r_wr_objid (aCtx, &ar_ref_ptr->ap_title.form_2.comps[0],
|
||||
ar_ref_ptr->ap_title.form_2.num_comps);
|
||||
asn1r_fin_prim (aCtx, OBJ_ID_CODE,UNI);
|
||||
asn1r_fin_constr (aCtx, 0,CTX,DEF);
|
||||
}
|
||||
|
||||
asn1r_fin_constr (aCtx, SEQ_CODE,UNI,DEF);
|
||||
|
||||
*ret_ptr = aCtx->asn1r_field_ptr+1;
|
||||
*ret_len = (&build_buf_ptr[build_buf_len] - aCtx->asn1r_field_ptr -1) & 0xffff;
|
||||
ret_val = SD_SUCCESS;
|
||||
}
|
||||
else /* not form 2 */
|
||||
ret_val = MVE_BAD_APP_REF_FORM;
|
||||
|
||||
/* Check for encode overrun */
|
||||
if (aCtx->asn1r_encode_overrun)
|
||||
ret_val = ME_ASN1_ENCODE_OVERRUN;
|
||||
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ret_val);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* DECODE FUNCTIONS FOR APPLICATION REFERENCE */
|
||||
/* ms_asn1_to_appref */
|
||||
/* Function to convert an ASN.1 encoded ApplicationReference to an */
|
||||
/* intermediate form. These decode functions only support FORM_2 */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET ms_asn1_to_appref (APP_REF *ar_ref_ptr, ST_UCHAR *buf_ptr, ST_INT buf_len)
|
||||
{
|
||||
ST_RET ret;
|
||||
ASN1_DEC_CTXT localDecCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_DEC_CTXT *aCtx = &localDecCtx;
|
||||
|
||||
memset (aCtx, 0, sizeof (ASN1_DEC_CTXT)); /* CRITICAL: start clean. */
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
ar_fill_ptr = ar_ref_ptr;
|
||||
if (*buf_ptr == (CONSTR | SEQ_CODE))
|
||||
ar_fill_ptr->form = APP_REF_FORM2;
|
||||
else
|
||||
ar_fill_ptr->form = APP_REF_FORM1;
|
||||
ar_fill_ptr->ap_title.form_2.num_comps = 0;
|
||||
ar_fill_ptr->ap_invoke_pres = SD_FALSE;
|
||||
ar_fill_ptr->ae_qual_pres = SD_FALSE;
|
||||
ar_fill_ptr->ae_invoke_pres = SD_FALSE;
|
||||
|
||||
aCtx->asn1r_decode_method = ASN1_TAG_METHOD;
|
||||
ASN1R_TAG_ADD (aCtx, UNI|CONSTR,SEQ_CODE,ar_ref_strt);
|
||||
aCtx->asn1r_decode_done_fun = asn1r_done_err;
|
||||
aCtx->asn1r_err_fun = NULL;
|
||||
asn1r_decode_asn1 (aCtx, buf_ptr,buf_len);
|
||||
|
||||
if (aCtx->asn1r_pdu_dec_err == NO_DECODE_ERR)
|
||||
ret = SD_SUCCESS;
|
||||
else
|
||||
ret = SD_FAILURE;
|
||||
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
||||
static ST_VOID ar_ref_strt (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,0,ap_title_strt);
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,1,ap_invoke_strt);
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,2,ae_qual_strt);
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,3,ae_invoke_strt);
|
||||
aCtx->asn1r_decode_done_fun = ar_ref_asn1_decode_done;
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = ar_cnstr_done;
|
||||
}
|
||||
|
||||
static ST_VOID ar_cnstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
}
|
||||
|
||||
static ST_VOID ap_title_strt (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, UNI,OBJ_ID_CODE,ap_title_get);
|
||||
aCtx->asn1r_decode_done_fun = asn1r_done_err;
|
||||
}
|
||||
|
||||
static ST_VOID ap_title_get (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
asn1r_get_objid (aCtx, &ar_fill_ptr->ap_title.form_2.comps[0],
|
||||
&ar_fill_ptr->ap_title.form_2.num_comps);
|
||||
if (ar_fill_ptr->ap_title.form_2.num_comps)
|
||||
ar_fill_ptr->ap_title_pres = SD_TRUE;
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = ap_cnstr_done;
|
||||
}
|
||||
|
||||
static ST_VOID ap_cnstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,1,ap_invoke_strt);
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,2,ae_qual_strt);
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,3,ae_invoke_strt);
|
||||
aCtx->asn1r_decode_done_fun = ar_ref_asn1_decode_done;
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = ar_cnstr_done;
|
||||
}
|
||||
|
||||
static ST_VOID ap_invoke_strt (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, UNI,INT_CODE,ap_invoke_get);
|
||||
aCtx->asn1r_decode_done_fun = asn1r_done_err;
|
||||
}
|
||||
|
||||
static ST_VOID ap_invoke_get (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
if (!asn1r_get_i32 (aCtx, &ar_fill_ptr->ap_invoke))
|
||||
ar_fill_ptr->ap_invoke_pres = SD_TRUE;
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = ap_invoke_cnstr_done;
|
||||
}
|
||||
|
||||
static ST_VOID ap_invoke_cnstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,2,ae_qual_strt);
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,3,ae_invoke_strt);
|
||||
aCtx->asn1r_decode_done_fun = ar_ref_asn1_decode_done;
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = ar_cnstr_done;
|
||||
}
|
||||
|
||||
static ST_VOID ae_qual_strt (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, UNI,INT_CODE,ae_qual_get);
|
||||
aCtx->asn1r_decode_done_fun = asn1r_done_err;
|
||||
}
|
||||
|
||||
static ST_VOID ae_qual_get (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
if (!asn1r_get_i32 (aCtx, &ar_fill_ptr->ae_qual.form_2))
|
||||
ar_fill_ptr->ae_qual_pres = SD_TRUE;
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = ae_qual_cnstr_done;
|
||||
}
|
||||
|
||||
static ST_VOID ae_qual_cnstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,3,ae_invoke_strt);
|
||||
aCtx->asn1r_decode_done_fun = ar_ref_asn1_decode_done;
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = ar_cnstr_done;
|
||||
}
|
||||
|
||||
static ST_VOID ae_invoke_strt (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, UNI,INT_CODE,ae_invoke_get);
|
||||
aCtx->asn1r_decode_done_fun = asn1r_done_err;
|
||||
}
|
||||
|
||||
static ST_VOID ae_invoke_get (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
if (!asn1r_get_i32 (aCtx, &ar_fill_ptr->ae_invoke))
|
||||
ar_fill_ptr->ae_invoke_pres = SD_TRUE;
|
||||
aCtx->asn1r_decode_done_fun = ar_ref_asn1_decode_done;
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = ar_cnstr_done;
|
||||
}
|
||||
|
||||
static ST_VOID ar_ref_asn1_decode_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
|
||||
/************************************************************************/
|
||||
/* ms_arname_to_asn1 */
|
||||
/* Function to convert from an arname to the ASN.1 encoded equivalent of*/
|
||||
/* the ApplicationReference that corresponds to it. Returns SD_SUCCESS or */
|
||||
/* ERROR CODE. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET ms_arname_to_asn1 (ST_CHAR *arname, ST_UCHAR *buf_ptr,
|
||||
ST_INT buf_len, ST_UCHAR **ret_ptr_addr,
|
||||
ST_INT *ret_len_addr)
|
||||
{
|
||||
ST_RET ret_val;
|
||||
APP_REF *app_ref_ptr;
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
ret_val = MVE_DATA_CONVERT;
|
||||
if (!(ret_val = ms_arname_to_appref (arname, &app_ref_ptr)))
|
||||
{
|
||||
ret_val = ms_appref_to_asn1(app_ref_ptr, buf_ptr, buf_len,
|
||||
ret_ptr_addr, ret_len_addr);
|
||||
}
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ret_val);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* ms_asn1_to_arname */
|
||||
/* Function to convert from an ASN.1 encoded application reference to */
|
||||
/* the arname that corresponds to it. Return SD_SUCCESS or ERROR CODE. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET ms_asn1_to_arname (ST_CHAR *arname, ST_UCHAR *asn1_ptr, ST_INT asn1_len)
|
||||
{
|
||||
ST_RET ret_val;
|
||||
APP_REF app_reference;
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
ret_val = MVE_ASN1_DECODE_ERR;
|
||||
if (!(ret_val = ms_asn1_to_appref (&app_reference, asn1_ptr, asn1_len)))
|
||||
{
|
||||
ret_val = ms_appref_to_arname (arname, &app_reference);
|
||||
}
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ret_val);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* ms_arname_to_appref */
|
||||
/* Function to convert from the C representation of an arname to the C */
|
||||
/* representation of an ApplicationReference. Returns SD_SUCCESS or */
|
||||
/* ERROR CODE. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET ms_arname_to_appref (ST_CHAR *arname, APP_REF **appref_ptr_addr)
|
||||
{
|
||||
ST_RET ret_val;
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
ret_val = MVE_DATA_CONVERT;
|
||||
if (arname)
|
||||
{
|
||||
if ((*appref_ptr_addr = s_find_proc (arname)) != NULL)
|
||||
ret_val = SD_SUCCESS;
|
||||
}
|
||||
else
|
||||
*appref_ptr_addr = NULL;
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ret_val);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* ms_appref_to_arname */
|
||||
/* Function to convert from the C representation of an ApplicationRef. */
|
||||
/* to the C representation of an arname. Returns SD_SUCCESS or ERROR CODE.*/
|
||||
/* The argument arname has to be a pointer to a place big enough to */
|
||||
/* hold the arname (MAX_AR_LEN+1). */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET ms_appref_to_arname (ST_CHAR *arname, APP_REF *appref_addr)
|
||||
{
|
||||
ST_RET ret;
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
ret = MVE_DATA_CONVERT;
|
||||
if (arname && appref_addr)
|
||||
{ /* match the AE-Qualifier */
|
||||
if (s_find_arname (appref_addr, appref_addr->ae_qual_pres, arname))
|
||||
ret = SD_SUCCESS;
|
||||
}
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
#endif /* end ifndef MMS_LITE */
|
||||
/************************************************************************/
|
||||
265
mmslib/mmsl/mms_ced.c
Normal file
265
mmslib/mmsl/mms_ced.c
Normal file
@@ -0,0 +1,265 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2002, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : mms_ced.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains common primitive encode/decode functions. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 01/22/02 JRB 05 Add _ms_fin_pdu & _ms_fin_pdu_log (these */
|
||||
/* replace functionality of _ms_fin_pdu_debug). */
|
||||
/* Use new "asn1r_buf_end" instead of globals. */
|
||||
/* 12/20/01 JRB 04 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 04/28/00 JRB 03 Lint cleanup */
|
||||
/* 09/13/99 MDE 02 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 01 Changes to decode buffer allocation scheme */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* For debug version, use a static pointer to avoid duplication of */
|
||||
/* __FILE__ strings. */
|
||||
/************************************************************************/
|
||||
|
||||
#ifdef DEBUG_SISCO
|
||||
SD_CONST static ST_CHAR *SD_CONST thisFileName = __FILE__;
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* COMPANION STANDARD INFO DECODE FUNCTIONS */
|
||||
/************************************************************************/
|
||||
|
||||
#ifdef CS_SUPPORT
|
||||
static ST_VOID mms_cs_start (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID mms_cs_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_set_cs_check */
|
||||
/* This function is used to check for CS info after rest of PDU has */
|
||||
/* been decoded. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_set_cs_check (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
aCtx->asn1r_decode_done_fun = _mms_dec_done_ok;
|
||||
_ms_set_cs_check2 (aCtx);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _ms_set_cs_check2 */
|
||||
/* use this function to avoid setting the aCtx->asn1r_decode_done_fun */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_set_cs_check2 (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
aCtx->asn1r_decode_method = ASN1_TAG_METHOD; /* need to use TAG method */
|
||||
|
||||
#ifdef CS_SUPPORT
|
||||
#ifndef MMS_LITE
|
||||
if (mms_chan_info[_mmsdechan].version) /* IS only */
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,79,mms_cs_start); /* need to check for CS */
|
||||
#else
|
||||
if (mmsl_version) /* IS only */
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,79,mms_cs_start); /* need to check for CS */
|
||||
#endif
|
||||
#endif
|
||||
/* in case this is cstr done */
|
||||
if (!aCtx->asn1r_msg_level)
|
||||
aCtx->asn1r_c_done_fun[1] = NULL; /* OK for all to be complete */
|
||||
else /* need to go through all upper levels */
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = _ms_set_cs_check2;
|
||||
}
|
||||
|
||||
|
||||
#ifdef CS_SUPPORT
|
||||
/************************************************************************/
|
||||
/* mms_cs_start */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID mms_cs_start (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
_mmsdec_rslt->cs.cs_ptr = aCtx->asn1r_field_ptr; /* start of CS info */
|
||||
asn1r_set_all_cstr_done (aCtx); /* clear up all cstr done's */
|
||||
asn1r_parse_cstr_contents (aCtx, mms_cs_cstr_done); /* verify ASN.1 */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* mms_cs_cstr_done */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID mms_cs_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
_mmsdec_rslt->cs.cs_pres = SD_TRUE; /* CS info was OK */
|
||||
_mmsdec_rslt->cs.cs_len = aCtx->asn1r_field_ptr - _mmsdec_rslt->cs.cs_ptr;
|
||||
aCtx->asn1r_decode_done = SD_TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* EXTERNAL decode functions */
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_chk_for_extern */
|
||||
/************************************************************************/
|
||||
/* This function is called when adding tags when an EXTERNAL may be */
|
||||
/* encountered. Pass in the destination and the constructor done fun */
|
||||
/* Currently do not parse EXTERNAL itself, allow user to do this. */
|
||||
|
||||
static ST_VOID (*ext_done_fun)(ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
static ST_VOID ext_seq_start (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
static ST_INT *ext_len_ptr; /* save in case EXTERNAL found */
|
||||
static ST_UCHAR **ext_buf_ptr_ptr;
|
||||
|
||||
ST_VOID _ms_chk_for_extern (ASN1_DEC_CTXT *aCtx, ST_INT *len_ptr, ST_UCHAR **buf_ptr_ptr,
|
||||
ST_VOID (*done_fun)(ASN1_DEC_CTXT *aCtx))
|
||||
{
|
||||
ASN1R_TAG_ADD (aCtx, UNI|CONSTR,EXTERN_CODE,ext_seq_start); /* get the EXT seq*/
|
||||
ext_done_fun = done_fun;
|
||||
ext_len_ptr = len_ptr;
|
||||
ext_buf_ptr_ptr = buf_ptr_ptr;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* ext_seq_start */
|
||||
/* External encountered */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID ext_seq_start (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("ext_seq_start");
|
||||
|
||||
/* save pointer and length of the external data element */
|
||||
*ext_len_ptr = aCtx->asn1r_elmnt_len + (aCtx->asn1r_field_ptr - aCtx->asn1r_field_start);
|
||||
*ext_buf_ptr_ptr = aCtx->asn1r_field_start;
|
||||
|
||||
asn1r_parse_cstr_contents (aCtx, ext_done_fun);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* GENERAL DECODE FUNCTIONS */
|
||||
/************************************************************************/
|
||||
/* mms_req_not_supp */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_req_not_supp (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("mms_req_not_supp");
|
||||
|
||||
if (_mmsdec_rslt->op == MMSOP_INFO_RPT ||
|
||||
_mmsdec_rslt->op == MMSOP_USTATUS ||
|
||||
_mmsdec_rslt->op == MMSOP_EVENT_NOT)
|
||||
asn1r_set_dec_err (aCtx, UNCONF_UNREC_SERV);
|
||||
else
|
||||
asn1r_set_dec_err (aCtx, REQ_UNREC_SERV);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* mms_rsp_not_supp */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_rsp_not_supp (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("mms_rsp_not_supp ");
|
||||
|
||||
asn1r_set_dec_err (aCtx, RESP_UNREC_SERV);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _mms_null_pdu_dec */
|
||||
/* This function is called from MMSDEC when the opcode for a NULL PDU */
|
||||
/* is being decoded. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _mms_null_pdu_dec (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("Decoding Null PDU (examine opcode for service)");
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check to see of CS info pres */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _mms_dec_done_ok */
|
||||
/* general decode done function, used for most primitive decodes */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _mms_dec_done_ok (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
_mmsdec_rslt->data_pres = _mms_dec_info_pres; /* write data pres flag */
|
||||
_mmsdec_rslt->data_ptr = _mms_dec_info; /* write pointer */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _mms_dec_buf_free */
|
||||
/* error decoding the request: free allocated storage. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _mms_dec_buf_free (ASN1_DEC_CTXT *aCtx, ST_RET err)
|
||||
{
|
||||
(*m_free_os_fun)(_mms_dec_info);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _ms_fin_pdu */
|
||||
/* User passes ptr to PDU len pPduLen, this function sets (*pPduLen). */
|
||||
/* RETURNS: pointer to MMS PDU */
|
||||
/************************************************************************/
|
||||
|
||||
ST_UCHAR *_ms_fin_pdu (ASN1_ENC_CTXT *aCtx, ST_INT type, ST_INT *pPduLen)
|
||||
{
|
||||
asn1r_fin_constr (aCtx, (ST_INT16)type, CTX,DEF);
|
||||
*pPduLen = aCtx->asn1r_buf_end - aCtx->asn1r_field_ptr;
|
||||
return (aCtx->asn1r_field_ptr + 1);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_SISCO
|
||||
/************************************************************************/
|
||||
/* _ms_fin_pdu_log */
|
||||
/* Write complete MMS PDU to log. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_fin_pdu_log (ST_INT type, ST_CHAR *msg_ptr,
|
||||
ST_UCHAR *pduPtr, ST_INT pduLen)
|
||||
{
|
||||
/* Do PDU Encode logging */
|
||||
if (type == MMSRESP)
|
||||
{
|
||||
MLOG_ENC2 ("%s Response built : len = %d",msg_ptr, pduLen);
|
||||
}
|
||||
else
|
||||
{
|
||||
MLOG_ENC2 ("%s Request built : len = %d",msg_ptr, pduLen);
|
||||
}
|
||||
MLOG_ENCH (pduLen,pduPtr);
|
||||
|
||||
return;
|
||||
}
|
||||
#endif /* DEBUG_SISCO */
|
||||
|
||||
223
mmslib/mmsl/mms_ced3.c
Normal file
223
mmslib/mmsl/mms_ced3.c
Normal file
@@ -0,0 +1,223 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : mms_ced3.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains common primitive encode/decode functions */
|
||||
/* particular to getting and writing object names. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 12/02/03 MDE 04 Added log for invalid object name tag */
|
||||
/* 12/20/01 JRB 03 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 02 Added SD_CONST modifiers */
|
||||
/* 06/09/97 MDE 01 Fixed object name decode for COMPACT */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* For debug version, use a static pointer to avoid duplication of */
|
||||
/* __FILE__ strings. */
|
||||
|
||||
#ifdef DEBUG_SISCO
|
||||
SD_CONST static ST_CHAR *SD_CONST thisFileName = __FILE__;
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID objname_get_item_id (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID objname_get_domain_id (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID objname_get_vmd_spec (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID objname_dom_spec_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID objname_dom_spec_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID objname_get_aa_spec (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
/************************************************************************/
|
||||
/* global structures & functions */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID (*get_mms_objname_done) (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
static OBJECT_NAME *obj_ptr;
|
||||
|
||||
static ST_RET _error_code;
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_get_mms_objname */
|
||||
/* Function to get an MMS object name from the received message. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_get_mms_objname (ASN1_DEC_CTXT *aCtx, OBJECT_NAME *data_ptr, ST_VOID (*done_fun) (ASN1_DEC_CTXT *aCtx))
|
||||
{
|
||||
/* set decode error for request or response */
|
||||
if (_mmsdec_rslt->type == MMSRESP)
|
||||
_error_code = RESP_BAD_VALUE;
|
||||
else
|
||||
_error_code = REQ_BAD_VALUE;
|
||||
|
||||
obj_ptr = data_ptr;
|
||||
get_mms_objname_done = done_fun;
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 0, objname_get_vmd_spec);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 1, objname_dom_spec_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 2, objname_get_aa_spec);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* objname_get_vmd_spec */
|
||||
/* vmd-specific name was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID objname_get_vmd_spec (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("objname_get_vmd_spec");
|
||||
|
||||
obj_ptr->object_tag = VMD_SPEC; /* set tag to vmd specific */
|
||||
|
||||
#if defined(USE_COMPACT_MMS_STRUCTS)
|
||||
obj_ptr->obj_name.vmd_spec = (ST_CHAR *) (aCtx->asn1r_field_ptr - 1);
|
||||
#endif
|
||||
/* read name from message */
|
||||
if (asn1r_get_identifier (aCtx, obj_ptr->obj_name.vmd_spec))
|
||||
asn1r_set_dec_err (aCtx, _error_code);
|
||||
|
||||
(*get_mms_objname_done) (aCtx); /* all done, call user set fun */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* objname_dom_spec_cstr */
|
||||
/* domain specific constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID objname_dom_spec_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("objname_dom_spec_cstr");
|
||||
|
||||
obj_ptr->object_tag = DOM_SPEC; /* set tag to domain specific */
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, UNI, VISTR_CODE, objname_get_domain_id);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* objname_get_domain_id */
|
||||
/* domain id was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID objname_get_domain_id (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("objname_get_domain_id");
|
||||
|
||||
#if defined(USE_COMPACT_MMS_STRUCTS)
|
||||
obj_ptr->domain_id = (ST_CHAR *) (aCtx->asn1r_field_ptr - 1);
|
||||
#endif
|
||||
/* read name from message */
|
||||
if (asn1r_get_identifier (aCtx, obj_ptr->domain_id))
|
||||
asn1r_set_dec_err (aCtx, _error_code);
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, UNI, VISTR_CODE, objname_get_item_id);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* objname_get_item_id */
|
||||
/* item id was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID objname_get_item_id (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("objname_get_item_id");
|
||||
|
||||
#if defined(USE_COMPACT_MMS_STRUCTS)
|
||||
obj_ptr->obj_name.item_id = (ST_CHAR *) (aCtx->asn1r_field_ptr - 1);
|
||||
#endif
|
||||
/* read name from message */
|
||||
if (asn1r_get_identifier (aCtx, obj_ptr->obj_name.item_id))
|
||||
asn1r_set_dec_err (aCtx, _error_code);
|
||||
/* set constructor done fun */
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = objname_dom_spec_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* objname_dom_spec_cstr_done */
|
||||
/* domain specific constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID objname_dom_spec_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
(*get_mms_objname_done) (aCtx); /* all done, call user set fun */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* objname_get_aa_spec */
|
||||
/* aa-specific name was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID objname_get_aa_spec (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("objname_get_aa_spec");
|
||||
|
||||
obj_ptr->object_tag = AA_SPEC; /* set tag to aa specific */
|
||||
|
||||
#if defined(USE_COMPACT_MMS_STRUCTS)
|
||||
obj_ptr->obj_name.aa_spec = (ST_CHAR *) (aCtx->asn1r_field_ptr - 1);
|
||||
#endif
|
||||
/* read name from message */
|
||||
if (asn1r_get_identifier (aCtx, obj_ptr->obj_name.aa_spec))
|
||||
asn1r_set_dec_err (aCtx, _error_code);
|
||||
|
||||
(*get_mms_objname_done) (aCtx); /* all done, call user set fun */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_wr_mms_objname */
|
||||
/* Function to write an MMS object name to the message. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_wr_mms_objname (ASN1_ENC_CTXT *aCtx, OBJECT_NAME *data_ptr)
|
||||
{
|
||||
switch (data_ptr->object_tag)
|
||||
{
|
||||
case (VMD_SPEC) : /* write the vmd specific name */
|
||||
asn1r_wr_vstr (aCtx, data_ptr->obj_name.vmd_spec);
|
||||
asn1r_fin_prim (aCtx, 0, CTX); /* context tag 0 */
|
||||
break;
|
||||
|
||||
case (DOM_SPEC) : /* write domain specific name */
|
||||
asn1r_strt_constr (aCtx);
|
||||
asn1r_wr_vstr (aCtx, data_ptr->obj_name.item_id);
|
||||
asn1r_fin_prim (aCtx, VISTR_CODE, UNI); /* universal string */
|
||||
asn1r_wr_vstr (aCtx, data_ptr->domain_id);
|
||||
asn1r_fin_prim (aCtx, VISTR_CODE, UNI); /* universal string */
|
||||
asn1r_fin_constr (aCtx, 1,CTX,DEF); /* context tag 1 */
|
||||
break;
|
||||
|
||||
case (AA_SPEC) : /* write the aa specific name */
|
||||
asn1r_wr_vstr (aCtx, data_ptr->obj_name.aa_spec);
|
||||
asn1r_fin_prim (aCtx, 2,CTX); /* context tag 2 */
|
||||
break;
|
||||
|
||||
default:
|
||||
MLOG_NERR1 ("Invalid object_tag: %d", data_ptr->object_tag);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
936
mmslib/mmsl/mms_ced4.c
Normal file
936
mmslib/mmsl/mms_ced4.c
Normal file
@@ -0,0 +1,936 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : mms_ced4.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains common primitive encode/decode functions */
|
||||
/* particular to getting and writing variables. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 02/09/09 JRB 04 Allow any value for DataAccessError. */
|
||||
/* 03/11/04 GLB 03 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 02 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 01 Added SD_CONST modifiers */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pvar.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
static ST_VOID va_spec_objname_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID va_spec_vlist_list_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID va_spec_vlist_name_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID va_vlist_alt_acc_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID va_vlist_alt_acc_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID va_vlist_useq_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID va_vlist_var_spec_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID va_vlist_useq_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID va_var_spec_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID var_spec_type_spec (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID var_spec_objname_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID var_spec_address_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID var_spec_var_descr_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID var_spec_scat_acc_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID var_spec_get_null (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID alt_access_get_aa_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID scat_access_get_sa_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID type_spec_get_tspec_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID vdata_get_data_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID access_rslt_get_data_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID access_rslt_cstr_parse (ASN1_DEC_CTXT *aCtx, ST_UINT16 id);
|
||||
static ST_VOID access_rslt_get_result (ASN1_DEC_CTXT *aCtx, ST_UINT16 id);
|
||||
static ST_VOID address_unc_addr_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID address_get_num_addr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID address_get_sym_addr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID address_get_unc_addr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID address_unc_addr_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID (*get_va_address_done) (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID (*get_va_access_rslt_done) (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID (*get_va_data_done) (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID (*get_va_type_spec_done) (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID (*get_va_scat_access_done) (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID (*get_va_alt_access_done) (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID (*get_va_var_spec_done) (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID (*get_va_spec_done) (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID var_spec_cstr_get_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID va_spec_done (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
/************************************************************************/
|
||||
/* global structures & functions */
|
||||
/************************************************************************/
|
||||
|
||||
static VAR_ACC_ADDR *addr_ptr;
|
||||
static ACCESS_RESULT *acc_rslt_ptr;
|
||||
static VAR_ACC_DATA *vdata_ptr;
|
||||
static VAR_ACC_TSPEC *tspec_ptr;
|
||||
static SCATTERED_ACCESS *scat_acc_ptr;
|
||||
static ALTERNATE_ACCESS *alt_acc_ptr;
|
||||
static VARIABLE_SPEC *var_spec_ptr;
|
||||
static VARIABLE_LIST *var_list_ptr;
|
||||
static VAR_ACC_SPEC *va_spec_ptr;
|
||||
static VARIABLE_LIST *va_spec_vlist_ptr;
|
||||
|
||||
static ST_INT *NUM_OF_VARS;
|
||||
static ST_INT MAX_VARS;
|
||||
static ST_RET ERROR_CODE;
|
||||
static ST_INT save_dec_method;
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_get_va_address */
|
||||
/* Function to get a variable access address from the received message. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_get_va_address (ASN1_DEC_CTXT *aCtx, VAR_ACC_ADDR *data_ptr, ST_VOID (*done_fun) (ASN1_DEC_CTXT *aCtx))
|
||||
{
|
||||
|
||||
/* set decode error for request or response */
|
||||
if (_mmsdec_rslt->type == MMSRESP)
|
||||
ERROR_CODE = RESP_BAD_VALUE;
|
||||
else
|
||||
ERROR_CODE = REQ_BAD_VALUE;
|
||||
|
||||
addr_ptr = data_ptr;
|
||||
get_va_address_done = done_fun;
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 0, address_get_num_addr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 1, address_get_sym_addr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 2, address_get_unc_addr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 2, address_unc_addr_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* address_get_num_addr */
|
||||
/* numeric address was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID address_get_num_addr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("get_num_addr");
|
||||
|
||||
addr_ptr->addr_tag = 0; /* set tag to numeric address */
|
||||
|
||||
/* read numeric address */
|
||||
if (asn1r_get_u32 (aCtx, &addr_ptr->addr.num_addr))
|
||||
asn1r_set_dec_err (aCtx, ERROR_CODE);
|
||||
|
||||
(*get_va_address_done) (aCtx); /* all done, call user set fun */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* address_get_sym_addr */
|
||||
/* symbolic address was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID address_get_sym_addr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("address_get_sym_addr");
|
||||
|
||||
addr_ptr->addr_tag = 1; /* set tag to symbolic address */
|
||||
|
||||
/* decode symbolic address onto itself, shifted by 1 ST_CHAR */
|
||||
addr_ptr->addr.sym_addr = (ST_CHAR *) aCtx->asn1r_field_ptr - 1;
|
||||
/* read symbolic address */
|
||||
if (asn1r_get_vstr (aCtx, addr_ptr->addr.sym_addr))
|
||||
asn1r_set_dec_err (aCtx, ERROR_CODE);
|
||||
|
||||
(*get_va_address_done) (aCtx); /* all done, call user set fun */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* address_get_unc_addr */
|
||||
/* unconstrained address primitive was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID address_get_unc_addr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("address_get_unc_addr");
|
||||
|
||||
addr_ptr->addr_tag = 2; /* set tag to unconstrained */
|
||||
|
||||
/* decode unconstrained address onto itself, shifted by 1 ST_CHAR */
|
||||
addr_ptr->addr.unc_addr.unc_ptr = aCtx->asn1r_field_ptr - 1;
|
||||
/* read unconstrained address */
|
||||
if (asn1r_get_octstr (aCtx, addr_ptr->addr.unc_addr.unc_ptr))
|
||||
asn1r_set_dec_err (aCtx, ERROR_CODE);
|
||||
/* save the address length */
|
||||
addr_ptr->addr.unc_addr.unc_len = aCtx->asn1r_octetcount;
|
||||
|
||||
(*get_va_address_done) (aCtx); /* all done, call user set fun */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* address_unc_addr_cstr */
|
||||
/* unconstrained address constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID address_unc_addr_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("address_unc_addr_cstr");
|
||||
|
||||
addr_ptr->addr_tag = 2; /* set tag to unconstrained */
|
||||
|
||||
/* decode unconstrained address onto itself, shifted by 1 ST_CHAR */
|
||||
addr_ptr->addr.unc_addr.unc_ptr = aCtx->asn1r_field_ptr - 1;
|
||||
|
||||
/* set up where to go when done decoding cstr */
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = address_unc_addr_cstr_done;
|
||||
|
||||
/* read unconstrained address from message */
|
||||
asn1r_get_octstr_cstr (aCtx, _mmsdec_msglen, addr_ptr->addr.unc_addr.unc_ptr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* address_unc_addr_cstr_done */
|
||||
/* unconstrained address constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID address_unc_addr_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
/* save the address length */
|
||||
addr_ptr->addr.unc_addr.unc_len = aCtx->asn1r_octetcount;
|
||||
|
||||
(*get_va_address_done) (aCtx); /* all done, call user set fun */
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_get_va_access_rslt */
|
||||
/* Function to get a variable access access result from the received */
|
||||
/* message. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_get_va_access_rslt (ASN1_DEC_CTXT *aCtx, ACCESS_RESULT *data_ptr,
|
||||
ST_VOID (*done_fun) (ASN1_DEC_CTXT *aCtx))
|
||||
{
|
||||
/* set decode error for request or response */
|
||||
if (_mmsdec_rslt->type == MMSRESP)
|
||||
ERROR_CODE = RESP_BAD_VALUE;
|
||||
else
|
||||
ERROR_CODE = REQ_BAD_VALUE;
|
||||
|
||||
acc_rslt_ptr = data_ptr;
|
||||
get_va_access_rslt_done = done_fun;
|
||||
|
||||
acc_rslt_ptr->va_data.data = aCtx->asn1r_field_ptr; /* set data pointer */
|
||||
|
||||
save_dec_method = aCtx->asn1r_decode_method;
|
||||
aCtx->asn1r_decode_method = ASN1_CLASS_METHOD;
|
||||
|
||||
aCtx->asn1r_c_id_fun = access_rslt_get_result; /* decode access result */
|
||||
aCtx->asn1r_u_id_fun = asn1r_class_err; /* no universals */
|
||||
aCtx->asn1r_a_id_fun = asn1r_class_err; /* no applications */
|
||||
aCtx->asn1r_p_id_fun = asn1r_class_err; /* no privates */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* access_rslt_get_result */
|
||||
/* get access result. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID access_rslt_get_result (ASN1_DEC_CTXT *aCtx, ST_UINT16 id)
|
||||
{
|
||||
MLOG_CDEC0 ("access_rslt_get_result");
|
||||
|
||||
if (aCtx->asn1r_constr_elmnt)
|
||||
{ /* constructor, success */
|
||||
acc_rslt_ptr->acc_rslt_tag = ACC_RSLT_SUCCESS;
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = access_rslt_get_data_done;
|
||||
aCtx->asn1r_c_id_fun = access_rslt_cstr_parse; /* decode access result */
|
||||
}
|
||||
else
|
||||
{ /* primitive */
|
||||
if (id != 0)
|
||||
{ /* success */
|
||||
acc_rslt_ptr->acc_rslt_tag = ACC_RSLT_SUCCESS;
|
||||
aCtx->asn1r_field_ptr += aCtx->asn1r_elmnt_len; /* move past data element */
|
||||
access_rslt_get_data_done (aCtx);
|
||||
}
|
||||
else
|
||||
{ /* failure */
|
||||
acc_rslt_ptr->acc_rslt_tag = ACC_RSLT_FAILURE;
|
||||
/* read data access error */
|
||||
if (asn1r_get_i16 (aCtx, &acc_rslt_ptr->failure))
|
||||
asn1r_set_dec_err (aCtx, ERROR_CODE);
|
||||
/* NOTE: DataAccessError should be [0-11] but allow any val here. */
|
||||
|
||||
aCtx->asn1r_decode_method = save_dec_method; /* restore original dec method */
|
||||
(*get_va_access_rslt_done) (aCtx); /* all done, call user set fun */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* access_rslt_cstr_parse */
|
||||
/* in the middle of a result constructor, just accept the elements */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID access_rslt_cstr_parse (ASN1_DEC_CTXT *aCtx, ST_UINT16 id)
|
||||
{
|
||||
MLOG_CDEC0 ("access_rslt_cstr_parse");
|
||||
|
||||
if (!aCtx->asn1r_constr_elmnt) /* if primitive, need to move */
|
||||
aCtx->asn1r_field_ptr += aCtx->asn1r_elmnt_len; /* aCtx->asn1r_field_ptr */
|
||||
else /* if cstr, need to set cstr */
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = NULL; /* done function == safe */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* access_rslt_get_data_done */
|
||||
/* variable data has been obtianed. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID access_rslt_get_data_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("access_rslt_get_data_done");
|
||||
/* set the variable data length */
|
||||
acc_rslt_ptr->va_data.len =
|
||||
aCtx->asn1r_field_ptr - acc_rslt_ptr->va_data.data;
|
||||
|
||||
aCtx->asn1r_decode_method = save_dec_method; /* restore original dec method */
|
||||
|
||||
(*get_va_access_rslt_done) (aCtx); /* all done, call user set fun */
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_get_va_data */
|
||||
/* Function to get a variable access data from the received message. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_get_va_data (ASN1_DEC_CTXT *aCtx, VAR_ACC_DATA *data_ptr, ST_VOID (*done_fun) (ASN1_DEC_CTXT *aCtx))
|
||||
{
|
||||
|
||||
vdata_ptr = data_ptr;
|
||||
get_va_data_done = done_fun;
|
||||
|
||||
vdata_ptr->data = aCtx->asn1r_field_ptr; /* set data pointer */
|
||||
|
||||
asn1r_parse_next (aCtx, vdata_get_data_done); /* parse entire element */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* vdata_get_data_done */
|
||||
/* variable data has been parsed. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID vdata_get_data_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("vdata_get_data_done");
|
||||
/* set the variable data length */
|
||||
vdata_ptr->len = aCtx->asn1r_field_ptr - vdata_ptr->data;
|
||||
|
||||
(*get_va_data_done) (aCtx); /* all done, call user set fun */
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_get_va_type_spec */
|
||||
/* Function to get a variable access type specification from the */
|
||||
/* received message. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_get_va_type_spec (ASN1_DEC_CTXT *aCtx, VAR_ACC_TSPEC *data_ptr,
|
||||
ST_VOID (*done_fun) (ASN1_DEC_CTXT *aCtx))
|
||||
{
|
||||
|
||||
tspec_ptr = data_ptr;
|
||||
get_va_type_spec_done = done_fun;
|
||||
|
||||
tspec_ptr->data = aCtx->asn1r_field_ptr; /* set data pointer */
|
||||
|
||||
asn1r_parse_next (aCtx, type_spec_get_tspec_done); /* parse entire element */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* type_spec_get_tspec_done */
|
||||
/* valid type specification was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID type_spec_get_tspec_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("type_spec_get_tspec_done");
|
||||
/* set type specification len */
|
||||
tspec_ptr->len = aCtx->asn1r_field_ptr - tspec_ptr->data;
|
||||
|
||||
(*get_va_type_spec_done) (aCtx); /* all done, call user set fun */
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_get_va_scat_access */
|
||||
/* Function to get a variable access scattered access from the received */
|
||||
/* message. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_get_va_scat_access (ASN1_DEC_CTXT *aCtx, SCATTERED_ACCESS *data_ptr,
|
||||
ST_VOID (*done_fun) (ASN1_DEC_CTXT *aCtx))
|
||||
{
|
||||
|
||||
scat_acc_ptr = data_ptr;
|
||||
get_va_scat_access_done = done_fun;
|
||||
|
||||
scat_acc_ptr->data = aCtx->asn1r_field_ptr; /* set data pointer */
|
||||
|
||||
asn1r_parse_next (aCtx, scat_access_get_sa_done); /* parse entire element */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* scat_access_get_sa_done */
|
||||
/* scattered access universal sequence constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID scat_access_get_sa_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
/* set scattered access len */
|
||||
scat_acc_ptr->len = aCtx->asn1r_field_ptr - scat_acc_ptr->data;
|
||||
|
||||
(*get_va_scat_access_done) (aCtx); /* all done, call user set fun */
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_get_va_alt_access */
|
||||
/* Function to get a variable access alternate access from the received */
|
||||
/* message. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_get_va_alt_access (ASN1_DEC_CTXT *aCtx, ALTERNATE_ACCESS *data_ptr,
|
||||
ST_VOID (*done_fun) (ASN1_DEC_CTXT *aCtx))
|
||||
{
|
||||
MLOG_CDEC0 ("_ms_get_va_alt_access");
|
||||
|
||||
alt_acc_ptr = data_ptr;
|
||||
get_va_alt_access_done = done_fun;
|
||||
|
||||
alt_acc_ptr->data = aCtx->asn1r_field_ptr; /* set data pointer */
|
||||
|
||||
asn1r_parse_cstr_contents (aCtx, alt_access_get_aa_done); /* parse entire element */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* alt_access_get_aa_done */
|
||||
/* scattered access was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID alt_access_get_aa_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("alt_access_get_aa_done");
|
||||
/* set type specification len */
|
||||
alt_acc_ptr->len = aCtx->asn1r_field_ptr - alt_acc_ptr->data;
|
||||
|
||||
(*get_va_alt_access_done) (aCtx); /* all done, call user set fun */
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_get_va_var_spec */
|
||||
/* Function to get a variable access variable specification from the */
|
||||
/* received message. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_get_va_var_spec (ASN1_DEC_CTXT *aCtx, VARIABLE_SPEC *data_ptr,
|
||||
ST_VOID (*done_fun) (ASN1_DEC_CTXT *aCtx))
|
||||
{
|
||||
/* set decode error for request or response */
|
||||
if (_mmsdec_rslt->type == MMSRESP)
|
||||
ERROR_CODE = RESP_BAD_VALUE;
|
||||
else
|
||||
ERROR_CODE = REQ_BAD_VALUE;
|
||||
|
||||
var_spec_ptr = data_ptr;
|
||||
get_va_var_spec_done = done_fun;
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 0, var_spec_objname_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 1, var_spec_address_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 2, var_spec_var_descr_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 3, var_spec_scat_acc_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 4, var_spec_get_null);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* var_spec_objname_cstr */
|
||||
/* variable specification object name constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID var_spec_objname_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("var_spec_objname_cstr");
|
||||
|
||||
var_spec_ptr->var_spec_tag = 0; /* set tag to name */
|
||||
|
||||
_ms_get_mms_objname (aCtx, &var_spec_ptr->vs.name, var_spec_cstr_get_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* var_spec_address_cstr */
|
||||
/* variable specification address was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID var_spec_address_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("var_spec_address_cstr");
|
||||
|
||||
var_spec_ptr->var_spec_tag = 1; /* set tag to address */
|
||||
|
||||
_ms_get_va_address (aCtx, &var_spec_ptr->vs.address, var_spec_cstr_get_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* var_spec_var_descr_cstr */
|
||||
/* variable specification variable description constructor was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID var_spec_var_descr_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("var_spec_var_descr_cstr");
|
||||
|
||||
var_spec_ptr->var_spec_tag = 2; /* set tag to variable descr */
|
||||
|
||||
_ms_get_va_address (aCtx, &var_spec_ptr->vs.var_descr.address, var_spec_type_spec);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* var_spec_type_spec */
|
||||
/* variable specification address is done, get the type specification. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID var_spec_type_spec (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("var_spec_type_spec");
|
||||
|
||||
_ms_get_va_type_spec (aCtx, &var_spec_ptr->vs.var_descr.type, var_spec_cstr_get_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* var_spec_scat_acc_cstr */
|
||||
/* variable specification scattered access constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID var_spec_scat_acc_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("var_spec_scat_acc_cstr");
|
||||
|
||||
var_spec_ptr->var_spec_tag = 3; /* set tag to scattered access */
|
||||
|
||||
_ms_get_va_scat_access (aCtx, &var_spec_ptr->vs.sa_descr, var_spec_cstr_get_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* var_spec_get_null */
|
||||
/* variable specification null was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID var_spec_get_null (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("var_spec_get_null");
|
||||
|
||||
var_spec_ptr->var_spec_tag = 4; /* set tag to variable descr */
|
||||
|
||||
if (aCtx->asn1r_elmnt_len != 0)
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, ERROR_CODE);
|
||||
return;
|
||||
}
|
||||
|
||||
(*get_va_var_spec_done) (aCtx); /* all done, call user set fun */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* var_spec_cstr_get_done */
|
||||
/* variable specification object name constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID var_spec_cstr_get_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = va_var_spec_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* va_var_spec_done */
|
||||
/* variable specification has been obtained, return to set-up function. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID va_var_spec_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
(*get_va_var_spec_done) (aCtx); /* all done, call user set fun */
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_get_va_var_list */
|
||||
/* Function to get a variable access variable list from the received */
|
||||
/* message. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_get_va_var_list (ASN1_DEC_CTXT *aCtx, VARIABLE_LIST *data_ptr, ST_INT *num_of_vars,
|
||||
ST_INT max_vars, ST_VOID (*done_fun) (ASN1_DEC_CTXT *aCtx))
|
||||
{
|
||||
/* set decode error for request or response */
|
||||
if (_mmsdec_rslt->type == MMSRESP)
|
||||
ERROR_CODE = RESP_BAD_VALUE;
|
||||
else
|
||||
ERROR_CODE = REQ_BAD_VALUE;
|
||||
|
||||
var_list_ptr = data_ptr;
|
||||
NUM_OF_VARS = num_of_vars;
|
||||
MAX_VARS = max_vars;
|
||||
*NUM_OF_VARS = 0; /* initialize # of variables */
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, UNI | CONSTR, SEQ_CODE, va_vlist_useq_cstr);
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = done_fun; /* can be empty list */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* va_vlist_useq_cstr */
|
||||
/* variable access variable list universal sequence was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID va_vlist_useq_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("va_vlist_useq_cstr");
|
||||
|
||||
(*NUM_OF_VARS)++; /* increment # of variables */
|
||||
if (*NUM_OF_VARS > MAX_VARS)
|
||||
asn1r_set_dec_err (aCtx, ERROR_CODE);
|
||||
|
||||
var_list_ptr->alt_access_pres = SD_FALSE;
|
||||
|
||||
_ms_get_va_var_spec (aCtx, &var_list_ptr->var_spec, va_vlist_var_spec_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* va_vlist_var_spec_done */
|
||||
/* variable access variable specification done, get alternate access. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID va_vlist_var_spec_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("va_vlist_var_spec_done");
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 5, va_vlist_alt_acc_cstr);
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = va_vlist_useq_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* va_vlist_alt_acc_cstr */
|
||||
/* variable access variable list alternate access constructor was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID va_vlist_alt_acc_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("va_vlist_alt_acc_cstr");
|
||||
|
||||
var_list_ptr->alt_access_pres = SD_TRUE; /* set alternate access present */
|
||||
|
||||
_ms_get_va_alt_access (aCtx, &var_list_ptr->alt_access, va_vlist_alt_acc_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* va_vlist_alt_acc_done */
|
||||
/* variable specification alternate access has been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID va_vlist_alt_acc_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("va_vlist_alt_acc_done");
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* va_vlist_useq_cstr_done */
|
||||
/* variable access variable list universal sequence constructor done */
|
||||
/* was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID va_vlist_useq_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("va_vlist_useq_cstr_done");
|
||||
var_list_ptr++; /* point to where next will go */
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, UNI | CONSTR, SEQ_CODE, va_vlist_useq_cstr);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_get_va_spec */
|
||||
/* Function to get a variable access specification from the received */
|
||||
/* message. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_get_va_spec (ASN1_DEC_CTXT *aCtx, VAR_ACC_SPEC *data_ptr, ST_INT max_vars,
|
||||
ST_VOID (*done_fun) (ASN1_DEC_CTXT *aCtx))
|
||||
{
|
||||
|
||||
/* set decode error for request or response */
|
||||
if (_mmsdec_rslt->type == MMSRESP)
|
||||
ERROR_CODE = RESP_BAD_VALUE;
|
||||
else
|
||||
ERROR_CODE = REQ_BAD_VALUE;
|
||||
|
||||
va_spec_ptr = data_ptr;
|
||||
va_spec_vlist_ptr = (VARIABLE_LIST *) (va_spec_ptr + 1);
|
||||
MAX_VARS = max_vars;
|
||||
get_va_spec_done = done_fun;
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 0, va_spec_vlist_list_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 1, va_spec_vlist_name_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* va_spec_vlist_list_cstr */
|
||||
/* variable access specification list of variables constructor was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID va_spec_vlist_list_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("va_spec_vlist_list_cstr");
|
||||
|
||||
va_spec_ptr->var_acc_tag = 0; /* set tag to list of variables */
|
||||
|
||||
_ms_get_va_var_list (aCtx, va_spec_vlist_ptr, &va_spec_ptr->num_of_variables,
|
||||
MAX_VARS, va_spec_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* va_spec_vlist_name_cstr */
|
||||
/* variable access specification variable list name constructor was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID va_spec_vlist_name_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("va_spec_vlist_name_cstr");
|
||||
|
||||
va_spec_ptr->var_acc_tag = 1; /* set tag to var list name */
|
||||
|
||||
_ms_get_mms_objname (aCtx, &va_spec_ptr->vl_name, va_spec_objname_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* va_spec_objname_done */
|
||||
/* variable access specification variable list object name is complete. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID va_spec_objname_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = va_spec_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* va_spec_done */
|
||||
/* variable access specification has been obtained, return to set-up */
|
||||
/* function. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID va_spec_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
(*get_va_spec_done) (aCtx); /* all done, call user set fun */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_wr_va_address */
|
||||
/* Function to write a variable access address to the message. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_wr_va_address (ASN1_ENC_CTXT *aCtx, VAR_ACC_ADDR *data_ptr)
|
||||
{
|
||||
switch (data_ptr->addr_tag)
|
||||
{
|
||||
case (0) : /* write the numeric address */
|
||||
asn1r_wr_u32 (aCtx, data_ptr->addr.num_addr);
|
||||
asn1r_fin_prim (aCtx, 0, CTX); /* context tag 0 */
|
||||
break;
|
||||
|
||||
case (1) : /* write the symbolic address */
|
||||
asn1r_wr_vstr (aCtx, data_ptr->addr.sym_addr);
|
||||
asn1r_fin_prim (aCtx, 1,CTX); /* context tag 1 */
|
||||
break;
|
||||
|
||||
case (2) : /* write the unconstrained addr */
|
||||
asn1r_wr_octstr (aCtx, data_ptr->addr.unc_addr.unc_ptr,
|
||||
data_ptr->addr.unc_addr.unc_len);
|
||||
asn1r_fin_prim (aCtx, 2,CTX); /* context tag 2 */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _ms_wr_va_access_rslt */
|
||||
/* Function to write a variable access access result to the message. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_wr_va_access_rslt (ASN1_ENC_CTXT *aCtx, ACCESS_RESULT *data_ptr)
|
||||
{
|
||||
if (data_ptr->acc_rslt_tag == ACC_RSLT_SUCCESS)
|
||||
_ms_wr_va_data (aCtx, &data_ptr->va_data); /* success, write data */
|
||||
else
|
||||
{ /* failure, write failure value */
|
||||
asn1r_wr_i16 (aCtx, data_ptr->failure);
|
||||
asn1r_fin_prim (aCtx, 0, CTX); /* context tag 0 */
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _ms_wr_va_data */
|
||||
/* Function to write a variable access data to the message. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_wr_va_data (ASN1_ENC_CTXT *aCtx, VAR_ACC_DATA *data_ptr)
|
||||
{
|
||||
asn1r_wr_delmnt (aCtx, data_ptr->data, data_ptr->len);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _ms_wr_va_type_spec */
|
||||
/* Function to write a variable access type specification to the */
|
||||
/* message. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_wr_va_type_spec (ASN1_ENC_CTXT *aCtx, VAR_ACC_TSPEC *data_ptr)
|
||||
{
|
||||
asn1r_wr_delmnt (aCtx, data_ptr->data, data_ptr->len);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _ms_wr_va_scat_access */
|
||||
/* Function to write a variable access scattered access to the message. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_wr_va_scat_access (ASN1_ENC_CTXT *aCtx, SCATTERED_ACCESS *data_ptr)
|
||||
{
|
||||
asn1r_wr_delmnt (aCtx, data_ptr->data, data_ptr->len);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _ms_wr_va_alt_access */
|
||||
/* Function to write a variable access alternate access to the message. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_wr_va_alt_access (ASN1_ENC_CTXT *aCtx, ALTERNATE_ACCESS *data_ptr)
|
||||
{
|
||||
asn1r_wr_delmnt (aCtx, data_ptr->data, data_ptr->len);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _ms_wr_va_var_spec */
|
||||
/* Function to write a variable access variable specification to the */
|
||||
/* message. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_wr_va_var_spec (ASN1_ENC_CTXT *aCtx, VARIABLE_SPEC *data_ptr)
|
||||
{
|
||||
switch (data_ptr->var_spec_tag)
|
||||
{
|
||||
case 0 :
|
||||
asn1r_strt_constr (aCtx);
|
||||
_ms_wr_mms_objname (aCtx, &data_ptr->vs.name);
|
||||
asn1r_fin_constr (aCtx, 0, CTX, DEF);
|
||||
break;
|
||||
|
||||
case 1 :
|
||||
asn1r_strt_constr (aCtx);
|
||||
_ms_wr_va_address (aCtx, &data_ptr->vs.address);
|
||||
asn1r_fin_constr (aCtx, 1, CTX, DEF);
|
||||
break;
|
||||
|
||||
case 2 :
|
||||
asn1r_strt_constr (aCtx);
|
||||
_ms_wr_va_type_spec (aCtx, &data_ptr->vs.var_descr.type);
|
||||
_ms_wr_va_address (aCtx, &data_ptr->vs.var_descr.address);
|
||||
asn1r_fin_constr (aCtx, 2, CTX, DEF);
|
||||
break;
|
||||
|
||||
case 3 :
|
||||
asn1r_strt_constr (aCtx);
|
||||
_ms_wr_va_scat_access (aCtx, &data_ptr->vs.sa_descr);
|
||||
asn1r_fin_constr (aCtx, 3, CTX, DEF);
|
||||
break;
|
||||
|
||||
case 4 :
|
||||
asn1r_fin_prim (aCtx, 4, CTX);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _ms_wr_va_var_list */
|
||||
/* Function to write a variable access variable list to the message. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_wr_va_var_list (ASN1_ENC_CTXT *aCtx, VARIABLE_LIST *data_ptr, ST_INT num_of_vars)
|
||||
{
|
||||
VARIABLE_LIST *vl_ptr;
|
||||
ST_INT i;
|
||||
|
||||
vl_ptr = data_ptr;
|
||||
vl_ptr += num_of_vars - 1; /* point to last in the list */
|
||||
for (i = 0; i < num_of_vars; i++)
|
||||
{
|
||||
asn1r_strt_constr (aCtx); /* start universal sequece cstr */
|
||||
if (vl_ptr->alt_access_pres)
|
||||
{
|
||||
asn1r_strt_constr (aCtx); /* start context tag 5 cstr */
|
||||
_ms_wr_va_alt_access (aCtx, &vl_ptr->alt_access);
|
||||
asn1r_fin_constr (aCtx, 5, CTX, DEF);
|
||||
}
|
||||
_ms_wr_va_var_spec (aCtx, &vl_ptr->var_spec);
|
||||
asn1r_fin_constr (aCtx, SEQ_CODE, UNI, DEF);
|
||||
vl_ptr--; /* point to previous var name */
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _ms_wr_va_spec */
|
||||
/* Function to write a variable access specification to the message. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_wr_va_spec (ASN1_ENC_CTXT *aCtx, VAR_ACC_SPEC *data_ptr)
|
||||
{
|
||||
VARIABLE_LIST *vl_ptr;
|
||||
|
||||
if (data_ptr->var_acc_tag == 1)
|
||||
{
|
||||
asn1r_strt_constr (aCtx); /* start context tag 1 cstr */
|
||||
_ms_wr_mms_objname (aCtx, &data_ptr->vl_name);
|
||||
asn1r_fin_constr (aCtx, 1, CTX, DEF);
|
||||
}
|
||||
else
|
||||
{
|
||||
vl_ptr = (VARIABLE_LIST *) (data_ptr + 1);
|
||||
asn1r_strt_constr (aCtx); /* start context tag 0 cstr */
|
||||
_ms_wr_va_var_list (aCtx, vl_ptr, data_ptr->num_of_variables);
|
||||
asn1r_fin_constr (aCtx, 0, CTX, DEF);
|
||||
}
|
||||
}
|
||||
77
mmslib/mmsl/mms_ced5.c
Normal file
77
mmslib/mmsl/mms_ced5.c
Normal file
@@ -0,0 +1,77 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : mms_ced5.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains common primitive encode/decode functions */
|
||||
/* particular application references. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 03 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 02 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 01 Added SD_CONST modifiers */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID app_ref_get_seq (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
/************************************************************************/
|
||||
/* global structures & functions */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID (*get_mms_app_ref_done) (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_get_mms_app_ref */
|
||||
/* Function to get an Application Reference from the received message. */
|
||||
/* Takes two destination element pointers because of op-specific struct */
|
||||
/* differences. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_get_mms_app_ref (ASN1_DEC_CTXT *aCtx, ST_UCHAR **ptr_ptr, ST_INT *len_ptr,
|
||||
ST_VOID (*done_fun) (ASN1_DEC_CTXT *aCtx))
|
||||
{
|
||||
|
||||
get_mms_app_ref_done = done_fun;
|
||||
|
||||
*ptr_ptr = aCtx->asn1r_field_ptr; /* save pointer */
|
||||
*len_ptr = aCtx->asn1r_elmnt_len; /* save length of data */
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, UNI|CONSTR, SEQ_CODE, app_ref_get_seq);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* app_ref_get_seq */
|
||||
/* Sequence was encountered, contents are 4 optional ASN.1 ANY's. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID app_ref_get_seq (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("app_ref_get_seq");
|
||||
if (aCtx->asn1r_elmnt_len) /* if any contents, parse them */
|
||||
asn1r_parse_cstr_contents (aCtx, get_mms_app_ref_done);
|
||||
else /* no contents, call user done function */
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = get_mms_app_ref_done;
|
||||
}
|
||||
|
||||
151
mmslib/mmsl/mms_ced6.c
Normal file
151
mmslib/mmsl/mms_ced6.c
Normal file
@@ -0,0 +1,151 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : mms_ced6.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains common primitive encode/decode functions */
|
||||
/* particular event time */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 04 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 03 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 02 Added SD_CONST modifiers */
|
||||
/* 08/15/97 MDE 01 BTOD handling changes */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
static ST_VOID evtime_get_time_of_day (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID evtime_get_time_seq_id (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID (*get_mms_evtime_done) (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID evtime_get_undefined (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
/************************************************************************/
|
||||
/* global structures & functions */
|
||||
/************************************************************************/
|
||||
|
||||
static EVENT_TIME *ev_time_ptr;
|
||||
|
||||
static ST_RET _error_code;
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_get_mms_evtime */
|
||||
/* Function to get an Event Time from the received message. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_get_mms_evtime (ASN1_DEC_CTXT *aCtx, EVENT_TIME *data_ptr, ST_VOID (*done_fun) (ASN1_DEC_CTXT *aCtx))
|
||||
{
|
||||
/* set decode error for request or response */
|
||||
if (_mmsdec_rslt->type == MMSRESP)
|
||||
_error_code = RESP_BAD_VALUE;
|
||||
else
|
||||
_error_code = REQ_BAD_VALUE;
|
||||
|
||||
ev_time_ptr = data_ptr;
|
||||
get_mms_evtime_done = done_fun;
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 0, evtime_get_time_of_day);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 1, evtime_get_time_seq_id);
|
||||
#ifndef MMS_LITE
|
||||
if (mms_chan_info[_mmsdechan].version) /* IS */
|
||||
#else
|
||||
if (mmsl_version) /* IS */
|
||||
#endif
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 2, evtime_get_undefined);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* evtime_get_time_of_day */
|
||||
/* time of day was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID evtime_get_time_of_day (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("evtime_get_time_of_day");
|
||||
|
||||
ev_time_ptr->evtime_tag = 0; /* set tag to time of day */
|
||||
|
||||
/* read time from message */
|
||||
if (asn1r_get_btod (aCtx, &ev_time_ptr->evtime.time_of_day))
|
||||
asn1r_set_dec_err (aCtx, _error_code);
|
||||
|
||||
(*get_mms_evtime_done) (aCtx); /* all done, call user set fun */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* evtime_get_time_seq_id */
|
||||
/* time sequence identifier was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID evtime_get_time_seq_id (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("evtime_get_time_seq_id");
|
||||
|
||||
ev_time_ptr->evtime_tag = 1; /* set tag to time seq id */
|
||||
|
||||
/* read time from message */
|
||||
if (asn1r_get_u32 (aCtx, &ev_time_ptr->evtime.time_seq_id))
|
||||
asn1r_set_dec_err (aCtx, _error_code);
|
||||
|
||||
(*get_mms_evtime_done) (aCtx); /* all done, call user set fun */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* evtime_get_undefined */
|
||||
/* undefined was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID evtime_get_undefined (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("evtime_get_undefined");
|
||||
|
||||
ev_time_ptr->evtime_tag = 2; /* set tag to undefined */
|
||||
|
||||
(*get_mms_evtime_done) (aCtx); /* all done, call user set fun */
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_wr_mms_evtime */
|
||||
/* Function to write an Event Time to the message. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_wr_mms_evtime (ASN1_ENC_CTXT *aCtx, EVENT_TIME *data_ptr)
|
||||
{
|
||||
if (data_ptr->evtime_tag == 0)
|
||||
{ /* write the time of day */
|
||||
asn1r_wr_btod (aCtx, &data_ptr->evtime.time_of_day);
|
||||
asn1r_fin_prim (aCtx, 0, CTX); /* context tag 0 */
|
||||
}
|
||||
else if (data_ptr->evtime_tag == 1)
|
||||
{ /* write time sequence id */
|
||||
asn1r_wr_u32 (aCtx, data_ptr->evtime.time_seq_id);
|
||||
asn1r_fin_prim (aCtx, 1, CTX); /* context tag 1 */
|
||||
}
|
||||
else
|
||||
{ /* IS - write undefined (null) */
|
||||
asn1r_fin_prim (aCtx, 2, CTX); /* context tag 2 */
|
||||
}
|
||||
}
|
||||
|
||||
543
mmslib/mmsl/mms_ced7.c
Normal file
543
mmslib/mmsl/mms_ced7.c
Normal file
@@ -0,0 +1,543 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : mms_ced7.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains common primitive encode/decode functions */
|
||||
/* particular to getting and writing a list of modifiers. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 05 Remove "thisFileName" */
|
||||
/* 08/28/03 EJV 04 Corr spelling for 'receive'. */
|
||||
/* 03/31/03 JRB 03 asn1r_get_bitstr: add max_bits arg. */
|
||||
/* 12/20/01 JRB 02 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 01 Added SD_CONST modifiers */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
|
||||
#ifdef MOD_SUPPORT
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* global structures & functions */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID modlist_attach_to_ec (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID modlist_attach_to_sem (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID modlist_modifier_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID modlist_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID atsem_get_priority (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID atsem_get_acc_delay (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID atsem_get_ctrl_timeout (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID atsem_get_abrt_timeout (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID atsem_get_rel_conn_lost (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID atec_get_ct_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID atsem_get_named_token (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID atsem_sem_name_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID atsem_objname_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID atsem_sem_name_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID atec_get_acc_delay (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID atec_get_ct_prim (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID atec_get_ct_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID atec_ecname_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID atec_ecname_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID atec_ecname_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID atec_eename_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID atec_eename_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID atec_eename_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID (*get_mms_modlist_done) (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
static MODIFIER *mod_ptr;
|
||||
static ST_INT *NUM_OF_MODS;
|
||||
static ST_INT MAX_MODS;
|
||||
static ST_RET ERROR_CODE;
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_get_mms_modlist */
|
||||
/* Function to get an MMS list of modifiers from the received message. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_get_mms_modlist (ASN1_DEC_CTXT *aCtx, MODIFIER *data_ptr, ST_INT *num_ptr,
|
||||
ST_INT max_mods, ST_VOID (*done_fun) (ASN1_DEC_CTXT *ac))
|
||||
{
|
||||
/* set decode error for request or response */
|
||||
if (_mmsdec_rslt->type == MMSRESP)
|
||||
ERROR_CODE = RESP_BAD_VALUE;
|
||||
else
|
||||
ERROR_CODE = REQ_BAD_VALUE;
|
||||
|
||||
mod_ptr = data_ptr;
|
||||
NUM_OF_MODS = num_ptr;
|
||||
MAX_MODS = max_mods;
|
||||
get_mms_modlist_done = done_fun;
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 0, modlist_attach_to_ec);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 1, modlist_attach_to_sem);
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = modlist_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* modlist_attach_to_ec */
|
||||
/* decoding list of modifiers: attach to event condition modifier cstr */
|
||||
/* was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID modlist_attach_to_ec (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("modlist_attach_to_ec");
|
||||
|
||||
(*NUM_OF_MODS)++; /* increment # of modifiers */
|
||||
if (*NUM_OF_MODS > MAX_MODS)
|
||||
asn1r_set_dec_err (aCtx, ERROR_CODE);
|
||||
|
||||
mod_ptr->modifier_tag = 0; /* set tag to attach to ec */
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX |CONSTR, 0, atec_eename_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* atec_eename_cstr */
|
||||
/* decoding attach to event condition modifier: event enrollment name */
|
||||
/* constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID atec_eename_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("atec_eename_cstr");
|
||||
|
||||
_ms_get_mms_objname (aCtx,&mod_ptr->mod.atec.evenroll_name, atec_eename_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* atec_eename_done */
|
||||
/* decoding attach to event condition modifier: event enrollment name */
|
||||
/* has been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID atec_eename_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = atec_eename_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* atec_eename_cstr_done */
|
||||
/* decoding attach to event condition modifier: event enrollment name */
|
||||
/* constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID atec_eename_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX |CONSTR, 1, atec_ecname_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* atec_ecname_cstr */
|
||||
/* decoding attach to event condition modifier: event condition name */
|
||||
/* constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID atec_ecname_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("atec_ecname_cstr");
|
||||
|
||||
_ms_get_mms_objname (aCtx, &mod_ptr->mod.atec.evcon_name, atec_ecname_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* atec_ecname_done */
|
||||
/* decoding attach to event condition modifier: event condition name */
|
||||
/* has been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID atec_ecname_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = atec_ecname_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* atec_ecname_cstr_done */
|
||||
/* decoding attach to event condition modifier: event condition name */
|
||||
/* constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID atec_ecname_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 2,atec_get_ct_prim);
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,2,atec_get_ct_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* atec_get_ct_prim */
|
||||
/* decoding attach to event condition modifier: causing transitions */
|
||||
/* primitive was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID atec_get_ct_prim (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("atec_get_ct_prim");
|
||||
if (!asn1r_get_bitstr (aCtx, &mod_ptr->mod.atec.causing_transitions, 7))
|
||||
atec_get_ct_done (aCtx); /* set up for the next data element */
|
||||
else
|
||||
asn1r_set_dec_err (aCtx, ERROR_CODE);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* atec_get_ct_cstr */
|
||||
/* decoding attach to event condition modifier: causing transitions */
|
||||
/* constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID atec_get_ct_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("atec_get_ct_cstr");
|
||||
|
||||
/* set up bitstring cstr done function */
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = atec_get_ct_done;
|
||||
|
||||
asn1r_get_bitstr_cstr (aCtx, 7,&mod_ptr->mod.atec.causing_transitions);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* atec_get_ct_done */
|
||||
/* decoding attach to event condition modifier: causing transitions */
|
||||
/* constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID atec_get_ct_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("atec_get_ct_done");
|
||||
|
||||
/* Check aCtx->asn1r_bitcount for correct # of bits */
|
||||
if (aCtx->asn1r_bitcount != 7) /* should be 7 bits */
|
||||
asn1r_set_dec_err (aCtx, ERROR_CODE);
|
||||
else /* now get acceptable delay */
|
||||
{
|
||||
ASN1R_TAG_ADD (aCtx, CTX,3,atec_get_acc_delay);
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = modlist_modifier_done;
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* atec_get_acc_delay */
|
||||
/* decoding attach to event condition modifier: decode acceptable delay */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID atec_get_acc_delay (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("atec_get_acc_dela");
|
||||
|
||||
mod_ptr->mod.atec.acc_delay_pres = SD_TRUE; /* accept delay present */
|
||||
|
||||
/* read acceptable delay from message */
|
||||
if (asn1r_get_u32 (aCtx, &(mod_ptr->mod.atec.acc_delay)))
|
||||
asn1r_set_dec_err (aCtx, ERROR_CODE);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* modlist_attach_to_sem */
|
||||
/* decoding list of modifiers: attach to semaphore modifier constructor */
|
||||
/* was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID modlist_attach_to_sem (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("modlist_attach_to_sem");
|
||||
|
||||
(*NUM_OF_MODS)++; /* increment # of modifiers */
|
||||
if (*NUM_OF_MODS > MAX_MODS)
|
||||
asn1r_set_dec_err (aCtx, ERROR_CODE);
|
||||
|
||||
mod_ptr->modifier_tag = 1; /* set tag to attach to sem */
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX |CONSTR, 0, atsem_sem_name_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* atsem_sem_name_cstr */
|
||||
/* decoding attach to semaphore modifier: semaphore name constructor */
|
||||
/* was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID atsem_sem_name_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("atsem_sem_name_cstr");
|
||||
|
||||
mod_ptr->mod.atsem.priority = MMS_NORM_PRIORITY;
|
||||
mod_ptr->mod.atsem.rel_conn_lost = SD_TRUE;
|
||||
|
||||
_ms_get_mms_objname (aCtx, &mod_ptr->mod.atsem.sem_name, atsem_objname_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* atsem_objname_done */
|
||||
/* decoding attach to semaphore modifier: semaphore name has been */
|
||||
/* obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID atsem_objname_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = atsem_sem_name_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* atsem_sem_name_cstr_done */
|
||||
/* decoding attach to semaphore modifier: semaphore name constructor */
|
||||
/* done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID atsem_sem_name_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 1, atsem_get_named_token);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 2, atsem_get_priority );
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 3, atsem_get_acc_delay );
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 4, atsem_get_ctrl_timeout);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 5, atsem_get_abrt_timeout);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 6, atsem_get_rel_conn_lost);
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = modlist_modifier_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* atsem_get_named_token */
|
||||
/* decoding attach to semaphore modifier: named token name was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID atsem_get_named_token (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("atsem_get_named_token");
|
||||
|
||||
mod_ptr->mod.atsem.named_token_pres = SD_TRUE; /* named token present */
|
||||
|
||||
/* read named token from received message */
|
||||
if (asn1r_get_identifier (aCtx, mod_ptr->mod.atsem.named_token))
|
||||
asn1r_set_dec_err (aCtx, ERROR_CODE);
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 2, atsem_get_priority );
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 3, atsem_get_acc_delay );
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 4, atsem_get_ctrl_timeout);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 5, atsem_get_abrt_timeout);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 6, atsem_get_rel_conn_lost);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* atsem_get_priority */
|
||||
/* decoding attach to semaphore modifier: decode the priority. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID atsem_get_priority (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("atsem_get_priorit");
|
||||
/* read priority from received message */
|
||||
if (asn1r_get_u8 (aCtx, &(mod_ptr->mod.atsem.priority)))
|
||||
asn1r_set_dec_err (aCtx, ERROR_CODE);
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 3, atsem_get_acc_delay );
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 4, atsem_get_ctrl_timeout);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 5, atsem_get_abrt_timeout);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 6, atsem_get_rel_conn_lost);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* atsem_get_acc_delay */
|
||||
/* decoding attach to semaphore modifier: decode acceptable delay */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID atsem_get_acc_delay (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("atsem_get_acc_dela");
|
||||
|
||||
mod_ptr->mod.atsem.acc_delay_pres = SD_TRUE; /* accept delay present */
|
||||
|
||||
/* read acceptable delay from message */
|
||||
if (asn1r_get_u32 (aCtx, &(mod_ptr->mod.atsem.acc_delay)))
|
||||
asn1r_set_dec_err (aCtx, ERROR_CODE);
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 4, atsem_get_ctrl_timeout);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 5, atsem_get_abrt_timeout);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 6, atsem_get_rel_conn_lost);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* atsem_get_ctrl_timeout */
|
||||
/* decoding attach to semaphore modifier: decode control timeout. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID atsem_get_ctrl_timeout (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("atsem_get_ctrl_timeou");
|
||||
|
||||
mod_ptr->mod.atsem.ctrl_timeout_pres = SD_TRUE; /* ctrl timeout pres */
|
||||
|
||||
/* read control timeout from message */
|
||||
if (asn1r_get_u32 (aCtx, &(mod_ptr->mod.atsem.ctrl_timeout)))
|
||||
asn1r_set_dec_err (aCtx, ERROR_CODE);
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 5, atsem_get_abrt_timeout);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 6, atsem_get_rel_conn_lost);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* atsem_get_abrt_timeout */
|
||||
/* decoding attach to semaphore modifier: decode abort timeout. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID atsem_get_abrt_timeout (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("atsem_get_abrt_timeout");
|
||||
|
||||
mod_ptr->mod.atsem.abrt_on_timeout_pres = SD_TRUE;
|
||||
|
||||
if (asn1r_get_bool (aCtx, &(mod_ptr->mod.atsem.abrt_on_timeout)))
|
||||
asn1r_set_dec_err (aCtx, ERROR_CODE);
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 6, atsem_get_rel_conn_lost);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* atsem_get_rel_conn_lost */
|
||||
/* decoding attach to semaphore modifier: decode relinquish if */
|
||||
/* connection lost. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID atsem_get_rel_conn_lost (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("atsem_get_rel_conn_lost");
|
||||
|
||||
if (asn1r_get_bool (aCtx, &(mod_ptr->mod.atsem.rel_conn_lost)))
|
||||
asn1r_set_dec_err (aCtx, ERROR_CODE);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* modlist_modifier_done */
|
||||
/* decoding attach to semaphore modifier: modifier constructor done */
|
||||
/* was encountered */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID modlist_modifier_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
mod_ptr++; /* point to where next will go */
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 0, modlist_attach_to_ec);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 1, modlist_attach_to_sem);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* modlist_done */
|
||||
/* decoding list of modifiers: list is done */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID modlist_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
(*get_mms_modlist_done) (aCtx); /* all done, call user set fun */
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_wr_mms_modlist */
|
||||
/* Function to write an MMS list of modifiers to the message. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_wr_mms_modlist (ASN1_ENC_CTXT *aCtx, MODIFIER *data_ptr, ST_INT num_of_mods)
|
||||
{
|
||||
MODIFIER *modPtr;
|
||||
ST_INT i;
|
||||
|
||||
modPtr = data_ptr;
|
||||
modPtr += num_of_mods - 1; /* point to last in the list */
|
||||
|
||||
for (i = 0; i < num_of_mods; i++)
|
||||
{
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 0 or 1 cstr */
|
||||
switch (modPtr->modifier_tag)
|
||||
{
|
||||
case (0) : /* write attach to event cond */
|
||||
if (modPtr->mod.atec.acc_delay_pres)
|
||||
{
|
||||
asn1r_wr_u32 (aCtx, modPtr->mod.atec.acc_delay);
|
||||
asn1r_fin_prim (aCtx, 3, CTX);
|
||||
}
|
||||
|
||||
asn1r_wr_bitstr (aCtx, &modPtr->mod.atec.causing_transitions, 7);
|
||||
asn1r_fin_prim (aCtx, 2, CTX);
|
||||
|
||||
asn1r_strt_constr (aCtx);
|
||||
_ms_wr_mms_objname (aCtx, &modPtr->mod.atec.evcon_name);
|
||||
asn1r_fin_constr (aCtx, 1, CTX, DEF);
|
||||
|
||||
asn1r_strt_constr (aCtx);
|
||||
_ms_wr_mms_objname (aCtx, &modPtr->mod.atec.evenroll_name);
|
||||
asn1r_fin_constr (aCtx, 0, CTX, DEF);
|
||||
break;
|
||||
|
||||
case (1) : /* write attach to semaphore */
|
||||
asn1r_wr_bool (aCtx, modPtr->mod.atsem.rel_conn_lost);
|
||||
asn1r_fin_prim (aCtx, 6, CTX);
|
||||
|
||||
if (modPtr->mod.atsem.abrt_on_timeout_pres)
|
||||
{
|
||||
asn1r_wr_bool (aCtx, modPtr->mod.atsem.abrt_on_timeout);
|
||||
asn1r_fin_prim (aCtx, 5, CTX);
|
||||
}
|
||||
|
||||
if (modPtr->mod.atsem.ctrl_timeout_pres)
|
||||
{
|
||||
asn1r_wr_u32 (aCtx, modPtr->mod.atsem.ctrl_timeout);
|
||||
asn1r_fin_prim (aCtx, 4, CTX);
|
||||
}
|
||||
|
||||
if (modPtr->mod.atsem.acc_delay_pres)
|
||||
{
|
||||
asn1r_wr_u32 (aCtx, modPtr->mod.atsem.acc_delay);
|
||||
asn1r_fin_prim (aCtx, 3, CTX);
|
||||
}
|
||||
|
||||
if (modPtr->mod.atsem.priority != MMS_NORM_PRIORITY)
|
||||
{
|
||||
asn1r_wr_u8 (aCtx, modPtr->mod.atsem.priority);
|
||||
asn1r_fin_prim (aCtx, 2, CTX);
|
||||
}
|
||||
|
||||
if (modPtr->mod.atsem.named_token_pres)
|
||||
{
|
||||
asn1r_wr_vstr (aCtx, modPtr->mod.atsem.named_token);
|
||||
asn1r_fin_prim (aCtx, 1, CTX);
|
||||
}
|
||||
|
||||
asn1r_strt_constr (aCtx);
|
||||
_ms_wr_mms_objname (aCtx, &modPtr->mod.atsem.sem_name);
|
||||
asn1r_fin_constr (aCtx, 0, CTX, DEF);
|
||||
break;
|
||||
}
|
||||
asn1r_fin_constr (aCtx, (ST_UINT16) modPtr->modifier_tag, CTX, DEF);
|
||||
modPtr--; /* point to previous modifier */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
775
mmslib/mmsl/mms_err.c
Normal file
775
mmslib/mmsl/mms_err.c
Normal file
@@ -0,0 +1,775 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2007, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : mms_err.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the MMS error functions for decoding */
|
||||
/* & encoding the error response PDUs : */
|
||||
/* confirmed-ErrorPDU */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 11/01/07 EJV 08 Rem obsolete LLC30... code. */
|
||||
/* 04/05/02 MDE 07 Added MLOG logging */
|
||||
/* 01/23/02 JRB 06 Fix "Response built" msg (was missing header)*/
|
||||
/* 12/20/01 JRB 05 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 04 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 03 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 02 Changes to allow compile under C++ */
|
||||
/* 07/03/97 MDE 01 Op-specific info buffer handling changes */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
#include "glbsem.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pcon.h"
|
||||
#include "asn1defs.h"
|
||||
#include "mloguser.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* For debug version, use a static pointer to avoid duplication of */
|
||||
/* __FILE__ strings. */
|
||||
|
||||
#ifdef DEBUG_SISCO
|
||||
SD_CONST static ST_CHAR *SD_CONST thisFileName = __FILE__;
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the decode : */
|
||||
|
||||
static ERR_INFO *err_info_ptr;
|
||||
|
||||
|
||||
#ifdef MOD_SUPPORT
|
||||
static ST_VOID err_mod_pos (ASN1_DEC_CTXT *aCtx);
|
||||
#endif
|
||||
static ST_VOID err_rsp2 (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID err_class (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID err_get_cac (ASN1_DEC_CTXT *aCtx);
|
||||
#ifdef CS_SUPPORT
|
||||
static ST_VOID err_get_cs (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID err_cs_done (ASN1_DEC_CTXT *aCtx);
|
||||
#endif
|
||||
static ST_VOID err_class_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID err_get_add_code (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID err_get_add_descr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID err_add_ssi_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID err_get_add_ssi_i16 (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID err_get_add_ssi_u32 (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID err_get_dee_obj_name (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID err_dee_obj_name_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID err_get_add_serv_err (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID err_adtnl_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID err_ssi_done (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_err_invoke_fun */
|
||||
/* This function is called from mmsdec.c when invoke ID is expected */
|
||||
/* in a CONFIRMED or CANCEL ERROR PDU. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_err_invoke_fun (ASN1_DEC_CTXT *aCtx, ST_UINT16 id_code)
|
||||
{
|
||||
ST_INT pdutype;
|
||||
|
||||
pdutype = _mmsdec_rslt->type;
|
||||
if (aCtx->asn1r_constr_elmnt || id_code != 0)
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, PDU_INVALID); /* wrong code or constructed int*/
|
||||
return;
|
||||
}
|
||||
if (asn1r_get_u32 (aCtx, &_mmsdec_rslt->id))
|
||||
{
|
||||
if (pdutype == MMSCANERR)
|
||||
asn1r_set_dec_err (aCtx, CANERR_INVAL_INVOKE); /* not a valid integer contents */
|
||||
else
|
||||
asn1r_set_dec_err (aCtx, ERR_INVAL_INVOKE); /* not a valid integer contents */
|
||||
return;
|
||||
}
|
||||
|
||||
_mmsdec_rslt->dec_level = 2; /* set flag that Invoke ID is OK */
|
||||
|
||||
MLOG_CDEC1 ("Invoke ID present, = %ld",_mmsdec_rslt->id);
|
||||
err_info_ptr = (ERR_INFO *) _m_get_dec_buf (aCtx, sizeof (ERR_INFO));
|
||||
if (pdutype == MMSCANERR) /* Cancel Error PDU, next must */
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR,1,err_rsp2); /* be context tag 1 cstr */
|
||||
else
|
||||
{ /* Confirmed Error PDU, next */
|
||||
#ifdef MOD_SUPPORT
|
||||
ASN1R_TAG_ADD (aCtx, CTX ,1,err_mod_pos); /* Context tag 1 (opt) */
|
||||
#endif
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,2,err_rsp2); /* Context tag 2 cstr */
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOD_SUPPORT
|
||||
/************************************************************************/
|
||||
/* err_mod_pos */
|
||||
/* This function is called when a modifier position is detected in a */
|
||||
/* confirmed_request_error PDU. The only thing which may follow is a */
|
||||
/* service error description. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID err_mod_pos (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("err_mod_pos");
|
||||
|
||||
if (asn1r_get_i32 (aCtx, &(err_info_ptr->adtnl.mod_pos))) /* read mod position */
|
||||
asn1r_set_dec_err (aCtx, ERR_UNSPECIFIED);
|
||||
err_info_ptr -> adtnl.mod_pos_pres = SD_TRUE;
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR,2,err_rsp2); /* Context tag 2 cstr */
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_err_rsp */
|
||||
/* This function is called from mmsdec.c when an Error Response PDU is */
|
||||
/* being decoded for initiate or conclude error ONLY */
|
||||
/* When this is called directly, we need to allocate the buffer */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_err_rsp (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("mms_err_rsp");
|
||||
|
||||
err_info_ptr = (ERR_INFO *) _m_get_dec_buf (aCtx, sizeof (ERR_INFO));
|
||||
aCtx->asn1r_err_fun = _mms_dec_buf_free;
|
||||
err_rsp2 (aCtx); /* set tags */
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _mms_get_service_err */
|
||||
/* This function is called from rs_termd.c when IS is used and the */
|
||||
/* 'discarded' parameter is send (service error) -or- from rs_evnot.c */
|
||||
/* when the action result is failure. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _mms_get_service_err (ASN1_DEC_CTXT *aCtx, ERR_INFO *err_ptr)
|
||||
{
|
||||
err_info_ptr = err_ptr; /* use caller's storage */
|
||||
err_rsp2 (aCtx); /* set tags */
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* err_rsp2 */
|
||||
/* This function is called when an Error Response PDU is being decoded */
|
||||
/* for confirmed error. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID err_rsp2 (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("err_rsp2");
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,0,err_class);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* err_class */
|
||||
/* This function is invoked when the ServiceError is being decoded, and */
|
||||
/* the errorClass choice is encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID err_class (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("err_class");
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 0, err_get_cac);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 1, err_get_cac);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 2, err_get_cac);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 3, err_get_cac);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 4, err_get_cac);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 5, err_get_cac);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 6, err_get_cac);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 7, err_get_cac);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 8, err_get_cac);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 9, err_get_cac);
|
||||
ASN1R_TAG_ADD (aCtx, CTX,10, err_get_cac);
|
||||
ASN1R_TAG_ADD (aCtx, CTX,11, err_get_cac);
|
||||
ASN1R_TAG_ADD (aCtx, CTX,12, err_get_cac);
|
||||
#ifdef CS_SUPPORT
|
||||
#ifndef MMS_LITE
|
||||
if (mms_chan_info[_mmsdechan].version) /* IS */
|
||||
#else
|
||||
if (mmsl_version) /* IS */
|
||||
#endif
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,13, err_get_cs); /* CS error */
|
||||
#endif
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* err_get_cac */
|
||||
/* error response is being decoded: context tagged error class has */
|
||||
/* been encountered, get the error class and error code. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID err_get_cac (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("err_get_cac");
|
||||
|
||||
err_info_ptr->eclass = aCtx->asn1r_elmnt_id; /* save the error class */
|
||||
|
||||
if (asn1r_get_i16 (aCtx, &(err_info_ptr->code))) /* read the error code */
|
||||
asn1r_set_dec_err (aCtx, ERR_UNSPECIFIED);
|
||||
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = err_class_cstr_done; /* choice cstr done */
|
||||
}
|
||||
|
||||
#ifdef CS_SUPPORT
|
||||
/************************************************************************/
|
||||
/* err_get_cs */
|
||||
/* error response is being decoded: context tagged error class 13 has */
|
||||
/* been encountered, get the CS service error. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID err_get_cs (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("err_get_cs");
|
||||
|
||||
err_info_ptr->adtnl.ss_error_data= aCtx->asn1r_field_ptr; /* save ptr to field */
|
||||
err_info_ptr->adtnl.ss_error_len = aCtx->asn1r_elmnt_len; /* save len of field */
|
||||
asn1r_parse_next (aCtx, err_cs_done); /* parse the contents */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* err_cs_done */
|
||||
/* Companion Standard service error has been parsed OK. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID err_cs_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = err_class_cstr_done; /* choice cstr done */
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/* err_class_cstr_done */
|
||||
/* errorClass constructor (choice) is complete */
|
||||
/* set up to get additional (optional) information */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID err_class_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("err_class_cstr_done");
|
||||
|
||||
/* add tags for optional information */
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 1, err_get_add_code);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 2, err_get_add_descr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR, 3, err_add_ssi_cstr);
|
||||
|
||||
aCtx->asn1r_decode_done_fun = _mms_dec_done_ok;
|
||||
|
||||
if ((_mmsdec_rslt->type == MMSREQ) || /* terminate download request */
|
||||
(_mmsdec_rslt->type == MMSUNREQ)) /* or Event Notification */
|
||||
/* Terminate Download req or Event Notification unconfirmed */
|
||||
/* request is being decoded, decode can be done, but check for */
|
||||
/* companion standard information. */
|
||||
_ms_set_cs_check (aCtx);
|
||||
else
|
||||
asn1r_set_all_cstr_done (aCtx); /* clear all cstr done funtions */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* err_get_add_code */
|
||||
/* error response is being decoded: additional error code has been */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID err_get_add_code (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("err_get_add_code");
|
||||
|
||||
err_info_ptr->adtnl.info_pres = SD_TRUE; /* set info present */
|
||||
err_info_ptr->adtnl.code_pres = SD_TRUE; /* set code present */
|
||||
|
||||
/* read the additional error code */
|
||||
if (asn1r_get_i32 (aCtx, &(err_info_ptr->adtnl.code)))
|
||||
asn1r_set_dec_err (aCtx, ERR_UNSPECIFIED);
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 2, err_get_add_descr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR, 3, err_add_ssi_cstr);
|
||||
|
||||
if ((_mmsdec_rslt->type == MMSREQ) || /* terminate download request */
|
||||
(_mmsdec_rslt->type == MMSUNREQ)) /* or Event Notification */
|
||||
/* Terminate Download req or Event Notification unconfirmed */
|
||||
/* request is being decoded, decode can be done, but check for */
|
||||
/* companion standard information. */
|
||||
_ms_set_cs_check (aCtx);
|
||||
else
|
||||
asn1r_set_all_cstr_done (aCtx); /* clear all cstr done funtions */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* err_get_add_descr */
|
||||
/* error response is being decoded: additional error description has */
|
||||
/* been encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID err_get_add_descr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("err_get_add_descr");
|
||||
|
||||
err_info_ptr->adtnl.info_pres = SD_TRUE; /* set info present */
|
||||
err_info_ptr->adtnl.descr_pres = SD_TRUE; /* set descr present */
|
||||
|
||||
/* read the additional error description */
|
||||
/* copy error description back onto itself shifted by one character */
|
||||
err_info_ptr->adtnl.descr = (ST_CHAR *)aCtx->asn1r_field_ptr -1;
|
||||
if (asn1r_get_vstr (aCtx, err_info_ptr->adtnl.descr))
|
||||
asn1r_set_dec_err (aCtx, ERR_UNSPECIFIED);
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR, 3, err_add_ssi_cstr);
|
||||
|
||||
if ((_mmsdec_rslt->type == MMSREQ) || /* terminate download request */
|
||||
(_mmsdec_rslt->type == MMSUNREQ)) /* or Event Notification */
|
||||
/* Terminate Download req or Event Notification unconfirmed */
|
||||
/* request is being decoded, decode can be done, but check for */
|
||||
/* companion standard information. */
|
||||
_ms_set_cs_check (aCtx);
|
||||
else
|
||||
asn1r_set_all_cstr_done (aCtx); /* clear all cstr done funtions */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* err_add_ssi_cstr */
|
||||
/* error response is being decoded: additional service specific error */
|
||||
/* information constructor has been encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID err_add_ssi_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("err_get_ssi_cstr");
|
||||
|
||||
/* add tags for all choices */
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 0, err_get_add_ssi_i16);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 1, err_get_add_ssi_i16);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 2, err_get_add_ssi_i16);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 3, err_get_add_ssi_i16);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 4, err_get_add_ssi_i16);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 5, err_get_add_ssi_u32);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 6, err_get_add_ssi_u32);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 7, err_get_add_ssi_u32);
|
||||
#ifndef MMS_LITE
|
||||
if (mms_chan_info[_mmsdechan].version) /* IS */
|
||||
#else
|
||||
if (mmsl_version) /* IS */
|
||||
#endif
|
||||
{
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR, 8, err_get_dee_obj_name); /* def ev enroll*/
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 9, err_get_add_ssi_i16); /* file rename */
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,10, err_get_add_serv_err); /* adtnl service*/
|
||||
}
|
||||
else
|
||||
{
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 8, err_get_add_ssi_i16); /* file rename */
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR, 9, err_get_add_serv_err); /* adtnl service*/
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* err_get_add_ssi_i16 */
|
||||
/* error response is being decoded: additional service specific error */
|
||||
/* information has been encountered for obtain file, start, stop, */
|
||||
/* resume, reset or file rename. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID err_get_add_ssi_i16 (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT16 ssi_error;
|
||||
|
||||
MLOG_CDEC0 ("err_get_add_ssi_i16");
|
||||
|
||||
err_info_ptr->adtnl.info_pres = SD_TRUE; /* set info present indicator */
|
||||
err_info_ptr->adtnl.ssi_pres = SD_TRUE; /* set additional service pres */
|
||||
|
||||
err_info_ptr->adtnl.service = aCtx->asn1r_elmnt_id; /* save the service id */
|
||||
|
||||
/* read the additional service error */
|
||||
if (asn1r_get_i16 (aCtx, &ssi_error))
|
||||
asn1r_set_dec_err (aCtx, ERR_UNSPECIFIED);
|
||||
else
|
||||
err_info_ptr->adtnl.ss_error_val = (ST_UINT32) ssi_error;
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = err_ssi_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* err_get_add_ssi_u32 */
|
||||
/* error response is being decoded: additional service specific error */
|
||||
/* information has been encountered for delete varaible access, delete */
|
||||
/* named variable list or delete named type. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID err_get_add_ssi_u32 (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("err_get_add_ssi_u32");
|
||||
|
||||
err_info_ptr->adtnl.info_pres = SD_TRUE; /* set info present indicator */
|
||||
err_info_ptr->adtnl.ssi_pres = SD_TRUE; /* set additional service pres */
|
||||
|
||||
err_info_ptr->adtnl.service = aCtx->asn1r_elmnt_id; /* save the service id */
|
||||
|
||||
/* read the additional service error */
|
||||
if (asn1r_get_u32 (aCtx, &(err_info_ptr->adtnl.ss_error_val)))
|
||||
asn1r_set_dec_err (aCtx, ERR_UNSPECIFIED);
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = err_ssi_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* err_get_dee_obj_name */
|
||||
/* error response is being decoded: additional service specific error */
|
||||
/* information has been encountered for define event enrollment error */
|
||||
/* get the object name. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID err_get_dee_obj_name (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("err_get_dee_obj_name");
|
||||
|
||||
err_info_ptr->adtnl.info_pres = SD_TRUE; /* set info present indicator */
|
||||
err_info_ptr->adtnl.ssi_pres = SD_TRUE; /* set additional service pres */
|
||||
|
||||
err_info_ptr->adtnl.service = aCtx->asn1r_elmnt_id; /* save the service id */
|
||||
|
||||
/* read the object name */
|
||||
_ms_get_mms_objname (aCtx, &err_info_ptr->adtnl.ss_error_oname,
|
||||
err_dee_obj_name_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* err_dee_obj_name_done */
|
||||
/* define event enrollment error is being decoded: object name has */
|
||||
/* been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID err_dee_obj_name_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("err_dee_obj_name_done");
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = err_adtnl_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* err_get_add_serv_err */
|
||||
/* error response is being decoded: additional service specific error */
|
||||
/* information has been encountered for additional service error. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID err_get_add_serv_err (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("err_get_add_serv_err");
|
||||
|
||||
err_info_ptr->adtnl.info_pres = SD_TRUE; /* set info present indicator */
|
||||
err_info_ptr->adtnl.ssi_pres = SD_TRUE; /* set additional service pres */
|
||||
|
||||
err_info_ptr->adtnl.service = aCtx->asn1r_elmnt_id; /* save the service id */
|
||||
|
||||
/* Companion Standard additional service error */
|
||||
err_info_ptr->adtnl.ss_error_data = aCtx->asn1r_field_ptr; /* save ptr to field */
|
||||
err_info_ptr->adtnl.ss_error_len = aCtx->asn1r_elmnt_len; /* save len of field */
|
||||
asn1r_parse_next (aCtx, err_adtnl_done); /* parse contents */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* err_adtnl_done */
|
||||
/* IS: define event enrollment, object name has been obtained -OR- */
|
||||
/* Companion Standard ANY has been parsed OK. Message is now done. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID err_adtnl_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = err_ssi_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* err_ssi_done */
|
||||
/* Service specific info constructor done */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID err_ssi_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
if ((_mmsdec_rslt->type == MMSREQ) || /* terminate download request */
|
||||
(_mmsdec_rslt->type == MMSUNREQ)) /* or Event Notification */
|
||||
/* Terminate Download req or Event Notification unconfirmed */
|
||||
/* request is being decoded, decode can be done, but check for */
|
||||
/* companion standard information. */
|
||||
_ms_set_cs_check (aCtx);
|
||||
else
|
||||
aCtx->asn1r_decode_done = SD_TRUE; /* just terminate the parse */
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_err_resp */
|
||||
/* Create and send a general error response */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_err_resp (MMSREQ_IND *indptr, ST_INT16 class, ST_INT16 code)
|
||||
{
|
||||
ST_UCHAR *msg_ptr; /* pointer to start of message */
|
||||
ST_INT msg_len; /* length of message built */
|
||||
ST_RET ret; /* function return value */
|
||||
ASN1_ENC_CTXT localEncCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_ENC_CTXT *aCtx = &localEncCtx;
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
if (!(ret = _ms_check_ind_actv (indptr)))
|
||||
{
|
||||
msg_ptr = _ms_mk_err_resp (aCtx, m_build_buf,mms_max_msgsize,indptr->op,indptr->id,
|
||||
class,code);
|
||||
msg_len = M_BUILD_BUF_END - msg_ptr;
|
||||
|
||||
if (aCtx->asn1r_encode_overrun) /* Check for encode overrun */
|
||||
ret = ME_ASN1_ENCODE_OVERRUN;
|
||||
else
|
||||
ret = _mms_send_data (indptr->chan, msg_len, msg_ptr,
|
||||
indptr->context, indptr->add_addr_info);
|
||||
|
||||
/* If a response logging function is installed, call it */
|
||||
if (!ret && m_log_error_resp_fun && (mms_debug_sel & MMS_LOG_RESP))
|
||||
(*m_log_error_resp_fun) (indptr, class, code);
|
||||
|
||||
_ms_ind_serve_done (indptr);
|
||||
}
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ret);
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_err_resp */
|
||||
/* Create and send a general error response */
|
||||
/* Initiate, Conclude, Confirmed Service */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_err_resp (ST_INT opcode, ST_UINT32 invoke,
|
||||
ST_INT16 err_class, ST_INT16 code)
|
||||
{
|
||||
ST_INT ret;
|
||||
ASN1_ENC_CTXT localEncCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_ENC_CTXT *aCtx = &localEncCtx;
|
||||
ERR_INFO err_info;
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
mmsl_msg_start = _ms_mk_err_resp (aCtx, mmsl_enc_buf,mmsl_enc_buf_size,opcode,invoke,
|
||||
err_class,code);
|
||||
mmsl_msg_len = (mmsl_enc_buf + mmsl_enc_buf_size) - mmsl_msg_start;
|
||||
|
||||
if (!aCtx->asn1r_encode_overrun) /* Check for encode overrun */
|
||||
ret = SD_SUCCESS;
|
||||
else
|
||||
ret = ME_ASN1_ENCODE_OVERRUN;
|
||||
|
||||
if ((mms_debug_sel & MMS_LOG_RESP) && ret == SD_SUCCESS && ml_log_error_resp_fun)
|
||||
{
|
||||
memset (&err_info, 0, sizeof (err_info));
|
||||
err_info.code = code;
|
||||
err_info.eclass = err_class;
|
||||
(*ml_log_error_resp_fun) (invoke, &err_info);
|
||||
}
|
||||
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_err_resp */
|
||||
/* This function is called to build a general error response. */
|
||||
/* adtnl_err_info is a global variable containing additional error */
|
||||
/* information. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_UCHAR *_ms_mk_err_resp (ASN1_ENC_CTXT *aCtx, ST_UCHAR *buf_ptr, ST_INT buf_len, ST_INT op,
|
||||
ST_UINT32 id, ST_INT16 err_class, ST_INT16 code)
|
||||
{
|
||||
ST_INT pdu_type; /* PDU type to go in error PDU. */
|
||||
#ifdef DEBUG_SISCO
|
||||
ST_UCHAR *msg_start; /* These variables used for */
|
||||
ST_INT msg_len; /* debug print only */
|
||||
#endif
|
||||
|
||||
asn1r_strt_asn1_bld (aCtx, buf_ptr,buf_len); /* init the ASN.1 tools */
|
||||
_ms_wr_service_err (aCtx, err_class,code,&adtnl_err_info);
|
||||
|
||||
/* Write SEQUENCE header and invoke id, if this opcode is NOT initiate */
|
||||
/* or conclude. */
|
||||
if ((op == MMSOP_INITIATE) || (op == MMSOP_CONCLUDE))
|
||||
;
|
||||
else
|
||||
{ /* Finish the serviceError sequence. */
|
||||
if (op == MMSOP_CANCEL)
|
||||
asn1r_fin_constr (aCtx, 1,CTX,DEF); /* context tag 1 for cancel */
|
||||
else
|
||||
asn1r_fin_constr (aCtx, 2,CTX,DEF); /* context 2 for confirmed err */
|
||||
|
||||
#ifdef MOD_SUPPORT
|
||||
if (adtnl_err_info.mod_pos_pres) /* send the modifier position */
|
||||
{
|
||||
asn1r_wr_u32 (aCtx, adtnl_err_info.mod_pos);
|
||||
asn1r_fin_prim (aCtx, 1,CTX);
|
||||
adtnl_err_info.mod_pos_pres = SD_FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
asn1r_wr_u32 (aCtx, id); /* Write the invoke ID. */
|
||||
asn1r_fin_prim (aCtx, 0,CTX); /* conf and cancl both use CTX 0 tag */
|
||||
}
|
||||
|
||||
/* Reset add'l info structure to empty */
|
||||
adtnl_err_info.info_pres = SD_FALSE;
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case MMSOP_INITIATE :
|
||||
pdu_type = MMSINITERR;
|
||||
break;
|
||||
case MMSOP_CONCLUDE :
|
||||
pdu_type = MMSCNCLERR;
|
||||
break;
|
||||
case MMSOP_CANCEL :
|
||||
pdu_type = MMSCANERR;
|
||||
break;
|
||||
default:
|
||||
pdu_type = MMSERROR;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_SISCO
|
||||
asn1r_fin_constr (aCtx, (ST_UINT16) pdu_type,CTX,DEF);
|
||||
msg_start = aCtx->asn1r_field_ptr + 1;
|
||||
msg_len = (buf_ptr + buf_len) - msg_start;
|
||||
MLOG_ENC1 ("ERROR Response built : len = %d ",msg_len);
|
||||
MLOG_ENCH (msg_len,msg_start);
|
||||
MLOG_PAUSEENC (NULL);
|
||||
return (msg_start);
|
||||
#else
|
||||
asn1r_fin_constr (aCtx, (ST_UINT16) pdu_type,CTX,DEF);
|
||||
return (aCtx->asn1r_field_ptr + 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* wr_service_err */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_wr_service_err (ASN1_ENC_CTXT *aCtx, ST_INT16 err_class, ST_INT16 code,
|
||||
ADTNL_ERR_RESP_INFO *adtnl_info)
|
||||
{
|
||||
ST_INT16 ssi_error;
|
||||
|
||||
asn1r_strt_constr (aCtx); /* start sequence constructor */
|
||||
if (adtnl_info->info_pres)
|
||||
{ /* write additional info if present */
|
||||
if (adtnl_info->ssi_pres)
|
||||
{ /* write the service specific info */
|
||||
asn1r_strt_constr (aCtx);
|
||||
switch (adtnl_info->service)
|
||||
{
|
||||
case 0 : /* obtain file */
|
||||
case 1 : /* start */
|
||||
case 2 : /* stop */
|
||||
case 3 : /* resume */
|
||||
case 4 : /* reset */
|
||||
ssi_error = (ST_INT16) adtnl_info->ss_error_val;
|
||||
asn1r_wr_i16 (aCtx, ssi_error);
|
||||
asn1r_fin_prim (aCtx, adtnl_info->service,CTX);
|
||||
break;
|
||||
|
||||
case 5 : /* delete variable access */
|
||||
case 6 : /* delete named variable list */
|
||||
case 7 : /* delete named type */
|
||||
asn1r_wr_u32 (aCtx, adtnl_info->ss_error_val);
|
||||
asn1r_fin_prim (aCtx, adtnl_info->service,CTX);
|
||||
break;
|
||||
|
||||
case 8 :
|
||||
#ifndef MMS_LITE
|
||||
if (mms_chan_info[_mmsdechan].version) /* IS */
|
||||
#else
|
||||
if (mmsl_version) /* IS */
|
||||
#endif
|
||||
{ /* IS, define event enrollment */
|
||||
asn1r_strt_constr (aCtx);
|
||||
_ms_wr_mms_objname (aCtx, &adtnl_info->ss_error_oname);
|
||||
asn1r_fin_constr (aCtx, 8,CTX,DEF);
|
||||
}
|
||||
else
|
||||
{ /* DIS, file rename */
|
||||
ssi_error = (ST_INT16) adtnl_info->ss_error_val;
|
||||
asn1r_wr_i16 (aCtx, ssi_error);
|
||||
asn1r_fin_prim (aCtx, adtnl_info->service,CTX);
|
||||
}
|
||||
break;
|
||||
|
||||
case 9 :
|
||||
#ifndef MMS_LITE
|
||||
if (mms_chan_info[_mmsdechan].version) /* IS */
|
||||
#else
|
||||
if (mmsl_version) /* IS */
|
||||
#endif
|
||||
{ /* IS, file rename */
|
||||
ssi_error = (ST_INT16) adtnl_info->ss_error_val;
|
||||
asn1r_wr_i16 (aCtx, ssi_error);
|
||||
asn1r_fin_prim (aCtx, adtnl_info->service,CTX);
|
||||
}
|
||||
else
|
||||
{ /* DIS, additional service err */
|
||||
asn1r_strt_constr (aCtx);
|
||||
asn1r_wr_delmnt (aCtx, adtnl_info->ss_error_data,adtnl_info->ss_error_len);
|
||||
asn1r_fin_constr (aCtx, 9,CTX,DEF);
|
||||
}
|
||||
break;
|
||||
|
||||
default: /* IS, additional service error */
|
||||
asn1r_strt_constr (aCtx);
|
||||
asn1r_wr_delmnt (aCtx, adtnl_info->ss_error_data,adtnl_info->ss_error_len);
|
||||
asn1r_fin_constr (aCtx, 10,CTX,DEF);
|
||||
}
|
||||
asn1r_fin_constr (aCtx, 3,CTX,DEF);
|
||||
}
|
||||
|
||||
if (adtnl_info->descr_pres)
|
||||
{ /* write the additional description */
|
||||
asn1r_wr_vstr (aCtx, adtnl_info->descr);
|
||||
asn1r_fin_prim (aCtx, 2,CTX);
|
||||
}
|
||||
if (adtnl_info->code_pres)
|
||||
{ /* write the service specific info */
|
||||
asn1r_wr_i32 (aCtx, adtnl_info->code);
|
||||
asn1r_fin_prim (aCtx, 1,CTX);
|
||||
}
|
||||
adtnl_info->info_pres = SD_FALSE;
|
||||
}
|
||||
|
||||
asn1r_strt_constr (aCtx); /* start choice constructor */
|
||||
asn1r_wr_i16 (aCtx, code); /* write the value */
|
||||
asn1r_fin_prim (aCtx, err_class,CTX); /* finish the contents */
|
||||
asn1r_fin_constr (aCtx, 0,CTX,DEF); /* context 0 cstr */
|
||||
}
|
||||
|
||||
110
mmslib/mmsl/mms_err2.c
Normal file
110
mmslib/mmsl/mms_err2.c
Normal file
@@ -0,0 +1,110 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1993 - 1997, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : mms_err2.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the MMS error functions for decoding */
|
||||
/* & encoding the error response PDUs : */
|
||||
/* initiate-ErrorPDU */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/09/05 EJV 06 Fixed thisFileName for MMS-EASE */
|
||||
/* 03/17/04 RKR 05 Changed thisFileName */
|
||||
/* 03/11/04 GLB 04 Remove "thisFileName" */
|
||||
/* 09/13/99 MDE 02 Added SD_CONST modifiers */
|
||||
/* 06/15/98 MDE 01 Changes to allow compile under C++ */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
#include "glbsem.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pcon.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* For debug version, use a static pointer to avoid duplication of */
|
||||
/* __FILE__ strings. */
|
||||
|
||||
#if defined(DEBUG_SISCO) && !defined(MMS_LITE)
|
||||
SD_CONST static ST_CHAR *SD_CONST thisFileName = __FILE__;
|
||||
#endif
|
||||
|
||||
#ifndef MMS_LITE
|
||||
|
||||
#include "mms_vcon.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* mp_init_err */
|
||||
/* Create and send an initiate error response */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_init_err (MMSREQ_IND *indptr, ST_INT16 class, ST_INT16 code)
|
||||
{
|
||||
INIT_INFO *init_req;
|
||||
INIT_INFO *init_resp;
|
||||
CS_INIT_INFO *cs_init_resp;
|
||||
ST_INT size;
|
||||
ST_INT i;
|
||||
ST_INT ret;
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
init_req = (INIT_INFO *) indptr->req_info_ptr;
|
||||
|
||||
/* Allocate the INITIATE response info, make big enough for all CS init */
|
||||
size = sizeof (INIT_INFO) +
|
||||
(MAX_INIT_CONTEXTS * sizeof (CS_INIT_INFO));
|
||||
init_resp = (INIT_INFO *) chk_calloc (1, size);
|
||||
cs_init_resp = (CS_INIT_INFO *) (init_resp+1);
|
||||
|
||||
if (!(ret = _ms_check_ind_actv (indptr)))
|
||||
{
|
||||
if (init_req->mms_p_context_pres)
|
||||
{
|
||||
init_resp->rslt.accept_context = SD_FALSE;
|
||||
init_resp->rslt.err_info_pres = SD_TRUE;
|
||||
init_resp->rslt.err.eclass = class;
|
||||
init_resp->rslt.err.code = code;
|
||||
}
|
||||
|
||||
for (i = 0; i < init_req->num_cs_init; ++i, ++cs_init_resp)
|
||||
{
|
||||
cs_init_resp->rslt.accept_context = SD_FALSE;
|
||||
cs_init_resp->rslt.err_info_pres = SD_TRUE;
|
||||
cs_init_resp->rslt.err.eclass = class;
|
||||
cs_init_resp->rslt.err.code = code;
|
||||
} /* for each CS context */
|
||||
|
||||
mv_chk_init_resp_param (indptr,init_resp);
|
||||
ret = mp_init_resp (indptr,init_resp);
|
||||
}
|
||||
|
||||
chk_free (init_resp);
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ret);
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/* mpl_init_err */
|
||||
/* Create an initiate error response */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_init_err (ST_INT16 err_class, ST_INT16 code)
|
||||
{
|
||||
return (mpl_err_resp (MMSOP_INITIATE,0L,err_class,code));
|
||||
}
|
||||
#endif
|
||||
75
mmslib/mmsl/mms_err3.c
Normal file
75
mmslib/mmsl/mms_err3.c
Normal file
@@ -0,0 +1,75 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1993 - 2007, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : mms_err3.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the MMS error functions for decoding */
|
||||
/* & encoding the error response PDUs : */
|
||||
/* conclude-ErrorPDU */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 11/01/07 EJV 06 Rem obsolete LLC30... code. */
|
||||
/* 03/09/05 EJV 05 Fixed thisFileName for MMS-EASE */
|
||||
/* 03/17/04 RKR 04 Changed thisFileName */
|
||||
/* 03/11/04 GLB 03 Remove "thisFileName" */
|
||||
/* 09/13/99 MDE 02 Added SD_CONST modifiers */
|
||||
/* 06/15/98 MDE 01 Changes to allow compile under C++ */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
#include "glbsem.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pcon.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* For debug version, use a static pointer to avoid duplication of */
|
||||
/* __FILE__ strings. */
|
||||
|
||||
#if defined(DEBUG_SISCO) && !defined(MMS_LITE)
|
||||
SD_CONST static ST_CHAR *SD_CONST thisFileName = __FILE__;
|
||||
#endif
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/* mp_conclude_err */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_conclude_err (MMSREQ_IND *indptr, ST_INT16 class, ST_INT16 code)
|
||||
{
|
||||
ST_RET ret;
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
mms_chan_info[indptr->chan].ctxt.chan_state &= ~M_CONCL_URESP_WAIT;
|
||||
ret = mp_err_resp (indptr,class,code);
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ret);
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/* mpl_conclude_err */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_conclude_err (ST_INT16 err_class, ST_INT16 code)
|
||||
{
|
||||
return (mpl_err_resp (MMSOP_CONCLUDE,0L,err_class,code));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
96
mmslib/mmsl/mms_err4.c
Normal file
96
mmslib/mmsl/mms_err4.c
Normal file
@@ -0,0 +1,96 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1993 - 2007, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : mms_err4.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the MMS error functions for decoding */
|
||||
/* & encoding the error response PDUs : */
|
||||
/* cancel-ErrorPDU */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 11/01/07 EJV 07 Rem obsolete LLC30... code. */
|
||||
/* 08/09/05 EJV 06 MMS_LITE does not need thisFileName. */
|
||||
/* 03/17/04 RKR 05 Changed thisFileName */
|
||||
/* 03/11/04 GLB 04 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 03 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 02 Added SD_CONST modifiers */
|
||||
/* 06/15/98 MDE 01 Changes to allow compile under C++ */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
#include "glbsem.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pcon.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* For debug version, use a static pointer to avoid duplication of */
|
||||
/* __FILE__ strings. */
|
||||
|
||||
#if defined(DEBUG_SISCO) && (defined(S_MT_SUPPORT) && !defined(MMS_LITE))
|
||||
SD_CONST static ST_CHAR *SD_CONST thisFileName = __FILE__;
|
||||
#endif
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/* mp_cancel_err */
|
||||
/* Create and send a cancel error response */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_cancel_err (MMSREQ_IND *indptr, ST_INT16 err_class, ST_INT16 code)
|
||||
{
|
||||
ST_UCHAR *msg_ptr; /* pointer to start of message */
|
||||
ST_INT msg_len; /* length of message built */
|
||||
ST_RET ret; /* function return value */
|
||||
ASN1_ENC_CTXT localEncCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_ENC_CTXT *aCtx = &localEncCtx;
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
if (!(ret = _ms_check_ind_actv (indptr)))
|
||||
{
|
||||
if (indptr->cancl_state != CANCELING)
|
||||
{
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (MVE_CANCEL_STATE);
|
||||
}
|
||||
msg_ptr = _ms_mk_err_resp (aCtx, m_build_buf,mms_max_msgsize,MMSOP_CANCEL,indptr->id,
|
||||
err_class,code);
|
||||
msg_len = M_BUILD_BUF_END - msg_ptr; /* find length */
|
||||
|
||||
if (aCtx->asn1r_encode_overrun) /* Check for encode overrun */
|
||||
ret = ME_ASN1_ENCODE_OVERRUN;
|
||||
else
|
||||
ret = _mms_send_data (indptr->chan, msg_len, msg_ptr,
|
||||
indptr->context, indptr->add_addr_info);
|
||||
}
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ret);
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/* mpl_cancel_err */
|
||||
/* Create a cancel error response */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_cancel_err (ST_UINT32 invoke, ST_INT16 err_class, ST_INT16 code)
|
||||
{
|
||||
return (mpl_err_resp (MMSOP_CANCEL,invoke,err_class,code));
|
||||
}
|
||||
|
||||
#endif
|
||||
281
mmslib/mmsl/mms_rej.c
Normal file
281
mmslib/mmsl/mms_rej.c
Normal file
@@ -0,0 +1,281 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2002, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : mms_rej.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the functions to decode/encode a reject */
|
||||
/* operation. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 06 Cleaned up "thisFileName" */
|
||||
/* 01/18/02 JRB 05 Fix encoding if !DEBUG_SISCO (use new fcts */
|
||||
/* _ms_fin_pdu & _ms_fin_pdu_log. */
|
||||
/* 12/20/01 JRB 04 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 03 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 02 Changes to decode buffer allocation scheme */
|
||||
/* 07/03/97 MDE 01 Op-specific info buffer handling changes */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
#include "glbsem.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pcon.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* For debug version, use a static pointer to avoid duplication of */
|
||||
/* __FILE__ strings. */
|
||||
|
||||
#if defined(DEBUG_SISCO) && defined(S_MT_SUPPORT)
|
||||
SD_CONST static ST_CHAR *SD_CONST thisFileName = __FILE__;
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
static REJECT_RESP_INFO *rej_info_ptr;
|
||||
|
||||
static ST_VOID rej_get_problem (ASN1_DEC_CTXT *aCtx, ST_UINT16 id_code);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_reject */
|
||||
/* Reject PDU is being decoded, and this is a context-specific element. */
|
||||
/* It should be an integer. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_reject (ASN1_DEC_CTXT *aCtx, ST_UINT16 id_code)
|
||||
{
|
||||
MLOG_CDEC0 ("mms_reject");
|
||||
|
||||
if (aCtx->asn1r_constr_elmnt)
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, PDU_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
rej_info_ptr = (REJECT_RESP_INFO *) _m_get_dec_buf (aCtx, sizeof (REJECT_RESP_INFO));
|
||||
aCtx->asn1r_decode_method = ASN1_CLASS_METHOD;
|
||||
rej_info_ptr -> detected_here = SD_FALSE; /* reject detected remotely */
|
||||
rej_info_ptr -> pdu_type = UNKNOWNTYPE; /* in this case, no pdu type */
|
||||
|
||||
if (!id_code) /* if this is invoke id - */
|
||||
{
|
||||
if (asn1r_get_u32 (aCtx, &rej_info_ptr -> invoke)) /* read invoke id */
|
||||
asn1r_set_dec_err (aCtx, PDU_INVALID);
|
||||
else
|
||||
{
|
||||
rej_info_ptr -> invoke_known = SD_TRUE; /* set flag */
|
||||
_mmsdec_rslt -> dec_level = 2;
|
||||
_mmsdec_rslt -> id = rej_info_ptr -> invoke; /* store invoke ID */
|
||||
aCtx->asn1r_c_id_fun = rej_get_problem;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rej_info_ptr -> invoke_known = SD_FALSE; /* clear */
|
||||
rej_get_problem (aCtx, id_code); /* call rejectreason fun direct */
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* rej_get_problem */
|
||||
/* Reject PDU is being decoded, and this is a context-specific element. */
|
||||
/* It should be an integer in which the tag is the error class and the */
|
||||
/* value is the error code. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID rej_get_problem (ASN1_DEC_CTXT *aCtx, ST_UINT16 id_code)
|
||||
{
|
||||
MLOG_CDEC0 ("rej_get_problem");
|
||||
|
||||
if (aCtx->asn1r_constr_elmnt || id_code < 1 || id_code > 11 || aCtx->asn1r_elmnt_len > 1)
|
||||
{ /* better not be constructor */
|
||||
asn1r_set_dec_err (aCtx, PDU_INVALID); /* better be context tagged 1-4 */
|
||||
return; /* max value = 8 */
|
||||
}
|
||||
|
||||
/* Information looks OK; extract it. */
|
||||
|
||||
rej_info_ptr -> rej_class = id_code;
|
||||
asn1r_get_i16 (aCtx, &rej_info_ptr -> rej_code); /* get the problem value */
|
||||
|
||||
aCtx->asn1r_decode_done_fun = _mms_dec_done_ok; /* all done now */
|
||||
aCtx->asn1r_decode_done = SD_TRUE;
|
||||
}
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_reject_resp */
|
||||
/* Sends reject message. Returns integer value indicating success */
|
||||
/* (value = 0) or failure (value <> 0) to send the reject message. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_reject_resp (ST_INT chan, REJECT_RESP_INFO *info_ptr)
|
||||
{
|
||||
ST_UCHAR *msg_ptr;
|
||||
ST_INT msg_len;
|
||||
LLP_ADDR_INFO add_llp_info;
|
||||
ST_RET ret;
|
||||
ASN1_ENC_CTXT localEncCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_ENC_CTXT *aCtx = &localEncCtx;
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
msg_ptr = _ms_mk_reject (aCtx, m_build_buf,mms_max_msgsize,info_ptr);
|
||||
msg_len = M_BUILD_BUF_END - msg_ptr; /* find length */
|
||||
|
||||
add_llp_info.i.LLC.use_rem_addr = SD_FALSE;
|
||||
add_llp_info.i.LLC.send_type = REJECT_PDU;
|
||||
add_llp_info.i.LLC.req_ptr = (ST_CHAR *)NULL;
|
||||
|
||||
/* Check for encode overrun */
|
||||
if (aCtx->asn1r_encode_overrun)
|
||||
ret = ME_ASN1_ENCODE_OVERRUN;
|
||||
else
|
||||
ret = _mms_send_data (chan, msg_len, msg_ptr, P_context_sel[chan], &add_llp_info);
|
||||
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ret);
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_reject_resp */
|
||||
/* Sends reject message. Returns integer value indicating success */
|
||||
/* (value = 0) or failure (value <> 0) to send the reject message. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_reject_resp (REJECT_RESP_INFO *info_ptr)
|
||||
{
|
||||
ST_RET ret;
|
||||
ASN1_ENC_CTXT localEncCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_ENC_CTXT *aCtx = &localEncCtx;
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
mmsl_msg_start = _ms_mk_reject (aCtx, mmsl_enc_buf,mmsl_enc_buf_size,info_ptr);
|
||||
/* find length */
|
||||
mmsl_msg_len = (mmsl_enc_buf + mmsl_enc_buf_size) - mmsl_msg_start;
|
||||
|
||||
if (aCtx->asn1r_encode_overrun) /* Check for encode overrun */
|
||||
ret = ME_ASN1_ENCODE_OVERRUN;
|
||||
else
|
||||
ret = SD_SUCCESS;
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/* _ms_mk_reject */
|
||||
/* Construct a reject PDU. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_UCHAR *_ms_mk_reject (ASN1_ENC_CTXT *aCtx, ST_UCHAR *msg_ptr, ST_INT buf_len,
|
||||
REJECT_RESP_INFO *info_ptr)
|
||||
{
|
||||
ST_UCHAR *pduStart;
|
||||
ST_INT pduLen;
|
||||
|
||||
asn1r_strt_asn1_bld (aCtx, msg_ptr,buf_len); /* init the ASN.1 tools */
|
||||
|
||||
asn1r_wr_i16 (aCtx, info_ptr -> rej_code);
|
||||
asn1r_fin_prim (aCtx, info_ptr -> rej_class,CTX);
|
||||
|
||||
#ifndef MMS_LITE
|
||||
if (info_ptr->invoke_known && info_ptr->invoke <= MAX_INVOKE)
|
||||
#else
|
||||
if (info_ptr->invoke_known)
|
||||
#endif
|
||||
{
|
||||
asn1r_wr_u32 (aCtx, info_ptr -> invoke); /* if the invoke ID is known & */
|
||||
asn1r_fin_prim (aCtx, 0,CTX); /* is not artificial, write it */
|
||||
}
|
||||
|
||||
pduStart = _ms_fin_pdu (aCtx, MMSREJECT, &pduLen);
|
||||
#ifdef DEBUG_SISCO
|
||||
_ms_fin_pdu_log (MMSREJECT, "REJECT", pduStart, pduLen);
|
||||
#endif
|
||||
|
||||
return (pduStart);
|
||||
}
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_reject_resp */
|
||||
/* Function to reject an MMS confirmed response pdu, given the request */
|
||||
/* control structure. This must be a valid response, parsed OK. */
|
||||
/* Called by the user or virtual machine after the confirm is matched. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_reject_resp (MMSREQ_PEND *reqptr, ST_INT16 code)
|
||||
{
|
||||
REJECT_RESP_INFO info; /* reject input info structure */
|
||||
|
||||
info.detected_here = SD_TRUE; /* parse error detected locally */
|
||||
|
||||
info.invoke_known = SD_TRUE;
|
||||
info.invoke = reqptr->id;
|
||||
|
||||
info.pdu_type = MMSRESP; /* confirmed response */
|
||||
info.rej_code = code; /* include error code */
|
||||
info.rej_class = 2; /* invalid response class */
|
||||
|
||||
if (mp_reject_resp (reqptr->chan,&info)) /* send the reject pdu */
|
||||
(*u_mmsexcept_ind_fun)(reqptr->chan,MX_REJECT);
|
||||
(*u_reject_ind_fun) (reqptr->chan,&info);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* mp_reject_ind */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_reject_ind (MMSREQ_IND *req_ptr, REJECT_RESP_INFO *info_ptr)
|
||||
{
|
||||
ST_RET ret; /* function return value */
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
if (!(ret = _ms_check_ind_actv (req_ptr)))
|
||||
{
|
||||
if (!(ret = mp_reject_resp (req_ptr->chan, info_ptr)))
|
||||
_ms_ind_serve_done (req_ptr);
|
||||
}
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* mp_reject_conf */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_reject_conf (MMSREQ_PEND *req_ptr, REJECT_RESP_INFO *info_ptr)
|
||||
{
|
||||
ST_RET ret; /* function return value */
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
if (!(ret = _ms_check_req_actv (req_ptr)))
|
||||
{
|
||||
ret = mp_reject_resp (req_ptr->chan, info_ptr);
|
||||
}
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ret);
|
||||
}
|
||||
|
||||
#endif
|
||||
1222
mmslib/mmsl/mms_rtaa.c
Normal file
1222
mmslib/mmsl/mms_rtaa.c
Normal file
File diff suppressed because it is too large
Load Diff
3265
mmslib/mmsl/mms_tdef.c
Normal file
3265
mmslib/mmsl/mms_tdef.c
Normal file
File diff suppressed because it is too large
Load Diff
73
mmslib/mmsl/mmscancl.c
Normal file
73
mmslib/mmsl/mmscancl.c
Normal file
@@ -0,0 +1,73 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1993 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : mmscancl.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the common function to encode a conclude */
|
||||
/* operation. Note that the cancel request and the cancel */
|
||||
/* response are the same. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 12/20/01 JRB 02 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 01 Added SD_CONST modifiers */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* For debug version, use a static pointer to avoid duplication of */
|
||||
/* __FILE__ strings. */
|
||||
|
||||
#ifdef DEBUG_SISCO
|
||||
SD_CONST static ST_CHAR *SD_CONST thisFileName = __FILE__;
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/* _ms_mk_cancel */
|
||||
/* Construct a cancel response or request PDU. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_UCHAR *_ms_mk_cancel (ASN1_ENC_CTXT *aCtx, ST_BOOLEAN request, ST_UCHAR *msg_ptr, ST_INT buf_len, ST_UINT32 id)
|
||||
{
|
||||
ST_UCHAR *msg_start;
|
||||
#ifdef DEBUG_SISCO
|
||||
ST_INT msg_len; /* Used for debug print only */
|
||||
#endif
|
||||
|
||||
asn1r_strt_asn1_bld (aCtx, msg_ptr,buf_len); /* init the ASN.1 tools */
|
||||
|
||||
asn1r_wr_u32 (aCtx, id); /* write the invoke id */
|
||||
|
||||
/* Finish the PDU with the correct context tag. */
|
||||
if (request)
|
||||
asn1r_fin_prim (aCtx, MMSCANREQ,CTX);
|
||||
else
|
||||
asn1r_fin_prim (aCtx, MMSCANRESP,CTX);
|
||||
|
||||
msg_start = aCtx->asn1r_field_ptr + 1;
|
||||
#ifdef DEBUG_SISCO
|
||||
msg_len = (msg_ptr + buf_len) - msg_start;
|
||||
MLOG_ENC1 ("CANCEL response built, len = %d", msg_len);
|
||||
MLOG_ENCH (msg_len,msg_start);
|
||||
MLOG_PAUSEENC (NULL);
|
||||
#endif
|
||||
|
||||
return (msg_start);
|
||||
}
|
||||
76
mmslib/mmsl/mmsconcl.c
Normal file
76
mmslib/mmsl/mmsconcl.c
Normal file
@@ -0,0 +1,76 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : mmsconcl.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the common function to encode a conclude */
|
||||
/* operation. Note that the conclude request and the conclude */
|
||||
/* response are the same. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 12/20/01 JRB 02 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 01 Added SD_CONST modifiers */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* For debug version, use a static pointer to avoid duplication of */
|
||||
/* __FILE__ strings. */
|
||||
|
||||
#ifdef DEBUG_SISCO
|
||||
SD_CONST static ST_CHAR *SD_CONST thisFileName = __FILE__;
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_conclude */
|
||||
/* Function to construct a conclude message in selected buffer. */
|
||||
/* This may be used for either request or response by selecting the */
|
||||
/* PDU type desired. Pass a pointer to the end of the build buffer. */
|
||||
/* Returns a pointer to the first byte of the decoded message. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_UCHAR *_ms_mk_conclude (ASN1_ENC_CTXT *aCtx, ST_UCHAR *buf_ptr, ST_INT buf_len, ST_INT pdutype)
|
||||
{
|
||||
#ifdef DEBUG_SISCO
|
||||
ST_UCHAR *msg_start; /* These variables used for */
|
||||
ST_INT msg_len; /* debug print only */
|
||||
#endif
|
||||
|
||||
asn1r_strt_asn1_bld (aCtx, buf_ptr,buf_len); /* init the ASN.1 tools */
|
||||
|
||||
/* The only data element is a context-tagged NULL. */
|
||||
|
||||
#ifdef DEBUG_SISCO
|
||||
asn1r_fin_prim (aCtx, (ST_UINT16) pdutype, CTX);
|
||||
msg_start = aCtx->asn1r_field_ptr + 1;
|
||||
msg_len = (buf_ptr + buf_len) - msg_start;
|
||||
MLOG_ENC2 ("CONCLUDE %s built, len = %d",
|
||||
pdutype == MMSCNCLREQ ? "request" : "response",
|
||||
msg_len);
|
||||
MLOG_ENCH (msg_len,msg_start);
|
||||
MLOG_PAUSEENC (NULL);
|
||||
return (msg_start);
|
||||
#else
|
||||
asn1r_fin_prim (aCtx, (ST_UINT16) pdutype,CTX);
|
||||
return (aCtx->asn1r_field_ptr + 1);
|
||||
#endif
|
||||
}
|
||||
1758
mmslib/mmsl/mmsdata.c
Normal file
1758
mmslib/mmsl/mmsdata.c
Normal file
File diff suppressed because it is too large
Load Diff
1231
mmslib/mmsl/mmsdatat.c
Normal file
1231
mmslib/mmsl/mmsdatat.c
Normal file
File diff suppressed because it is too large
Load Diff
768
mmslib/mmsl/mmsdec.c
Normal file
768
mmslib/mmsl/mmsdec.c
Normal file
@@ -0,0 +1,768 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2008, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : mmsdec.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the initial MMS message decode functions. */
|
||||
/* Decodes the header portion of MMS PDUs. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/17/08 EJV 10 Added slog. */
|
||||
/* 12/19/05 JRB 22 Chg cr to cr_mms, del static to fix warning.*/
|
||||
/* 09/07/05 JRB 08 Fix backwards client/server error log msgs. */
|
||||
/* 07/24/02 EJV 07 mmsdec_ucreq_opcode: corr err in the check */
|
||||
/* opcode due to recent MMSOP_xxx changes. */
|
||||
/* 12/20/01 JRB 06 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* Del mms_err_invoke_fun proto (see mms_dfun.h)*/
|
||||
/* 09/13/99 MDE 05 Added SD_CONST modifiers */
|
||||
/* 04/07/99 MDE 04 Logging improvements (unsupported service) */
|
||||
/* 03/23/99 MDE 03 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 02 Changes to allow compile under C++ */
|
||||
/* 03/18/98 JRB 01 Fix mmsdec_map_err for new error values. */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_err.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* For debug version, use a static pointer to avoid duplication of */
|
||||
/* __FILE__ strings. */
|
||||
|
||||
#ifdef DEBUG_SISCO
|
||||
SD_CONST static ST_CHAR *SD_CONST thisFileName = __FILE__;
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID mmsdec_start (ASN1_DEC_CTXT *aCtx, ST_UINT16 id_code);
|
||||
static ST_VOID mmsdec_invoke_id (ASN1_DEC_CTXT *aCtx, ST_UINT16 id_code);
|
||||
#ifdef MOD_SUPPORT /* support modifiers */
|
||||
static ST_VOID mmsdec_modlist (ASN1_DEC_CTXT *aCtx, ST_UINT16 el_id);
|
||||
static ST_VOID mmsdec_modlist_done_fun (ASN1_DEC_CTXT *aCtx);
|
||||
#endif
|
||||
static ST_VOID mmsdec_opcode (ASN1_DEC_CTXT *aCtx, ST_UINT16 id_code);
|
||||
static ST_VOID mmsdec_ucreq_opcode (ASN1_DEC_CTXT *aCtx, ST_UINT16 id_code);
|
||||
static ST_RET mmsdec_chk_req_op (ASN1_DEC_CTXT *aCtx, ST_INT opcode, ST_INT unsupp_code);
|
||||
static ST_RET mmsdec_chk_resp_op (ASN1_DEC_CTXT *aCtx, ST_UINT opcode);
|
||||
static ST_VOID mmsdec_map_err (ASN1_DEC_CTXT *aCtx); /* maps ASN.1 tool errors to MMS */
|
||||
#ifndef MMS_LITE /* don't assign op id's */
|
||||
static ST_VOID mmsdec_assign_rid (ST_INT opcode);
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
const ST_CHAR cr_mms[] =
|
||||
"(c) COPYRIGHT SYSTEMS INTEGRATION SPECIALISTS COMPANY INC., 1986 - 2005. All Rights Reserved.";
|
||||
/************************************************************************/
|
||||
/* Operation Specific Decode Buffer Management */
|
||||
|
||||
ST_VOID *(*m_calloc_os_fun)(ST_UINT num, ST_UINT size);
|
||||
ST_VOID *(*m_realloc_os_fun)(ST_VOID *old, ST_UINT new_size);
|
||||
ST_VOID (*m_free_os_fun)(ST_VOID *buf);
|
||||
|
||||
/************************************************************************/
|
||||
/* The array below is used to check the constructed state of a PDU */
|
||||
|
||||
SD_CONST static ST_UINT16 mmspdu_cstr_chk[] =
|
||||
{
|
||||
CONSTR, /* CONFIRMED REQUEST IS CONSTRUCTOR */
|
||||
CONSTR, /* CONFIRMED RESPONSE */
|
||||
CONSTR, /* CONFIRMED ERROR */
|
||||
CONSTR, /* UNCONFIRMED PDU */
|
||||
CONSTR, /* REJECT */
|
||||
0, /* CANCEL REQUEST */
|
||||
0, /* CANCEL RESPONSE */
|
||||
CONSTR, /* CANCEL ERROR */
|
||||
CONSTR, /* INITIATE REQUEST */
|
||||
CONSTR, /* INITIATE RESPONSE */
|
||||
CONSTR, /* INITIATE ERROR */
|
||||
0, /* CONCLUDE REQUEST IS PRIMITIVE */
|
||||
0, /* CONCLUDE RESPONSE */
|
||||
CONSTR /* CONCLUDE ERROR IS CONSTRUCTOR */
|
||||
};
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mms_decode */
|
||||
/* Function to setup and initiate MMS PDU decode */
|
||||
/* Only fourteen context specific codes are legal at start */
|
||||
/* Input parameters : pointer to message start, length of message, */
|
||||
/* pointer to result buffer. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET _ms_mms_decode (ST_UCHAR *msg_ptr, ST_INT len, MMSDEC_INFO *rslt_ptr)
|
||||
{
|
||||
ASN1_DEC_CTXT localDecCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_DEC_CTXT *aCtx = &localDecCtx;
|
||||
|
||||
MLOG_DEC0 ("Decoding MMS PDU");
|
||||
memset (aCtx, 0, sizeof (ASN1_DEC_CTXT)); /* CRITICAL: start clean. */
|
||||
|
||||
aCtx->asn1r_decode_method = ASN1_CLASS_METHOD; /* select the class method */
|
||||
aCtx->asn1r_c_id_fun = mmsdec_start; /* point to mms decode initial function */
|
||||
aCtx->asn1r_u_id_fun = asn1r_class_err; /* no universals to start */
|
||||
aCtx->asn1r_a_id_fun = asn1r_class_err; /* no applications to start */
|
||||
aCtx->asn1r_p_id_fun = asn1r_class_err; /* no privates to start */
|
||||
|
||||
aCtx->asn1r_decode_done_fun = asn1r_done_err; /* done function = error fun */
|
||||
aCtx->asn1r_err_fun = NULL; /* set up error detected fun */
|
||||
|
||||
_mmsdec_msglen = len; /* save decode message length */
|
||||
_mmsdec_msgptr = msg_ptr; /* save decode message ptr */
|
||||
_mmsdec_rslt = rslt_ptr; /* save the result pointer */
|
||||
rslt_ptr->err_code = NO_DECODE_ERR; /* start with no error */
|
||||
rslt_ptr->dec_level = 0; /* start with no usable info */
|
||||
rslt_ptr->data_pres = SD_FALSE;
|
||||
rslt_ptr->mods.info_pres = SD_FALSE;
|
||||
rslt_ptr->cs.cs_pres = SD_FALSE;
|
||||
_mms_dec_info_pres = SD_FALSE;
|
||||
|
||||
/* ASN.1 decode machine is set up for initial MMS decode. */
|
||||
/* Call 'asn1r_decode_asn1' to parse the message. */
|
||||
|
||||
asn1r_decode_asn1 (aCtx, msg_ptr,len); /* do message decode */
|
||||
mmsdec_map_err (aCtx); /* write the error code */
|
||||
if (aCtx->asn1r_pdu_dec_err == NO_DECODE_ERR)
|
||||
return (SD_SUCCESS); /* return 'no error' code */
|
||||
#ifndef MMS_LITE
|
||||
else
|
||||
{
|
||||
if (_mmsdec_rslt->mods.info_pres) /* see if there were any mods */
|
||||
chk_free (_mmsdec_rslt->mods.mod_list_ptr);
|
||||
|
||||
/* Note that op specific buffer are free'd in _mms_dec_buf_free on error */
|
||||
|
||||
}
|
||||
#endif
|
||||
return (MVE_ASN1_DECODE_ERR); /* return error code */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mmsdec_start */
|
||||
/* Initial MMS decode context-specific code service function. This */
|
||||
/* function is called when the first data element of the message is a */
|
||||
/* context-specific class. */
|
||||
/************************************************************************/
|
||||
|
||||
#define MAX_MMS_PDU_TAG 13
|
||||
|
||||
static ST_VOID mmsdec_start (ASN1_DEC_CTXT *aCtx, ST_UINT16 id_code)
|
||||
{
|
||||
MLOG_CDEC0 ("mmsdec_start");
|
||||
|
||||
/* check for valid MMS PDU type, such as request, response, error, etc. */
|
||||
/* if valid tag and constructed state OK */
|
||||
if (id_code <= MAX_MMS_PDU_TAG &&
|
||||
!(mmspdu_cstr_chk[id_code] ^ aCtx->asn1r_constr_elmnt))
|
||||
{
|
||||
_mmsdec_rslt->dec_level = 1; /* set flag that PDU type is OK */
|
||||
_mmsdec_rslt->type = id_code; /* save the type for the user */
|
||||
switch (id_code)
|
||||
{
|
||||
case MMSREQ : /* Confirmed Request PDU */
|
||||
aCtx->asn1r_u_id_fun = mmsdec_invoke_id; /* next must be uni, integer */
|
||||
/* invoke ID */
|
||||
aCtx->asn1r_c_id_fun = asn1r_class_err; /* can not context specific */
|
||||
break;
|
||||
|
||||
case MMSRESP : /* Confirmed Response PDU */
|
||||
aCtx->asn1r_u_id_fun = mmsdec_invoke_id; /* next must be uni, integer */
|
||||
/* invoke ID */
|
||||
aCtx->asn1r_c_id_fun = asn1r_class_err; /* cannot be context specific */
|
||||
break;
|
||||
|
||||
case MMSERROR : /* Confirmed Error PDU */
|
||||
aCtx->asn1r_c_id_fun = mms_err_invoke_fun; /* must be context specific */
|
||||
break; /* integer (invoke ID) */
|
||||
|
||||
case MMSUNREQ : /* Unconfirmed PDU */
|
||||
aCtx->asn1r_c_id_fun = mmsdec_ucreq_opcode; /* expect context-specific tag */
|
||||
break;
|
||||
|
||||
case MMSREJECT : /* Reject PDU */
|
||||
aCtx->asn1r_c_id_fun = mms_reject; /* expect context-specific */
|
||||
break;
|
||||
|
||||
case MMSCANREQ : /* Cancel Request PDU */
|
||||
if (!(mmsop_en[MMSOP_CANCEL] & RESP_EN)) /* protocol error if */
|
||||
asn1r_set_dec_err (aCtx, CANREQ_UNSPECIFIED); /* unsupported service */
|
||||
else
|
||||
{
|
||||
if (asn1r_get_u32 (aCtx, &_mmsdec_rslt->id))
|
||||
asn1r_set_dec_err (aCtx, CANREQ_INVAL_INVOKE);
|
||||
else
|
||||
{
|
||||
_mmsdec_rslt->dec_level = 2;
|
||||
(*mms_req_decode_fun [MMSOP_CANCEL]) (aCtx);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MMSCANRESP : /* Cancel Response PDU */
|
||||
if (!(mmsop_en[MMSOP_CANCEL] & REQ_EN)) /* protocol error if */
|
||||
asn1r_set_dec_err (aCtx, CANRESP_UNSPECIFIED); /* not supported */
|
||||
else
|
||||
{
|
||||
if (asn1r_get_u32 (aCtx, &_mmsdec_rslt->id))
|
||||
asn1r_set_dec_err (aCtx, CANRESP_INVAL_INVOKE);
|
||||
else
|
||||
{
|
||||
_mmsdec_rslt->dec_level = 2; /* Save inv. ID in rslt */
|
||||
(*mms_rsp_decode_fun [MMSOP_CANCEL]) (aCtx);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MMSCANERR : /* Cancel Error PDU */
|
||||
if (!(mmsop_en[MMSOP_CANCEL] & REQ_EN)) /* protocol error if */
|
||||
asn1r_set_dec_err (aCtx, CANERR_INVAL_SERV); /* is not supported */
|
||||
else /* expect context-spec */
|
||||
aCtx->asn1r_c_id_fun = mms_err_invoke_fun;
|
||||
break;
|
||||
|
||||
case MMSINITREQ : /* Initiate Request PDU */
|
||||
if (!(mmsop_en[MMSOP_INITIATE] & RESP_EN)) /* if not enabled */
|
||||
asn1r_set_dec_err (aCtx, REQ_UNREC_SERV); /* as responder */
|
||||
else
|
||||
{
|
||||
#ifndef MMS_LITE
|
||||
mmsdec_assign_rid (MMSOP_INITIATE); /* Assign opcode and */
|
||||
/* reserved Initiate ID */
|
||||
#endif
|
||||
(*mms_req_decode_fun [MMSOP_INITIATE]) (aCtx);
|
||||
}
|
||||
break;
|
||||
|
||||
case MMSINITRESP : /* Initiate Response PDU */
|
||||
if (!(mmsop_en[MMSOP_INITIATE] & REQ_EN)) /* if not enabled */
|
||||
asn1r_set_dec_err (aCtx, RESP_UNREC_SERV); /* as responder */
|
||||
else
|
||||
{
|
||||
#ifndef MMS_LITE
|
||||
mmsdec_assign_rid (MMSOP_INITIATE); /* Assign opcode and */
|
||||
/* reserved Initiate ID */
|
||||
#endif
|
||||
(*mms_rsp_decode_fun [MMSOP_INITIATE]) (aCtx);
|
||||
}
|
||||
break;
|
||||
|
||||
case MMSINITERR : /* Initiate Error PDU */
|
||||
if (!(mmsop_en[MMSOP_INITIATE] & REQ_EN)) /* protocol error if */
|
||||
asn1r_set_dec_err (aCtx, ERR_UNREC_SERV); /* is not supported */
|
||||
else
|
||||
{
|
||||
#ifndef MMS_LITE
|
||||
mmsdec_assign_rid (MMSOP_INITIATE); /* Assign opcode and */
|
||||
/* reserved Initiate ID */
|
||||
#endif
|
||||
mms_err_rsp (aCtx); /* general err function */
|
||||
}
|
||||
break;
|
||||
|
||||
case MMSCNCLREQ : /* Conclude Requset PDU */
|
||||
if (!(mmsop_en[MMSOP_CONCLUDE] & RESP_EN)) /* protocol error if */
|
||||
asn1r_set_dec_err (aCtx, CONREQ_UNSPECIFIED); /* not supported */
|
||||
else
|
||||
{
|
||||
if (aCtx->asn1r_elmnt_len)
|
||||
asn1r_set_dec_err (aCtx, CONREQ_INVAL_ARG);
|
||||
else
|
||||
{
|
||||
#ifndef MMS_LITE
|
||||
mmsdec_assign_rid (MMSOP_CONCLUDE);/* Assign opcode and */
|
||||
/* reserved Conclude ID */
|
||||
#endif
|
||||
(*mms_req_decode_fun [MMSOP_CONCLUDE]) (aCtx);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MMSCNCLRESP : /* Conclude Response PDU */
|
||||
if (!(mmsop_en[MMSOP_CONCLUDE] & REQ_EN)) /* protocol error if */
|
||||
asn1r_set_dec_err (aCtx, CONRESP_UNSPECIFIED); /* not supported */
|
||||
else
|
||||
{
|
||||
if (aCtx->asn1r_elmnt_len)
|
||||
asn1r_set_dec_err (aCtx, CONRESP_INVAL_RSLT); /* if constructor */
|
||||
else
|
||||
{
|
||||
#ifndef MMS_LITE
|
||||
mmsdec_assign_rid (MMSOP_CONCLUDE); /* Assign opcode and */
|
||||
/* reserved Concl ID */
|
||||
#endif
|
||||
(*mms_rsp_decode_fun [MMSOP_CONCLUDE]) (aCtx);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MMSCNCLERR : /* Conclude Error PDU */
|
||||
if (!(mmsop_en[MMSOP_CONCLUDE] & REQ_EN)) /* protocol error if */
|
||||
asn1r_set_dec_err (aCtx, CONERR_INVAL_SERV); /* is not supported */
|
||||
else
|
||||
{
|
||||
#ifndef MMS_LITE
|
||||
mmsdec_assign_rid (MMSOP_CONCLUDE); /* Assign opcode and */
|
||||
/* reserved Conclude ID */
|
||||
#endif
|
||||
mms_err_rsp (aCtx); /* general err function */
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
asn1r_set_dec_err (aCtx, PDU_UNKNOWN_TYPE); /* Not a legal MMS PDU type. */
|
||||
}
|
||||
}
|
||||
else
|
||||
asn1r_set_dec_err (aCtx, PDU_UNKNOWN_TYPE); /* Not a legal MMS PDU type. */
|
||||
} /* or constructor error */
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mmsdec_invoke_id */
|
||||
/* Universal class service function called when invoke ID is expected */
|
||||
/* (after first data element in most MMS confirmed services has been */
|
||||
/* decoded, and this data element is a universal). */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID mmsdec_invoke_id (ASN1_DEC_CTXT *aCtx, ST_UINT16 id_code)
|
||||
{
|
||||
if (aCtx->asn1r_constr_elmnt || id_code != INT_CODE)
|
||||
asn1r_set_dec_err (aCtx, PDU_INVALID); /* not a constr or INTEGER type */
|
||||
else
|
||||
{
|
||||
if (asn1r_get_u32 (aCtx, &_mmsdec_rslt->id))
|
||||
{
|
||||
if (_mmsdec_rslt->type == MMSREQ)
|
||||
asn1r_set_dec_err (aCtx, REQ_BAD_VALUE); /* not a valid 4-byte integer */
|
||||
else
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE); /* not a valid 4-byte integer */
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
MLOG_CDEC1 ("Invoke ID = %lu",_mmsdec_rslt->id);
|
||||
|
||||
_mmsdec_rslt->dec_level = 2; /* set flag that Invoke ID is OK */
|
||||
/* setup function pointers for next */
|
||||
aCtx->asn1r_c_id_fun = mmsdec_opcode; /* next is explicit context tag */
|
||||
#ifdef MOD_SUPPORT
|
||||
if (_mmsdec_rslt->type == MMSREQ)/* if MMSREQ a modifier could be next */
|
||||
aCtx->asn1r_u_id_fun = mmsdec_modlist; /* modifiers are tagged universal */
|
||||
else
|
||||
#endif
|
||||
aCtx->asn1r_u_id_fun = asn1r_class_err; /* no more universals */
|
||||
}
|
||||
|
||||
#ifdef MOD_SUPPORT
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mmsdec_modlist */
|
||||
/* An MMS request has been received with a modifier list present. We */
|
||||
/* change the asn1_decode_method to TAG so _ms_get_mms_modlist can decode it. */
|
||||
/* During the decode the modifier list will be attached to _mmsdec_rslt. */
|
||||
/* Upon completion of the decode we see if we can give back any unused */
|
||||
/* memory and change the decod_method back to CLASS. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID mmsdec_modlist (ASN1_DEC_CTXT *aCtx, ST_UINT16 el_id)
|
||||
{
|
||||
#ifdef MMS_LITE
|
||||
extern ST_CHAR mms_dec_modbuf [];
|
||||
#endif
|
||||
|
||||
aCtx->asn1r_decode_method = ASN1_TAG_METHOD; /* select TAG method for get_mms_modifer*/
|
||||
|
||||
_mmsdec_rslt->mods.num_of_mods = 0;
|
||||
#ifndef MMS_LITE
|
||||
_mmsdec_rslt->mods.mod_list_ptr = (MODIFIER *)
|
||||
chk_calloc (m_max_mods,
|
||||
sizeof (MODIFIER));
|
||||
#else
|
||||
_mmsdec_rslt->mods.mod_list_ptr = (MODIFIER *) mms_dec_modbuf;
|
||||
#endif
|
||||
_ms_get_mms_modlist (aCtx, _mmsdec_rslt->mods.mod_list_ptr,
|
||||
&(_mmsdec_rslt->mods.num_of_mods),
|
||||
m_max_mods,
|
||||
mmsdec_modlist_done_fun);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mmsdec_modlist_done_fun */
|
||||
/* This function is called when the modifier list has been decoded. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID mmsdec_modlist_done_fun (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
aCtx->asn1r_decode_method = ASN1_CLASS_METHOD; /* restore the class method */
|
||||
_mmsdec_rslt->mods.info_pres = SD_TRUE;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mmsdec_opcode */
|
||||
/* An MMS request with good invoke ID has been detected. Next field */
|
||||
/* should be an implicit context tag which represents the opcode. */
|
||||
/* This function is called if a context class is decoded. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID mmsdec_opcode (ASN1_DEC_CTXT *aCtx, ST_UINT16 id_code)
|
||||
{
|
||||
ST_INT operr;
|
||||
|
||||
#ifndef MMS_LITE
|
||||
if (id_code > MAX_MMS_OPCODE)
|
||||
{ /* Must be a legal MMS opcode */
|
||||
if (_mmsdec_rslt->type == MMSREQ)
|
||||
asn1r_set_dec_err (aCtx, REQ_UNREC_SERV);
|
||||
else
|
||||
asn1r_set_dec_err (aCtx, RESP_UNREC_SERV);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
_mmsdec_rslt->dec_level = 3; /* set flag that opcode is read OK */
|
||||
_mmsdec_rslt->op = id_code; /* save the opcode for the user */
|
||||
|
||||
MLOG_CDEC1 ("MMS Opcode = %d",_mmsdec_rslt->op);
|
||||
|
||||
/* Opcode has been saved. Check that the service corresponding to this */
|
||||
/* opcode is supported and there are no parse errors. */
|
||||
|
||||
if (_mmsdec_rslt->type == MMSREQ)
|
||||
{
|
||||
/* pass err code */
|
||||
operr = mmsdec_chk_req_op (aCtx, _mmsdec_rslt->op,REQ_UNREC_SERV);
|
||||
if (!operr)
|
||||
(*mms_req_decode_fun [_mmsdec_rslt->op]) (aCtx);
|
||||
}
|
||||
else
|
||||
{
|
||||
operr = mmsdec_chk_resp_op (aCtx, _mmsdec_rslt->op);
|
||||
if (!operr)
|
||||
(*mms_rsp_decode_fun [_mmsdec_rslt->op]) (aCtx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mmsdec_ucreq_opcode */
|
||||
/* An MMS unconfirmed request has been detected. Next field should be */
|
||||
/* an implicit context tag which represents the opcode. This function */
|
||||
/* is called if a context class is decoded. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID mmsdec_ucreq_opcode (ASN1_DEC_CTXT *aCtx, ST_UINT16 id_code)
|
||||
{
|
||||
if (id_code == 0)
|
||||
_mmsdec_rslt->op = MMSOP_INFO_RPT;
|
||||
else if (id_code == 1)
|
||||
_mmsdec_rslt->op = MMSOP_USTATUS;
|
||||
else if (id_code == 2)
|
||||
_mmsdec_rslt->op = MMSOP_EVENT_NOT;
|
||||
else
|
||||
{ /* Must be a legal MMS opcode */
|
||||
asn1r_set_dec_err (aCtx, PDU_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
MLOG_CDEC1 ("Unconfirmed request opcode = %d",_mmsdec_rslt->op);
|
||||
|
||||
_mmsdec_rslt->dec_level = 3; /* set flag that opcode is read OK */
|
||||
_mmsdec_rslt->id = UNREQ_INVOKE;
|
||||
|
||||
/* Opcode has been saved. Check that the service corresponding to this */
|
||||
/* opcode is supported and there are no parse errors. */
|
||||
|
||||
if (!mmsdec_chk_req_op (aCtx, _mmsdec_rslt->op,UNCONF_UNREC_SERV))
|
||||
(*mms_req_decode_fun [_mmsdec_rslt->op]) (aCtx); /* continue decode */
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* mmsdec_chk_req_op */
|
||||
/* mmsdec_chk_resp_op */
|
||||
/* This function checks whether the given opcode is supported as */
|
||||
/* request or response (or both), if the data element containing the */
|
||||
/* opcode is of the proper form (either primitive or constructor), */
|
||||
/* and if it is a NULL when it is supposed to be. The mmsop_en table */
|
||||
/* contains the opcode support information. */
|
||||
/* Returns 0 for success, else non-zero error code */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_RET mmsdec_chk_req_op (ASN1_DEC_CTXT *aCtx, ST_INT opcode, ST_INT unsupp_code)
|
||||
{
|
||||
ST_UCHAR op_en;
|
||||
|
||||
/* First check that opcode range, then whether it is enabled */
|
||||
|
||||
if ((opcode > MAX_MMSOP_DIS) || ! ((op_en = mmsop_en[opcode]) & RESP_EN))
|
||||
{
|
||||
if (opcode <= MAX_MMSOP_DIS)
|
||||
{
|
||||
MLOG_NERR1 ("MMS service %s not supported as server (cannot decode request)",
|
||||
mms_op_string[opcode]);
|
||||
}
|
||||
else
|
||||
{
|
||||
MLOG_NERR1 ("MMS service opcode %d out of range", opcode);
|
||||
}
|
||||
asn1r_set_dec_err (aCtx, unsupp_code); /* req not supported */
|
||||
return (MVE_REQ_NOT_SUPP);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((aCtx->asn1r_constr_elmnt && !(op_en & 0x04)) ||
|
||||
(!aCtx->asn1r_constr_elmnt && (op_en & 0x04)) ||
|
||||
(aCtx->asn1r_elmnt_len > 0 && (op_en & 0x10)))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, PDU_INVALID);
|
||||
return (MVE_INVALID_PDU);
|
||||
}
|
||||
return (SD_SUCCESS); /* return success code */
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
static ST_RET mmsdec_chk_resp_op (ASN1_DEC_CTXT *aCtx, ST_UINT opcode)
|
||||
{
|
||||
ST_UCHAR op_en;
|
||||
|
||||
/* First check that opcode range, then whether it is enabled */
|
||||
|
||||
if ((opcode > MAX_MMSOP_DIS) || ! ((op_en = mmsop_en[opcode]) & REQ_EN))
|
||||
{
|
||||
if (opcode <= MAX_MMSOP_DIS)
|
||||
{
|
||||
MLOG_NERR1 ("MMS service %s not supported as client (cannot decode response)",
|
||||
mms_op_string[opcode]);
|
||||
}
|
||||
else
|
||||
{
|
||||
MLOG_NERR1 ("MMS service opcode %d out of range", opcode);
|
||||
}
|
||||
|
||||
asn1r_set_dec_err (aCtx, RESP_UNREC_SERV); /* resp not supported */
|
||||
return (MVE_RESP_NOT_SUPP);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (opcode == MMSOP_INIT_DOWNLOAD)
|
||||
{
|
||||
#ifndef MMS_LITE
|
||||
if (mms_chan_info[_mmsdechan].version) /* IS */
|
||||
#else
|
||||
if (mmsl_version) /* IS */
|
||||
#endif
|
||||
{
|
||||
if (aCtx->asn1r_constr_elmnt || aCtx->asn1r_elmnt_len)
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, PDU_INVALID);
|
||||
return (MVE_INVALID_PDU);
|
||||
}
|
||||
}
|
||||
else /* DIS */
|
||||
{
|
||||
if (!aCtx->asn1r_constr_elmnt || !aCtx->asn1r_elmnt_len)
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, PDU_INVALID);
|
||||
return (MVE_INVALID_PDU);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((aCtx->asn1r_constr_elmnt && !(op_en & 0x08)) ||
|
||||
(!aCtx->asn1r_constr_elmnt && (op_en & 0x08)) ||
|
||||
(aCtx->asn1r_elmnt_len > 0 && (op_en & 0x20)))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, PDU_INVALID);
|
||||
return (MVE_INVALID_PDU);
|
||||
}
|
||||
}
|
||||
|
||||
return (SD_SUCCESS); /* return success code */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* mmsdec_map_err */
|
||||
/* Function to map the error codes supplied by the generic ASN.1 tools */
|
||||
/* to the MMS error codes specified for the Reject service. Inputs are */
|
||||
/* the global variables: */
|
||||
/* ST_UINT16 aCtx->asn1r_pdu_dec_err; */
|
||||
/* MMSDEC_INFO *_mmsdec_rslt; */
|
||||
/* */
|
||||
/* (A aCtx->asn1r_pdu_dec_err value of 0 should not occur and maps to UNSPECIFIED.) */
|
||||
/************************************************************************/
|
||||
static ST_VOID mmsdec_map_err (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT level;
|
||||
|
||||
level = 0;
|
||||
|
||||
/* asn1_pdu_dec_err codes of NO_DECODE_ERR are OK, and codes of > 15 have been */
|
||||
/* set by the MMS decode logic and so are OK. 15 is a special number */
|
||||
/* because the lowest reject code is a 0x10(REQ_UNSPECIFIED) */
|
||||
|
||||
if (aCtx->asn1r_pdu_dec_err == NO_DECODE_ERR || aCtx->asn1r_pdu_dec_err >= REQ_UNSPECIFIED)
|
||||
{
|
||||
_mmsdec_rslt->err_code = aCtx->asn1r_pdu_dec_err;
|
||||
}
|
||||
|
||||
/* We started to decode some type of PDU and it wasn't valid. Here we */
|
||||
/* try to determine how much of the PDU we parsed and generate a */
|
||||
/* pertainent error code */
|
||||
|
||||
else
|
||||
{
|
||||
level = _mmsdec_rslt -> dec_level;
|
||||
if (level == 0) /* did we determine it's type ? */
|
||||
_mmsdec_rslt->err_code = PDU_INVALID;
|
||||
else /* if we knew it's type we */
|
||||
{ /* switch to figure out more */
|
||||
switch (_mmsdec_rslt->type)
|
||||
{
|
||||
|
||||
/* About the only time we get here and have to do this is when the MMS */
|
||||
/* decoder temporarily turned the decode over the the ASN.1 tools (via */
|
||||
/* parse_next, parse_cstr_contents, etc) and an error was discovered. */
|
||||
/* The error the ASN.1 tools will report is <= 15. Some, most or all */
|
||||
/* of the PDU was decoded. It's not fair to just say we couldn't tell */
|
||||
/* anything at all about the PDU. */
|
||||
/* These are the rules for determining what reject class and code get */
|
||||
/* returned for the rejected PDU. The protocol for the begining of */
|
||||
/* each MMSpdu is different so almost each type has to dealt with on an */
|
||||
/* individual basis. */
|
||||
|
||||
case MMSREQ : /* request for most confirmed services */
|
||||
if (level >= 2)
|
||||
_mmsdec_rslt->err_code = REQ_INVAL_ARG;
|
||||
else
|
||||
_mmsdec_rslt->err_code = REQ_UNSPECIFIED;
|
||||
break;
|
||||
|
||||
case MMSRESP : /* response for most confirmed services */
|
||||
if (level >= 2)
|
||||
_mmsdec_rslt->err_code = RESP_INVAL_RSLT;
|
||||
else
|
||||
_mmsdec_rslt->err_code = RESP_UNSPECIFIED;
|
||||
break;
|
||||
|
||||
case MMSERROR : /* error for most confirmed services */
|
||||
_mmsdec_rslt->err_code = ERR_UNSPECIFIED;
|
||||
break;
|
||||
|
||||
case MMSUNREQ : /* request for unconfirmed services */
|
||||
_mmsdec_rslt->err_code = UNCONF_UNSPECIFIED;
|
||||
break;
|
||||
|
||||
case MMSREJECT : /* reject */
|
||||
_mmsdec_rslt->err_code = PDU_UNKNOWN_TYPE;
|
||||
break;
|
||||
|
||||
case MMSCANREQ : /* request for the Cancel service */
|
||||
_mmsdec_rslt->err_code = CANREQ_UNSPECIFIED;
|
||||
break;
|
||||
|
||||
case MMSCANRESP : /* response for the Cancel service */
|
||||
_mmsdec_rslt->err_code = CANRESP_UNSPECIFIED;
|
||||
break;
|
||||
|
||||
case MMSCANERR : /* error for Cancel service */
|
||||
_mmsdec_rslt->err_code = CANERR_UNSPECIFIED;
|
||||
break;
|
||||
|
||||
case MMSINITREQ : /* request for Initiate service */
|
||||
_mmsdec_rslt->err_code = REQ_BAD_VALUE;
|
||||
break;
|
||||
|
||||
case MMSINITRESP : /* response for Initiate service */
|
||||
_mmsdec_rslt->err_code = RESP_BAD_VALUE;
|
||||
break;
|
||||
|
||||
case MMSINITERR : /* error for Initiate service */
|
||||
_mmsdec_rslt->err_code = ERR_BAD_VALUE;
|
||||
break;
|
||||
|
||||
case MMSCNCLREQ : /* request for Conclude service */
|
||||
_mmsdec_rslt->err_code = CONREQ_UNSPECIFIED;
|
||||
break;
|
||||
|
||||
case MMSCNCLRESP : /* response for Conclude service */
|
||||
_mmsdec_rslt->err_code = CONRESP_UNSPECIFIED;
|
||||
break;
|
||||
|
||||
case MMSCNCLERR : /* error for Conclude service */
|
||||
_mmsdec_rslt->err_code = CONERR_UNSPECIFIED;
|
||||
break;
|
||||
|
||||
default:
|
||||
_mmsdec_rslt->err_code = PDU_INVALID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* mmsdec_assign_rid */
|
||||
/* Assign a reserved invoke ID for the given service on this channel */
|
||||
/* and store it in the _mmsdec_rslt structure. Also, set the opcode for */
|
||||
/* the specified service, which must be either Initiate or Conclude */
|
||||
/* (or their error responses). */
|
||||
/************************************************************************/
|
||||
|
||||
#ifndef MMS_LITE
|
||||
|
||||
static ST_VOID mmsdec_assign_rid (ST_INT opcode)
|
||||
{
|
||||
/* assign reserved invoke id */
|
||||
if (opcode == MMSOP_INITIATE)
|
||||
_mmsdec_rslt->id = INIT_INVOKE_ID + _mmsdechan; /* for Initiate */
|
||||
else
|
||||
_mmsdec_rslt->id = CONCL_INVOKE_ID + _mmsdechan; /* for Conclude */
|
||||
|
||||
_mmsdec_rslt->op = opcode; /* save the opcode */
|
||||
_mmsdec_rslt->dec_level = 3; /* opcode & invoke ID are valid */
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _m_get_dec_buf */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID *_m_get_dec_buf (ASN1_DEC_CTXT *aCtx, ST_UINT size)
|
||||
{
|
||||
_mms_dec_info = (*m_calloc_os_fun)(1, size);
|
||||
aCtx->asn1r_err_fun = _mms_dec_buf_free;
|
||||
_mms_dec_info_pres = SD_TRUE;
|
||||
aCtx->asn1r_decode_method = ASN1_TAG_METHOD; /* select TAG method for get_mms_modifer*/
|
||||
return (_mms_dec_info);
|
||||
}
|
||||
729
mmslib/mmsl/mmsdtext.c
Normal file
729
mmslib/mmsl/mmsdtext.c
Normal file
@@ -0,0 +1,729 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 2004-2004 All Rights Reserved */
|
||||
/* */
|
||||
/* MODULE NAME : mmsdtext.c */
|
||||
/* PRODUCT(S) : MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* Functions to convert local data to text. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* ms_local_to_text */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 05/13/08 JRB 04 Fix fraction & add qflags in LocToTextUtc. */
|
||||
/* 09/01/04 JRB 03 Add mmsdefs.h, mms_vvar.h (don't know how */
|
||||
/* it compiled before without them). */
|
||||
/* 08/06/04 JRB 02 Cast 1-st arg in call to LocToTextUtf8. */
|
||||
/* 01/23/04 JRB 01 New. Possible replacement for sxaLocalToText.*/
|
||||
/************************************************************************/
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
#include "time.h"
|
||||
#include "time_str.h"
|
||||
#include "mem_chk.h"
|
||||
#include "mms_log.h"
|
||||
#include "mmslog.h"
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_vvar.h" /* need RUNTIME_TYPE */
|
||||
|
||||
/************************************************************************/
|
||||
/* For debug version, use a static pointer to avoid duplication of */
|
||||
/* __FILE__ strings. */
|
||||
|
||||
#ifdef DEBUG_SISCO
|
||||
SD_CONST static ST_CHAR *SD_CONST thisFileName = __FILE__;
|
||||
#endif
|
||||
|
||||
#define TEMP_DATA_BUF_SIZE (100*1024)
|
||||
#define DATA_SEPARATOR '\n' /* newline */
|
||||
|
||||
/************************************************************************/
|
||||
/* AddString */
|
||||
/* Copy "Src" string to end of the "Dst" string. */
|
||||
/************************************************************************/
|
||||
static ST_RET AddString (ST_CHAR *Src, ST_CHAR *Dst, ST_UINT DstSize, ST_UINT *pDstLen)
|
||||
{
|
||||
ST_UINT tmpDstLen = *pDstLen;
|
||||
/* Watch out for overrun */
|
||||
if ((tmpDstLen + strlen (Src) + 1) > DstSize)
|
||||
{
|
||||
MLOG_NERR0 ("Local->Text buffer overrun");
|
||||
return (SD_FAILURE);
|
||||
}
|
||||
|
||||
/* Add separator after each string. Later strip off last separator. */
|
||||
strcpy (&Dst[tmpDstLen],Src);
|
||||
tmpDstLen += strlen (Src);
|
||||
Dst[tmpDstLen++] = DATA_SEPARATOR;
|
||||
*pDstLen = tmpDstLen; /* update caller's buf len */
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
/************************************************************************/
|
||||
/* LocToTextInt8 () */
|
||||
/************************************************************************/
|
||||
static ST_RET LocToTextInt8 (ST_INT8 *pSrc, RUNTIME_TYPE *rt, ST_CHAR *text)
|
||||
{
|
||||
sprintf (text,"%d", (int) *pSrc);
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
/************************************************************************/
|
||||
/* LocToTextInt16 () */
|
||||
/************************************************************************/
|
||||
static ST_RET LocToTextInt16 (ST_INT16 *pSrc, RUNTIME_TYPE *rt, ST_CHAR *text)
|
||||
{
|
||||
sprintf (text,"%d",(int) *pSrc);
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
/************************************************************************/
|
||||
/* LocToTextInt32 () */
|
||||
/************************************************************************/
|
||||
static ST_RET LocToTextInt32 (ST_INT32 *pSrc, RUNTIME_TYPE *rt, ST_CHAR *text)
|
||||
{
|
||||
sprintf (text,"%ld",*pSrc);
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
/************************************************************************/
|
||||
/* LocToTextInt64 () */
|
||||
/************************************************************************/
|
||||
#if defined(INT64_SUPPORT)
|
||||
static ST_RET LocToTextInt64 (ST_INT64 *pSrc, RUNTIME_TYPE *rt, ST_CHAR *text)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
sprintf (text,"%I64d",*pSrc);
|
||||
#elif defined(_AIX) || defined(__hpux) || defined(linux) || defined(sun) || defined(__LYNX)
|
||||
sprintf (text,"%lld",*pSrc);
|
||||
#elif (defined(__alpha) && !defined(__VMS))
|
||||
sprintf (text,"%ld",*pSrc);
|
||||
#else
|
||||
#error Missing INT64 code for this platform.
|
||||
#endif
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
#endif
|
||||
/************************************************************************/
|
||||
/* LocToTextUint8 () */
|
||||
/************************************************************************/
|
||||
static ST_RET LocToTextUint8 (ST_UINT8 *pSrc, RUNTIME_TYPE *rt, ST_CHAR *text)
|
||||
{
|
||||
sprintf (text,"%u",(unsigned) *pSrc);
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
/************************************************************************/
|
||||
/* LocToTextUint16 () */
|
||||
/************************************************************************/
|
||||
static ST_RET LocToTextUint16 (ST_UINT16 *pSrc, RUNTIME_TYPE *rt, ST_CHAR *text)
|
||||
{
|
||||
sprintf (text,"%u",(unsigned) *pSrc);
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
/************************************************************************/
|
||||
/* LocToTextUint32 () */
|
||||
/************************************************************************/
|
||||
static ST_RET LocToTextUint32 (ST_UINT32 *pSrc, RUNTIME_TYPE *rt, ST_CHAR *text)
|
||||
{
|
||||
sprintf (text,"%lu",(unsigned long) *pSrc);
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
/************************************************************************/
|
||||
/* LocToTextUint64 () */
|
||||
/************************************************************************/
|
||||
#if defined(INT64_SUPPORT)
|
||||
static ST_RET LocToTextUint64 (ST_UINT64 *pSrc, RUNTIME_TYPE *rt, ST_CHAR *text)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
sprintf (text,"%I64u", *pSrc);
|
||||
#elif defined(_AIX) || defined(__hpux) || defined(linux) || defined(sun) || defined(__LYNX)
|
||||
sprintf (text,"%llu", *pSrc);
|
||||
#elif (defined(__alpha) && !defined(__VMS))
|
||||
sprintf (text,"%lu", *pSrc);
|
||||
#else
|
||||
#error Missing INT64 code for this platform.
|
||||
#endif
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
#endif
|
||||
/************************************************************************/
|
||||
/* LocToTextBcd1 () */
|
||||
/************************************************************************/
|
||||
static ST_RET LocToTextBcd1 (ST_INT8 *pSrc, RUNTIME_TYPE *rt, ST_CHAR *text)
|
||||
{
|
||||
sprintf (text,"%d", (int) *pSrc);
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
/************************************************************************/
|
||||
/* LocToTextBcd2 () */
|
||||
/************************************************************************/
|
||||
static ST_RET LocToTextBcd2 (ST_INT16 *pSrc, RUNTIME_TYPE *rt, ST_CHAR *text)
|
||||
{
|
||||
sprintf (text,"%d",(int) *pSrc);
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
/************************************************************************/
|
||||
/* LocToTextBcd4 () */
|
||||
/************************************************************************/
|
||||
static ST_RET LocToTextBcd4 (ST_INT32 *pSrc, RUNTIME_TYPE *rt, ST_CHAR *text)
|
||||
{
|
||||
sprintf (text,"%ld",*pSrc);
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
/************************************************************************/
|
||||
/* LocToTextBool () */
|
||||
/************************************************************************/
|
||||
static ST_RET LocToTextBool (ST_BOOLEAN *pSrc, RUNTIME_TYPE *rt, ST_CHAR *text)
|
||||
{
|
||||
sprintf (text,"%u",(unsigned) *pSrc);
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
/************************************************************************/
|
||||
/* LocToTextFlt () */
|
||||
/************************************************************************/
|
||||
static ST_RET LocToTextFlt (ST_FLOAT *pSrc, RUNTIME_TYPE *rt, ST_CHAR *text)
|
||||
{
|
||||
#if defined(_WIN32) || defined(__QNX__)
|
||||
/* 7 significant digits */
|
||||
/*gcvt((ST_DOUBLE) *pSrc, 7, text);*/
|
||||
sprintf (text, "%.4f", (ST_DOUBLE) (*pSrc));
|
||||
#else
|
||||
sprintf (text, "%.7g", (ST_DOUBLE) (*pSrc));
|
||||
#endif
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
/************************************************************************/
|
||||
/* LocToTextDbl () */
|
||||
/************************************************************************/
|
||||
static ST_RET LocToTextDbl (ST_DOUBLE *pSrc, RUNTIME_TYPE *rt, ST_CHAR *text)
|
||||
{
|
||||
#if defined(_WIN32) || defined(__QNX__)
|
||||
/* 16 significant digits */
|
||||
gcvt(*pSrc, 16, text);
|
||||
#else
|
||||
sprintf (text, "%.16g", *pSrc);
|
||||
#endif
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
/************************************************************************/
|
||||
/* LocToTextOct */
|
||||
/************************************************************************/
|
||||
static ST_RET LocToTextOct (ST_UCHAR *pSrc, RUNTIME_TYPE *rt, ST_CHAR *text)
|
||||
{
|
||||
int i, k;
|
||||
int numBytes;
|
||||
ST_INT16 *sp;
|
||||
ST_CHAR *destBuf;
|
||||
|
||||
text[0] = 0;
|
||||
numBytes = rt->u.p.el_len;
|
||||
|
||||
if (numBytes < 0) /* a variable length octet string */
|
||||
{
|
||||
sp = (ST_INT16 *) pSrc;
|
||||
numBytes = *sp;
|
||||
k=2;
|
||||
}
|
||||
else
|
||||
k=0;
|
||||
|
||||
/* We take 3 bytes per octet, make sure it fits */
|
||||
if (numBytes > TEMP_DATA_BUF_SIZE/3)
|
||||
{
|
||||
MLOG_NERR1 ("Octet String (%d bytes) too long to encode", numBytes);
|
||||
return SD_FAILURE;
|
||||
}
|
||||
|
||||
destBuf = text;
|
||||
for (i = 0; i < numBytes; ++i, ++k)
|
||||
{
|
||||
sprintf (destBuf, "%02x ", (unsigned int) pSrc[k]);
|
||||
destBuf += 3;
|
||||
}
|
||||
|
||||
/* Eliminate the trailing space */
|
||||
*(destBuf - 1) = 0;
|
||||
#ifdef WIN32 //renxiaobao mod
|
||||
if(text[0]==0) strcpy(destBuf,"0");
|
||||
#endif
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
/************************************************************************/
|
||||
/* LocToTextBs */
|
||||
/************************************************************************/
|
||||
static ST_RET LocToTextBs (ST_UCHAR *pSrc, RUNTIME_TYPE *rt, ST_CHAR *text)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
int k;
|
||||
int numBits;
|
||||
ST_INT16 *sp;
|
||||
ST_CHAR *destBuf;
|
||||
ST_UCHAR mask;
|
||||
|
||||
text[0] = 0;
|
||||
numBits = rt->u.p.el_len;
|
||||
|
||||
/* We take 1 dest byte per bit, make sure it fits */
|
||||
if (numBits > TEMP_DATA_BUF_SIZE-1)
|
||||
{
|
||||
MLOG_NERR1 ("Bit String (%d bits) too long to encode", numBits);
|
||||
return (SD_FAILURE);
|
||||
}
|
||||
|
||||
if (numBits < 0) /* a variable length bit string */
|
||||
{
|
||||
sp = (ST_INT16 *) pSrc;
|
||||
numBits = *sp;
|
||||
k=2;
|
||||
}
|
||||
else
|
||||
k=0;
|
||||
|
||||
destBuf = text;
|
||||
for (i = 0; i < numBits; ++k) /* for each byte, while bits remain */
|
||||
{
|
||||
mask = 0x80;
|
||||
for (j = 0; j < 8 && i < numBits; ++i, ++j)
|
||||
{
|
||||
if (pSrc[k] & mask)
|
||||
destBuf[i] = '1';
|
||||
else
|
||||
destBuf[i] = '0';
|
||||
mask >>= 1;
|
||||
}
|
||||
}
|
||||
destBuf[i] = 0;
|
||||
#ifdef WIN32 //renxiaobao mod
|
||||
if(text[0]==0) strcpy(destBuf,"0");
|
||||
#endif
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
/************************************************************************/
|
||||
/* LocToTextBtime4 */
|
||||
/************************************************************************/
|
||||
static ST_RET LocToTextBtime4 (ST_INT32 *pSrc, RUNTIME_TYPE *rt, ST_CHAR *text)
|
||||
{
|
||||
if (Btime4ValsToString (text, *pSrc))
|
||||
{
|
||||
MLOG_NERR0 ("Btime4 String conversion error.");
|
||||
return (SD_FAILURE);
|
||||
}
|
||||
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
/************************************************************************/
|
||||
/* LocToTextBtime6 */
|
||||
/************************************************************************/
|
||||
static ST_RET LocToTextBtime6 (ST_INT32 *pSrc, RUNTIME_TYPE *rt, ST_CHAR *text)
|
||||
{
|
||||
ST_INT32 *pDays, *pMsec;
|
||||
|
||||
pMsec = pSrc;
|
||||
pDays = (pSrc+1);
|
||||
if (Btime6ValsToString (text, *pDays, *pMsec))
|
||||
{
|
||||
MLOG_NERR0 ("Btime6 String conversion error.");
|
||||
return (SD_FAILURE);
|
||||
}
|
||||
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
/************************************************************************/
|
||||
/* LocToTextGtime */
|
||||
/************************************************************************/
|
||||
static ST_RET LocToTextGtime (time_t *pSrc, RUNTIME_TYPE *rt, ST_CHAR *text)
|
||||
{
|
||||
if (tstrTimeToString (*pSrc, text))
|
||||
{
|
||||
MLOG_NERR0 ("Time to String conversion error");
|
||||
return (SD_FAILURE);
|
||||
}
|
||||
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
/************************************************************************/
|
||||
/* LocToTextUtc */
|
||||
/************************************************************************/
|
||||
#ifdef WIN32
|
||||
//void printf_utctime(char *buf,void *utctime);//lnk<6E><6B><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>ԭǰ<D4AD>ó<EFBFBD><C3B3><EFBFBD>δʹ<CEB4><CAB9>
|
||||
#endif
|
||||
static ST_RET LocToTextUtc (MMS_UTC_TIME *pSrc, RUNTIME_TYPE *rt, ST_CHAR *text)
|
||||
{
|
||||
#ifdef WIN32
|
||||
char tmpbuf[128];
|
||||
//printf_utctime(text,pSrc);
|
||||
strcpy(text, "");//lnk<6E><6B><EFBFBD><EFBFBD><EFBFBD>ģ<DEB8>ԭǰ<D4AD>ó<EFBFBD><C3B3><EFBFBD>δʹ<CEB4><CAB9>
|
||||
/* sprintf (tmpbuf," %02x",pSrc->qflags);*/ /*renxiaobao ʱ<><CAB1>Ʒ<EFBFBD><C6B7>*/
|
||||
/* strcat(text,tmpbuf);*/
|
||||
#else
|
||||
sprintf (text,"UTC TIME seconds=%lu, fraction=%lu, qflags=%lu",
|
||||
pSrc->secs, pSrc->fraction, pSrc->qflags);
|
||||
#endif
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
/************************************************************************/
|
||||
/* LocToTextUtf8 */
|
||||
/************************************************************************/
|
||||
#ifdef WIN32
|
||||
//void utf8_convert_gb2312(char *pOut, char *pText, int pLen); //lnk<6E><6B><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>ԭǰ<D4AD>ó<EFBFBD><C3B3><EFBFBD>δʹ<CEB4><CAB9>
|
||||
#endif
|
||||
static ST_RET LocToTextUtf8 (ST_UCHAR *pSrc, RUNTIME_TYPE *rt, ST_CHAR *text)
|
||||
{
|
||||
#ifdef WIN32
|
||||
int len =strlen((char *)pSrc);
|
||||
//if(len) utf8_convert_gb2312(text,(char *)pSrc,len);//lnk<6E><6B><EFBFBD><EFBFBD><EFBFBD>ģ<DEB8>ԭǰ<D4AD>ó<EFBFBD><C3B3><EFBFBD>δʹ<CEB4><CAB9>
|
||||
if (len) {
|
||||
memcpy(text, pSrc, len);
|
||||
text[len] = 0;
|
||||
}
|
||||
else strcpy(text," ");
|
||||
return (SD_SUCCESS);
|
||||
#endif
|
||||
sprintf (text,"UTF8string: can't display");
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* ms_local_to_text */
|
||||
/* NOTE: tmpBuf is passed to most "LocToText.." static functions. These */
|
||||
/* functions must NOT write past end of tmpBuf. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_CHAR *ms_local_to_text (ST_CHAR *datptr, SD_CONST RUNTIME_TYPE *rt_head, ST_INT rt_num,
|
||||
ST_CHAR *textBuf, ST_UINT textBufSize)
|
||||
{
|
||||
RUNTIME_TYPE *rt_ptr;
|
||||
RUNTIME_TYPE *rt_end;
|
||||
ST_RET uDataRet;
|
||||
ST_INT arr_loop_level,total_len;
|
||||
ST_INT arr_loops[ASN1_MAX_LEVEL];
|
||||
ST_CHAR *ret_ptr;
|
||||
static ST_CHAR tmpBuf[TEMP_DATA_BUF_SIZE];
|
||||
ST_UINT nStrLen = 0; /* Current text total length */
|
||||
|
||||
|
||||
tmpBuf[0] = 0;/*renxiaobao add*/
|
||||
|
||||
nStrLen = 0;
|
||||
|
||||
arr_loop_level = 0;
|
||||
|
||||
rt_ptr = (RUNTIME_TYPE *) rt_head; /* point to head rt_block */
|
||||
rt_end = rt_ptr + rt_num; /* done when pointer is here */
|
||||
|
||||
uDataRet = SD_SUCCESS;
|
||||
while (rt_ptr < rt_end && uDataRet == SD_SUCCESS)
|
||||
{
|
||||
if (rt_ptr->el_tag == RT_ARR_END) /* treat case of array ending */
|
||||
{
|
||||
if (--arr_loops[arr_loop_level] > 0) /* if need to do next ar elmnt */
|
||||
rt_ptr -= rt_ptr->u.arr.num_rt_blks; /* mv rt_ptr to start of arr */
|
||||
else
|
||||
--arr_loop_level;
|
||||
}
|
||||
if (rt_ptr->el_tag == RT_ARR_START) /* treat case of array starting */
|
||||
{
|
||||
/* initialize the loop counter for the array */
|
||||
++arr_loop_level;
|
||||
arr_loops[arr_loop_level] = rt_ptr->u.arr.num_elmnts;
|
||||
}
|
||||
|
||||
switch (rt_ptr->el_tag)
|
||||
{
|
||||
case RT_ARR_START :
|
||||
break; /* do nothing */
|
||||
|
||||
case RT_ARR_END : /* array done */
|
||||
break; /* do nothing */
|
||||
|
||||
case RT_STR_START :
|
||||
uDataRet = AddString ("{", textBuf, textBufSize, &nStrLen);
|
||||
break;
|
||||
|
||||
case RT_STR_END : /* structure done */
|
||||
uDataRet = AddString ("}", textBuf, textBufSize, &nStrLen);
|
||||
break;
|
||||
|
||||
case RT_BOOL :
|
||||
uDataRet = LocToTextBool ((ST_BOOLEAN *) datptr, rt_ptr, tmpBuf);
|
||||
if (uDataRet==SD_SUCCESS) /* If converted OK, add to working text*/
|
||||
uDataRet = AddString (tmpBuf, textBuf, textBufSize, &nStrLen);
|
||||
break;
|
||||
|
||||
case RT_BIT_STRING :
|
||||
uDataRet = LocToTextBs ((ST_UCHAR *) datptr, rt_ptr, tmpBuf);
|
||||
if (uDataRet==SD_SUCCESS) /* If converted OK, add to working text*/
|
||||
uDataRet = AddString (tmpBuf, textBuf, textBufSize, &nStrLen);
|
||||
break;
|
||||
|
||||
case RT_INTEGER :
|
||||
switch (rt_ptr->u.p.el_len) /* determine length */
|
||||
{
|
||||
case 1 : /* one byte int */
|
||||
uDataRet = LocToTextInt8 ((ST_INT8 *) datptr, rt_ptr, tmpBuf);
|
||||
break;
|
||||
|
||||
case 2 : /* two byte int */
|
||||
uDataRet = LocToTextInt16 ((ST_INT16 *) datptr, rt_ptr, tmpBuf);
|
||||
break;
|
||||
|
||||
case 4 : /* four byte integer */
|
||||
uDataRet = LocToTextInt32 ((ST_INT32 *) datptr, rt_ptr, tmpBuf);
|
||||
break;
|
||||
|
||||
#ifdef INT64_SUPPORT
|
||||
case 8 : /* eight byte integer */
|
||||
uDataRet = LocToTextInt64 ((ST_INT64 *) datptr, rt_ptr, tmpBuf);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
uDataRet = SD_FAILURE;
|
||||
break;
|
||||
}
|
||||
if (uDataRet==SD_SUCCESS) /* If converted OK, add to working text*/
|
||||
uDataRet = AddString (tmpBuf, textBuf, textBufSize, &nStrLen);
|
||||
break;
|
||||
|
||||
case RT_UNSIGNED :
|
||||
switch (rt_ptr->u.p.el_len) /* determine length */
|
||||
{
|
||||
case 1 : /* one byte int */
|
||||
uDataRet = LocToTextUint8 ((ST_UCHAR *) datptr, rt_ptr, tmpBuf);
|
||||
break;
|
||||
|
||||
case 2 : /* two byte int */
|
||||
uDataRet = LocToTextUint16 ((ST_UINT16 *) datptr, rt_ptr, tmpBuf);
|
||||
break;
|
||||
|
||||
case 4 : /* four byte integer */
|
||||
uDataRet = LocToTextUint32 ((ST_UINT32 *) datptr, rt_ptr, tmpBuf);
|
||||
break;
|
||||
|
||||
#ifdef INT64_SUPPORT
|
||||
case 8 : /* eight byte integer */
|
||||
uDataRet = LocToTextUint64 ((ST_UINT64 *) datptr, rt_ptr, tmpBuf);
|
||||
break;
|
||||
#endif /* INT64_SUPPORT */
|
||||
default:
|
||||
uDataRet = SD_FAILURE;
|
||||
break;
|
||||
}
|
||||
if (uDataRet==SD_SUCCESS) /* If converted OK, add to working text*/
|
||||
uDataRet = AddString (tmpBuf, textBuf, textBufSize, &nStrLen);
|
||||
break;
|
||||
|
||||
#ifdef FLOAT_DATA_SUPPORT
|
||||
case RT_FLOATING_POINT :
|
||||
if (rt_ptr->u.p.el_len != sizeof (ST_FLOAT))
|
||||
uDataRet = LocToTextDbl ((ST_DOUBLE *) datptr, rt_ptr, tmpBuf);
|
||||
else
|
||||
uDataRet = LocToTextFlt ((ST_FLOAT *) datptr, rt_ptr, tmpBuf);
|
||||
if (uDataRet==SD_SUCCESS) /* If converted OK, add to working text*/
|
||||
uDataRet = AddString (tmpBuf, textBuf, textBufSize, &nStrLen);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case RT_OCTET_STRING :
|
||||
uDataRet = LocToTextOct ((ST_UCHAR *) datptr, rt_ptr, tmpBuf);
|
||||
if (uDataRet==SD_SUCCESS) /* If converted OK, add to working text*/
|
||||
uDataRet = AddString (tmpBuf, textBuf, textBufSize, &nStrLen);
|
||||
break;
|
||||
|
||||
case RT_VISIBLE_STRING : /* No conversion needed. Just add to working text*/
|
||||
#ifdef WIN32 //renxiaobao mod
|
||||
if(datptr[0]==0) uDataRet = AddString (" ", textBuf, textBufSize, &nStrLen);
|
||||
else
|
||||
#endif
|
||||
uDataRet = AddString (datptr, textBuf, textBufSize, &nStrLen);
|
||||
break;
|
||||
|
||||
#ifdef TIME_DATA_SUPPORT
|
||||
case RT_GENERAL_TIME :
|
||||
uDataRet = LocToTextGtime ((time_t *) datptr, rt_ptr, tmpBuf);
|
||||
if (uDataRet==SD_SUCCESS) /* If converted OK, add to working text*/
|
||||
uDataRet = AddString (tmpBuf, textBuf, textBufSize, &nStrLen);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef BTOD_DATA_SUPPORT
|
||||
case RT_BINARY_TIME :
|
||||
switch (rt_ptr->u.p.el_len) /* determine length */
|
||||
{
|
||||
case 4:
|
||||
uDataRet = LocToTextBtime4 ((ST_INT32 *) datptr, rt_ptr, tmpBuf);
|
||||
break;
|
||||
case 6:
|
||||
uDataRet = LocToTextBtime6 ((ST_INT32 *) datptr, rt_ptr, tmpBuf);
|
||||
break;
|
||||
default:
|
||||
uDataRet = SD_FAILURE;
|
||||
break;
|
||||
}
|
||||
if (uDataRet==SD_SUCCESS) /* If converted OK, add to working text*/
|
||||
uDataRet = AddString (tmpBuf, textBuf, textBufSize, &nStrLen);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case RT_BCD :
|
||||
if (rt_ptr->u.p.el_len <= 2)
|
||||
uDataRet = LocToTextBcd1 ((ST_INT8 *) datptr, rt_ptr, tmpBuf);
|
||||
else if (rt_ptr->u.p.el_len <= 4)
|
||||
uDataRet = LocToTextBcd2 ((ST_INT16 *) datptr, rt_ptr, tmpBuf);
|
||||
else if (rt_ptr->u.p.el_len <= 8)
|
||||
uDataRet = LocToTextBcd4 ((ST_INT32 *) datptr, rt_ptr, tmpBuf);
|
||||
else
|
||||
uDataRet = SD_FAILURE;
|
||||
if (uDataRet==SD_SUCCESS) /* If converted OK, add to working text*/
|
||||
uDataRet = AddString (tmpBuf, textBuf, textBufSize, &nStrLen);
|
||||
break;
|
||||
|
||||
case RT_UTC_TIME :
|
||||
uDataRet = LocToTextUtc ((MMS_UTC_TIME *) datptr, rt_ptr, tmpBuf);
|
||||
if (uDataRet==SD_SUCCESS) /* If converted OK, add to working text*/
|
||||
uDataRet = AddString (tmpBuf, textBuf, textBufSize, &nStrLen);
|
||||
break;
|
||||
|
||||
case RT_UTF8_STRING :
|
||||
uDataRet = LocToTextUtf8 ((ST_UCHAR *) datptr, rt_ptr, tmpBuf);
|
||||
if (uDataRet==SD_SUCCESS) /* If converted OK, add to working text*/
|
||||
uDataRet = AddString (tmpBuf, textBuf, textBufSize, &nStrLen);
|
||||
break;
|
||||
|
||||
default : /* should not be any other tag */
|
||||
MLOG_ERR1 ("Invalid tag: %d", (int) rt_ptr->el_tag);
|
||||
uDataRet = SD_FAILURE;
|
||||
break;
|
||||
}
|
||||
if(strlen (tmpBuf)>sizeof (tmpBuf))
|
||||
{
|
||||
total_len = strlen (tmpBuf);
|
||||
}
|
||||
assert (strlen (tmpBuf) < sizeof (tmpBuf)); /* Must not exceed buffer*/
|
||||
|
||||
datptr += rt_ptr->el_size; /* Adjust data pointer */
|
||||
rt_ptr++; /* point to next rt element */
|
||||
}
|
||||
|
||||
assert (nStrLen <= textBufSize); /* checked in AddString so this should never fail*/
|
||||
if (uDataRet)
|
||||
ret_ptr = NULL;
|
||||
else
|
||||
{
|
||||
textBuf [--nStrLen] = '\0'; /* replace last '\n' with '\0' */
|
||||
ret_ptr = textBuf;
|
||||
}
|
||||
return (ret_ptr);
|
||||
}
|
||||
#if defined(WIN32)
|
||||
char *va_data_to_text (char **va_data,RUNTIME_TYPE **rt_head, RUNTIME_TYPE *rt_end,int read_num)
|
||||
{
|
||||
static char ret_text[128];
|
||||
static char ret_text_buf[12800];
|
||||
RUNTIME_TYPE *rt_ptr;
|
||||
char *datptr,done;
|
||||
ST_RET uDataRet;
|
||||
static int arr_loop_level;
|
||||
static int arr_loops[ASN1_MAX_LEVEL];
|
||||
|
||||
|
||||
rt_ptr = *rt_head;
|
||||
datptr = *va_data;
|
||||
ret_text_buf[0] = 0;
|
||||
ret_text[0] = 0;
|
||||
if(read_num==0) arr_loop_level = 0;
|
||||
done = 0;
|
||||
while(rt_ptr<rt_end)
|
||||
{
|
||||
if(rt_ptr->el_tag == RT_ARR_END)
|
||||
{
|
||||
if(--arr_loops[arr_loop_level] > 0) rt_ptr -= rt_ptr->u.arr.num_rt_blks;
|
||||
else --arr_loop_level;
|
||||
}
|
||||
if (rt_ptr->el_tag == RT_ARR_START)
|
||||
{
|
||||
++arr_loop_level;arr_loops[arr_loop_level] = rt_ptr->u.arr.num_elmnts;
|
||||
}
|
||||
switch (rt_ptr->el_tag)
|
||||
{
|
||||
case RT_ARR_START : break;
|
||||
case RT_ARR_END : break;
|
||||
case RT_STR_START : break;
|
||||
case RT_STR_END : break;
|
||||
case RT_BOOL :
|
||||
uDataRet = LocToTextBool ((ST_BOOLEAN *)datptr, rt_ptr, ret_text);
|
||||
done = 1;
|
||||
break;
|
||||
case RT_BIT_STRING :
|
||||
uDataRet = LocToTextBs ((ST_UCHAR *) datptr, rt_ptr, ret_text);
|
||||
done = 1;
|
||||
break;
|
||||
case RT_INTEGER :
|
||||
if (rt_ptr->u.p.el_len==1) uDataRet = LocToTextInt8 ((ST_INT8 *) datptr, rt_ptr, ret_text);
|
||||
else if(rt_ptr->u.p.el_len==2) uDataRet = LocToTextInt16((ST_INT16 *) datptr, rt_ptr, ret_text);
|
||||
else if(rt_ptr->u.p.el_len==4) uDataRet = LocToTextInt32((ST_INT32 *) datptr, rt_ptr, ret_text);
|
||||
done = 1;
|
||||
break;
|
||||
case RT_UNSIGNED :
|
||||
if (rt_ptr->u.p.el_len==1) uDataRet = LocToTextUint8 ((ST_UINT8 *) datptr, rt_ptr, ret_text);
|
||||
else if(rt_ptr->u.p.el_len==2) uDataRet = LocToTextUint16((ST_UINT16 *) datptr, rt_ptr, ret_text);
|
||||
else if(rt_ptr->u.p.el_len==4) uDataRet = LocToTextUint32((ST_UINT32 *) datptr, rt_ptr, ret_text);
|
||||
done = 1;
|
||||
break;
|
||||
case RT_FLOATING_POINT :
|
||||
if (rt_ptr->u.p.el_len != sizeof (ST_FLOAT))
|
||||
uDataRet = LocToTextDbl ((ST_DOUBLE *) datptr, rt_ptr, ret_text);
|
||||
else
|
||||
uDataRet = LocToTextFlt ((ST_FLOAT *) datptr, rt_ptr, ret_text);
|
||||
done = 1;
|
||||
break;
|
||||
case RT_OCTET_STRING :
|
||||
uDataRet = LocToTextOct ((ST_UCHAR *) datptr, rt_ptr, ret_text);
|
||||
done = 1;
|
||||
break;
|
||||
case RT_VISIBLE_STRING :
|
||||
strcpy(ret_text,datptr);
|
||||
done = 1;
|
||||
break;
|
||||
case RT_GENERAL_TIME :
|
||||
uDataRet = LocToTextGtime ((time_t *) datptr, rt_ptr, ret_text);
|
||||
done = 1;
|
||||
break;
|
||||
case RT_BINARY_TIME :
|
||||
if (rt_ptr->u.p.el_len==4) LocToTextBtime4 ((ST_INT32 *) datptr, rt_ptr, ret_text);
|
||||
else if(rt_ptr->u.p.el_len==6) LocToTextBtime6 ((ST_INT32 *) datptr, rt_ptr, ret_text);
|
||||
done = 1;
|
||||
break;
|
||||
case RT_BCD :
|
||||
if(rt_ptr->u.p.el_len <= 2)
|
||||
uDataRet = LocToTextBcd1 ((ST_INT8 *) datptr, rt_ptr, ret_text);
|
||||
else if (rt_ptr->u.p.el_len <= 4)
|
||||
uDataRet = LocToTextBcd2 ((ST_INT16 *) datptr, rt_ptr, ret_text);
|
||||
else if (rt_ptr->u.p.el_len <= 8)
|
||||
uDataRet = LocToTextBcd4 ((ST_INT32 *) datptr, rt_ptr, ret_text);
|
||||
done = 1;
|
||||
break;
|
||||
case RT_UTC_TIME :
|
||||
uDataRet = LocToTextUtc ((MMS_UTC_TIME *) datptr, rt_ptr, ret_text);
|
||||
done = 1;
|
||||
break;
|
||||
case RT_UTF8_STRING :
|
||||
uDataRet = LocToTextUtf8 ((ST_UCHAR *) datptr, rt_ptr, ret_text);
|
||||
done = 1;
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
datptr += rt_ptr->el_size;
|
||||
rt_ptr++;
|
||||
if(done) strcat(ret_text_buf,ret_text);
|
||||
if((read_num>=0)&&(done)) break;
|
||||
done=0;
|
||||
}
|
||||
*rt_head=rt_ptr;
|
||||
*va_data=datptr;
|
||||
return ret_text_buf;
|
||||
}
|
||||
#endif
|
||||
587
mmslib/mmsl/mmsinit.c
Normal file
587
mmslib/mmsl/mmsinit.c
Normal file
@@ -0,0 +1,587 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : mmsinit.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the common functions to decode and encode */
|
||||
/* an initiate operation. Note that the initiate request and the */
|
||||
/* initiate response are the same. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/31/03 JRB 06 Support MMS Version2. */
|
||||
/* asn1r_get_bitstr: add max_bits arg. */
|
||||
/* If received bitstr too long, truncate. */
|
||||
/* If received bitstr too short, set missing bits=0*/
|
||||
/* 12/20/01 JRB 05 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 04 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 03 Changes to decode buffer allocation scheme */
|
||||
/* 12/10/97 MDE 02 Chaned max_nest to ST_INT8 */
|
||||
/* 07/03/97 MDE 01 Op-specific info buffer handling changes */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pcon.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* For debug version, use a static pointer to avoid duplication of */
|
||||
/* __FILE__ strings. */
|
||||
|
||||
#ifdef DEBUG_SISCO
|
||||
SD_CONST static ST_CHAR *SD_CONST thisFileName = __FILE__;
|
||||
#endif
|
||||
|
||||
#define MMS_V0_PARAM_SUPP_BITS 7 /* DIS */
|
||||
#define MMS_V1_PARAM_SUPP_BITS 11
|
||||
#define MMS_V1_SERV_SUPP_BITS 85
|
||||
/************************************************************************/
|
||||
|
||||
static INIT_INFO *info;
|
||||
|
||||
#ifdef CS_SUPPORT
|
||||
static CS_INIT_INFO *cs_info;
|
||||
static ST_UCHAR *init_detail_start;
|
||||
#endif
|
||||
|
||||
static ST_BOOLEAN request; /* req/resp flag */
|
||||
static ST_RET val_err; /* asn1_set_dec_err code for bad value */
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* static functions in this module */
|
||||
static ST_VOID get_maxseg (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID get_maxreq_calling (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID get_maxreq_called (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID get_max_nest (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID get_detail_seq (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID get_version (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID get_param_prim (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID get_param_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID get_param_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID get_services_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID get_services_prim (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID get_services_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID mms_detail_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID init_seq_done (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _mms_init_dec */
|
||||
/* This function is called from mmsdec.c when an initiate (req or resp) */
|
||||
/* is being decoded. We are in the InitiatePDU sequence. */
|
||||
/* Allocate an operation specific structure and set up to get either */
|
||||
/* the segment size or the max outstanding calling */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _mms_init_dec (ASN1_DEC_CTXT *aCtx, ST_BOOLEAN req)
|
||||
{
|
||||
request = req; /* save the request flag */
|
||||
if (request)
|
||||
val_err = REQ_BAD_VALUE;
|
||||
else
|
||||
val_err = RESP_BAD_VALUE;
|
||||
|
||||
/* Create an init_info structure data area to put the decoded info into.*/
|
||||
|
||||
|
||||
/* CRITICAL: "info" struct must be calloc'd, so if received bitstrings
|
||||
* are too short, the missing bits=0.
|
||||
*/
|
||||
#ifdef CS_SUPPORT
|
||||
if (_mmsdec_ctxt == MMS_PCI)
|
||||
info = (INIT_INFO *) _m_get_dec_buf (aCtx, sizeof (INIT_INFO));
|
||||
else
|
||||
cs_info = (CS_INIT_INFO *) _m_get_dec_buf (aCtx, sizeof (CS_INIT_INFO));
|
||||
#else
|
||||
info = (INIT_INFO *) _m_get_dec_buf (aCtx, sizeof (INIT_INFO));
|
||||
#endif
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX,0,get_maxseg); /* max seg size (opt) */
|
||||
ASN1R_TAG_ADD (aCtx, CTX,1,get_maxreq_calling); /* max outstdg calling */
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* get_maxseg */
|
||||
/* The max_msgsegsize parameter has been encountered. Read its value. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID get_maxseg (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT32 local_detail;
|
||||
|
||||
MLOG_CDEC0 ("get_maxseg");
|
||||
|
||||
if (asn1r_get_i32 (aCtx, &local_detail) || local_detail < 0)
|
||||
{
|
||||
if (request)
|
||||
asn1r_set_dec_err (aCtx, REQ_INVAL_ARG);
|
||||
else
|
||||
asn1r_set_dec_err (aCtx, RESP_INVAL_RSLT);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef CS_SUPPORT
|
||||
if (_mmsdec_ctxt == MMS_PCI)
|
||||
{
|
||||
info->max_segsize_pres = SD_TRUE; /* set present flag for segsize */
|
||||
info->max_segsize = local_detail;
|
||||
}
|
||||
else
|
||||
{
|
||||
cs_info->local_detail_pres = SD_TRUE; /* set present flag */
|
||||
cs_info->local_detail = local_detail;
|
||||
}
|
||||
#else
|
||||
info->max_segsize_pres = SD_TRUE; /* set present flag for segsize */
|
||||
info->max_segsize = local_detail;
|
||||
#endif
|
||||
ASN1R_TAG_ADD (aCtx, CTX,1,get_maxreq_calling);
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* get_maxreq_calling */
|
||||
/* proposed/negiotiated max outstanding calling encountered */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID get_maxreq_calling (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT16 maxreq_calling;
|
||||
|
||||
MLOG_CDEC0 ("get_maxreq_calling");
|
||||
|
||||
/* Get the value of the maxreq_calling parameter. */
|
||||
|
||||
if (asn1r_get_i16 (aCtx, &maxreq_calling))
|
||||
asn1r_set_dec_err (aCtx, val_err);
|
||||
|
||||
#ifdef CS_SUPPORT
|
||||
if (_mmsdec_ctxt == MMS_PCI)
|
||||
info->maxreq_calling = maxreq_calling;
|
||||
else
|
||||
cs_info->maxreq_calling = maxreq_calling;
|
||||
#else
|
||||
info->maxreq_calling = maxreq_calling;
|
||||
#endif
|
||||
|
||||
/* The next data element is the maxreq_called parameter. */
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX,2,get_maxreq_called);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* get_maxreq_called */
|
||||
/* proposed/negiotiated max outstanding called encountered */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID get_maxreq_called (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT16 maxreq_called;
|
||||
|
||||
MLOG_CDEC0 ("get_maxreq_called");
|
||||
|
||||
/* Get the value of the maxreq_called parameter. */
|
||||
|
||||
if (asn1r_get_i16 (aCtx, &maxreq_called))
|
||||
asn1r_set_dec_err (aCtx, val_err);
|
||||
|
||||
#ifdef CS_SUPPORT
|
||||
if (_mmsdec_ctxt == MMS_PCI)
|
||||
info->maxreq_called = maxreq_called;
|
||||
else
|
||||
cs_info->maxreq_called = maxreq_called;
|
||||
#else
|
||||
info->maxreq_called = maxreq_called;
|
||||
#endif
|
||||
|
||||
/* The next data element is either the max_nest parameter (optional) or */
|
||||
/* the initiate detail sequence or the CS detail. */
|
||||
/* All are optional, so we could be done */
|
||||
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = init_seq_done;
|
||||
ASN1R_TAG_ADD (aCtx, CTX,3,get_max_nest);
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,4,get_detail_seq);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* get_max_nest */
|
||||
/* The max_nest parameter has been encountered. Read its value. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID get_max_nest (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT8 max_nest;
|
||||
|
||||
MLOG_CDEC0 ("get_max_nest");
|
||||
|
||||
/* Get the value of the max_nest parameter. */
|
||||
|
||||
if (asn1r_get_i8 (aCtx, &max_nest))
|
||||
asn1r_set_dec_err (aCtx, val_err);
|
||||
else
|
||||
{
|
||||
#ifdef CS_SUPPORT
|
||||
if (_mmsdec_ctxt == MMS_PCI)
|
||||
{
|
||||
info->max_nest_pres = SD_TRUE;
|
||||
info->max_nest = max_nest;
|
||||
}
|
||||
else
|
||||
{
|
||||
cs_info->max_nest_pres = SD_TRUE;
|
||||
cs_info->max_nest = max_nest;
|
||||
/* Initiate detail sequence may be next, or CS detail */
|
||||
init_detail_start = aCtx->asn1r_field_ptr;
|
||||
}
|
||||
#else
|
||||
info->max_nest_pres = SD_TRUE;
|
||||
info->max_nest = max_nest;
|
||||
#endif
|
||||
}
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,4,get_detail_seq);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* get_detail_seq */
|
||||
/* The mms init detail sequence is now starting, first is version # */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID get_detail_seq (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("get_detail_seq");
|
||||
|
||||
/* Check if decoding an MMS CORE Initiate or a CS Initiate */
|
||||
|
||||
#ifdef CS_SUPPORT
|
||||
if (_mmsdec_ctxt == MMS_PCI)
|
||||
{
|
||||
info->mms_detail_pres = SD_TRUE; /* set detail present flag */
|
||||
ASN1R_TAG_ADD (aCtx, CTX,0,get_version); /* Next comes version */
|
||||
}
|
||||
else /* Companion Standard Initiate, accept sequence */
|
||||
asn1r_parse_cstr_contents (aCtx, mms_detail_cstr_done);
|
||||
#else
|
||||
info->mms_detail_pres = SD_TRUE; /* set detail present flag */
|
||||
ASN1R_TAG_ADD (aCtx, CTX,0,get_version); /* Next comes version */
|
||||
#endif
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* get_version */
|
||||
/* The mms init detail sequence is now starting, this is version # */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID get_version (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("get_version");
|
||||
|
||||
/* Get the value of the max_nest parameter. */
|
||||
|
||||
if (asn1r_get_i16 (aCtx, &info->version) || info->version <0)
|
||||
asn1r_set_dec_err (aCtx, val_err);
|
||||
|
||||
/* Next is parameter support options, a 6 bit bitstring (prim or cstr) */
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX,1,get_param_prim);
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,1,get_param_cstr);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* get_param_prim */
|
||||
/* The parameter support BS has been encountered as a primitive data */
|
||||
/* element. Read its value. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID get_param_prim (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("get_param_prim");
|
||||
|
||||
/* NOTE: decode only the bits we recognize.
|
||||
* For version0 (DIS) should get 7 bits.
|
||||
* For version1 (IS) should get 11 bits.
|
||||
* For version2 and higher, may get more than 11, but we ignore the
|
||||
* higher bits because we don't support them.
|
||||
*/
|
||||
if (!asn1r_get_bitstr (aCtx, info->param_supp, MMS_V1_PARAM_SUPP_BITS))
|
||||
get_param_done (aCtx); /* set up for the next data element */
|
||||
else
|
||||
asn1r_set_dec_err (aCtx, val_err);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* get_param_cstr */
|
||||
/* The parameter suport has been encountered as a constructor data */
|
||||
/* element. Read its value. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID get_param_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
MLOG_CDEC0 ("get_param_cstr");
|
||||
|
||||
/* Set up to call this function when done with constructor bitstring. */
|
||||
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = get_param_done;
|
||||
|
||||
/* Get the value of the parameter support. For constructor */
|
||||
/* bitstrings, this requires returning and letting the ASN.1 tools */
|
||||
/* parse it to any nesting level. */
|
||||
|
||||
asn1r_get_bitstr_cstr (aCtx, MMS_V1_PARAM_SUPP_BITS,info->param_supp);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* get_param_done */
|
||||
/* Function called after the supported parameter has been parsed. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID get_param_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
MLOG_CDEC0 ("get_param_done");
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX,2,get_services_prim);
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,2,get_services_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* get_services_prim */
|
||||
/* The services support BS has been encountered as a primitive data */
|
||||
/* element. Read its value. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID get_services_prim (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("get_services_prim");
|
||||
|
||||
/* NOTE: decode only the bits we recognize.
|
||||
* For version0 (DIS) and version1 (IS) should get 85 bits.
|
||||
* For version2 and higher, may get more than 85, but we ignore the
|
||||
* higher bits because we don't support them.
|
||||
*/
|
||||
if (!asn1r_get_bitstr (aCtx, info->serv_supp, MMS_V1_SERV_SUPP_BITS))
|
||||
get_services_done (aCtx); /* set up for the next data element */
|
||||
else
|
||||
asn1r_set_dec_err (aCtx, val_err);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* get_services_cstr */
|
||||
/* The service suport BS has been encountered as a constructor data */
|
||||
/* element. Read its value. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID get_services_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
MLOG_CDEC0 ("get_services_cstr");
|
||||
|
||||
/* Set up to call this function when done with constructor bitstring. */
|
||||
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = get_services_done;
|
||||
|
||||
/* Get the value of the service support. For constructor */
|
||||
/* bitstrings, this requires returning and letting the ASN.1 tools */
|
||||
/* parse it to any nesting level. */
|
||||
|
||||
asn1r_get_bitstr_cstr (aCtx, MMS_V1_SERV_SUPP_BITS,info->serv_supp);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* get_services_done */
|
||||
/* Function called when entire mms_detail constructor is done */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID get_services_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
MLOG_CDEC0 ("get_services_done");
|
||||
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = mms_detail_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* mms_detail_cstr_done */
|
||||
/* Function called when entire mms_detail constructor is done */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID mms_detail_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("mms_detail_cstr_done");
|
||||
|
||||
#ifdef CS_SUPPORT
|
||||
if (_mmsdec_ctxt != MMS_PCI)
|
||||
{
|
||||
cs_info->init_detail_len = aCtx->asn1r_field_ptr - init_detail_start;
|
||||
cs_info->init_detail = init_detail_start;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* init_seq_done */
|
||||
/* The parse of the Initiate PDU is complete, either with or without */
|
||||
/* CS detail. Just set decode done flag. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID init_seq_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("init_seq_done");
|
||||
|
||||
aCtx->asn1r_decode_done = SD_TRUE;
|
||||
aCtx->asn1r_decode_done_fun = _mms_dec_done_ok;
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_init */
|
||||
/* Function to construct an Initiate request or response PDU in the */
|
||||
/* selected buffer. Pass a pointer to the end of the build buffer, and */
|
||||
/* a pointer to a structure of type init_info that contains the build */
|
||||
/* control and data information. Returns a pointer to the first byte */
|
||||
/* of the encoded message. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_UCHAR *_ms_mk_init (ASN1_ENC_CTXT *aCtx, ST_UCHAR *buf_ptr, ST_INT buf_len,
|
||||
INIT_INFO *info_ptr, ST_INT pdutype,
|
||||
ST_BOOLEAN cs_init)
|
||||
{
|
||||
#ifdef DEBUG_SISCO
|
||||
ST_UCHAR *msg_start; /* These variables used for */
|
||||
ST_INT msg_len; /* debug print only. */
|
||||
#endif
|
||||
#ifdef CS_SUPPORT
|
||||
CS_INIT_INFO *cs_init_ptr;
|
||||
#endif
|
||||
|
||||
asn1r_strt_asn1_bld (aCtx, buf_ptr,buf_len); /* Initialize the ASN.1 tools */
|
||||
|
||||
#ifdef CS_SUPPORT
|
||||
if (cs_init) /* COMPANION STANDARD INITIATE PDU */
|
||||
{
|
||||
cs_init_ptr = (CS_INIT_INFO *) info_ptr;
|
||||
|
||||
/* write the CS init detail constructor */
|
||||
asn1r_strt_constr (aCtx); /* start the CTX 5 cstr */
|
||||
asn1r_wr_octstr (aCtx, cs_init_ptr->init_detail,cs_init_ptr->init_detail_len);
|
||||
asn1r_fin_constr (aCtx, 4,CTX,DEF); /* close the CS detail cstr */
|
||||
|
||||
/* maximum data nesting (optional) */
|
||||
if (cs_init_ptr->max_nest_pres) /* if desired to send - */
|
||||
{
|
||||
asn1r_wr_i8 (aCtx, (ST_CHAR)cs_init_ptr->max_nest);
|
||||
asn1r_fin_prim (aCtx, 3,CTX); /* context-specific, tag 2 */
|
||||
}
|
||||
|
||||
/* max outstanding requests from called MMS-user */
|
||||
asn1r_wr_i16 (aCtx, cs_init_ptr->maxreq_called);
|
||||
asn1r_fin_prim (aCtx, 2,CTX); /* context-specific, tag 2 */
|
||||
|
||||
/* max outstanding requests from calling MMS-user */
|
||||
asn1r_wr_i16 (aCtx, cs_init_ptr->maxreq_calling);
|
||||
asn1r_fin_prim (aCtx, 1,CTX); /* context-specific, tag 1 */
|
||||
|
||||
/* max segment size (optional) */
|
||||
if (cs_init_ptr->local_detail_pres) /* if enabled */
|
||||
{
|
||||
asn1r_wr_i32 (aCtx, cs_init_ptr->local_detail);
|
||||
asn1r_fin_prim (aCtx, 0,CTX); /* context-specific, tag 0 */
|
||||
}
|
||||
}
|
||||
else /* MMS CORE INITIATE PDU */
|
||||
{
|
||||
#endif
|
||||
/* Now begin writing primitive data elements from back of PDU to front. */
|
||||
|
||||
/* write the mms init detail constructor, if enabled */
|
||||
if (info_ptr->mms_detail_pres) /* if we have MMS detail */
|
||||
{
|
||||
asn1r_strt_constr (aCtx);
|
||||
asn1r_wr_bitstr (aCtx, info_ptr->serv_supp,MMS_V1_SERV_SUPP_BITS); /* services supported BS */
|
||||
asn1r_fin_prim (aCtx, 2,CTX); /* context-specific, tag 2 */
|
||||
|
||||
/* parameters supported BS, write either 7 (DIS) or 11 (IS) bits */
|
||||
if (info_ptr->version == 0) /* If DIS is being proposed */
|
||||
{
|
||||
asn1r_wr_bitstr (aCtx, info_ptr->param_supp,MMS_V0_PARAM_SUPP_BITS);
|
||||
asn1r_fin_prim (aCtx, 1,CTX);
|
||||
}
|
||||
else /* IS is being proposed */
|
||||
{
|
||||
asn1r_wr_bitstr (aCtx, info_ptr->param_supp,MMS_V1_PARAM_SUPP_BITS);
|
||||
asn1r_fin_prim (aCtx, 1,CTX); /* context-specific, tag 1 */
|
||||
}
|
||||
|
||||
asn1r_wr_i16 (aCtx, info_ptr->version); /* version number */
|
||||
asn1r_fin_prim (aCtx, 0,CTX); /* context-specific, tag 0 */
|
||||
|
||||
asn1r_fin_constr (aCtx, 4,CTX,DEF); /* close the MMS detail cstr */
|
||||
}
|
||||
|
||||
/* Now write the core initiate parameters */
|
||||
|
||||
/* maximum data nesting (optional) */
|
||||
if (info_ptr->max_nest_pres) /* if desired to send - */
|
||||
{
|
||||
asn1r_wr_i8 (aCtx, (ST_CHAR)info_ptr->max_nest);
|
||||
asn1r_fin_prim (aCtx, 3,CTX); /* context-specific, tag 2 */
|
||||
}
|
||||
|
||||
/* max outstanding requests from called MMS-user */
|
||||
asn1r_wr_i16 (aCtx, info_ptr->maxreq_called);
|
||||
asn1r_fin_prim (aCtx, 2,CTX); /* context-specific, tag 2 */
|
||||
|
||||
/* max outstanding requests from calling MMS-user */
|
||||
asn1r_wr_i16 (aCtx, info_ptr->maxreq_calling);
|
||||
asn1r_fin_prim (aCtx, 1,CTX); /* context-specific, tag 1 */
|
||||
|
||||
/* max segment size (optional) */
|
||||
if (info_ptr->max_segsize_pres) /* if enabled */
|
||||
{
|
||||
asn1r_wr_i32 (aCtx, info_ptr->max_segsize);
|
||||
asn1r_fin_prim (aCtx, 0,CTX); /* context-specific, tag 0 */
|
||||
}
|
||||
#ifdef CS_SUPPORT
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Close the PDU. Building of either the request or response message */
|
||||
/* is complete. */
|
||||
|
||||
#ifdef DEBUG_SISCO
|
||||
asn1r_fin_constr (aCtx, (ST_UINT16) pdutype,CTX,DEF);
|
||||
msg_start = aCtx->asn1r_field_ptr + 1;
|
||||
msg_len = (buf_ptr + buf_len) - msg_start;
|
||||
|
||||
MLOG_ENC2 ("INITIATE %s built, len = %d",
|
||||
pdutype == MMSINITREQ ? "request" : "response",
|
||||
msg_len);
|
||||
MLOG_ENCH (msg_len,msg_start);
|
||||
MLOG_PAUSEENC (NULL);
|
||||
|
||||
return (msg_start);
|
||||
#else
|
||||
asn1r_fin_constr (aCtx, (ST_UINT16) pdutype,CTX,DEF);
|
||||
return (aCtx->asn1r_field_ptr + 1);
|
||||
#endif
|
||||
}
|
||||
355
mmslib/mmsl/mmsl_fin.c
Normal file
355
mmslib/mmsl/mmsl_fin.c
Normal file
@@ -0,0 +1,355 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1993 - 2002, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : mmsl_fin.c */
|
||||
/* PRODUCT(S) : MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains common functions used to finish various */
|
||||
/* types of MMS PDU's */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* ST_INT16 mms_fin_null_resp (invoke_id,opcode) */
|
||||
/* ST_INT16 mms_fin_null_req (opcode) */
|
||||
/* ST_INT16 mms_resp_fin (opcode,invoke_id,mk_fun,info_ptr) */
|
||||
/* ST_INT16 mms_req_fin (opcode,mk_ptr,info_ptr) */
|
||||
/* ST_INT16 mms_unconf_req_fin (opcode,mk_ptr,info_ptr) */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 12/18/07 MDE 13 Fixed request log mask */
|
||||
/* 11/12/07 MDE 12 Pass MMSOP_READ to logging when usr handled */
|
||||
/* 04/09/07 MDE 11 Enhanced filtered logging */
|
||||
/* 03/11/04 GLB 10 Remove "thisFileName" */
|
||||
/* 12/12/02 JRB 09 _mms_unconf_req_fin: Add ASN1_ENC_CTXT arg, */
|
||||
/* do NOT call asn1r_strt_asn1_bld, do NOT set */
|
||||
/* global vars "mmsl_msg_*". */
|
||||
/* 04/08/02 MDE 08 Added log function pointers */
|
||||
/* 04/05/02 MDE 07 Cleaned up MMS Lite use of MLOG */
|
||||
/* 01/18/02 JRB 06 Del _ms_fin_pdu_debug. Use new _ms_fin_pdu */
|
||||
/* and _ms_fin_pdu_log (in mms_ced.c). */
|
||||
/* 01/02/02 JRB 05 Converted to use ASN1R. */
|
||||
/* Add ASN1_DEC_CTXT to (*mk_fun) calls in */
|
||||
/* mms_req_fin, mms_resp_fin, mms_unconf_req_fin*/
|
||||
/* 09/13/99 MDE 04 Added SD_CONST modifiers */
|
||||
/* 06/15/98 MDE 03 Changes to allow compile under C++ */
|
||||
/* 03/20/98 JRB 02 Don't need mmsop_en.h anymore. */
|
||||
/* 09/10/97 MDE 01 MMS-LITE V4.0 Release */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mloguser.h"
|
||||
#include "mvl_defs.h"
|
||||
#include "mvl_log.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID (*ml_log_req_info_fun) (ST_INT invokeId, ST_INT op, ST_VOID *info);
|
||||
ST_VOID (*ml_log_ind_info_fun) (ST_INT invokeId, ST_INT op, ST_VOID *info);
|
||||
|
||||
ST_VOID (*ml_log_resp_info_fun) (ST_INT invokeId, ST_INT op, ST_VOID *info);
|
||||
ST_VOID (*ml_log_conf_info_fun) (ST_INT invokeId, ST_INT op, ST_VOID *info);
|
||||
|
||||
ST_VOID (*ml_log_unsol_req_info_fun) (ST_INT op, ST_VOID *info);
|
||||
ST_VOID (*ml_log_unsol_ind_info_fun) (ST_INT op, ST_VOID *info);
|
||||
|
||||
ST_VOID (*ml_log_error_conf_fun) (ST_INT invokeId, ST_VOID *info);
|
||||
ST_VOID (*ml_log_error_resp_fun) (ST_INT invokeId, ST_VOID *info);
|
||||
|
||||
ST_VOID (*ml_log_reject_send_fun) (ST_VOID *info);
|
||||
ST_VOID (*ml_log_reject_recv_fun) (ST_VOID *info);
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* GENERAL PDU FINISH FUNCTIONS */
|
||||
/************************************************************************/
|
||||
/* mms_fin_null_resp */
|
||||
/* general NULL response function, used for prim NULL responses */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET _mms_fin_null_resp (ST_UINT32 invoke_id, ST_INT opcode)
|
||||
{
|
||||
ASN1_ENC_CTXT localEncCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_ENC_CTXT *aCtx = &localEncCtx;
|
||||
|
||||
asn1r_strt_asn1_bld (aCtx, mmsl_enc_buf,mmsl_enc_buf_size); /* init the builder */
|
||||
|
||||
#ifdef CS_SUPPORT /* Check for CS information */
|
||||
if (cs_send.cs_pres)
|
||||
{
|
||||
asn1r_strt_constr (aCtx);
|
||||
asn1r_wr_delmnt (aCtx, cs_send.cs_ptr,cs_send.cs_len);
|
||||
cs_send.cs_pres = cs_send_reset_val;
|
||||
asn1r_fin_constr (aCtx, 79,CTX|CONSTR,DEF);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* write the context specific explicit asn1_tag for this opcode. */
|
||||
asn1r_fin_prim (aCtx, (ST_INT16)opcode,CTX); /* asn1_tag = opcode, ctx prim */
|
||||
|
||||
asn1r_wr_u32 (aCtx, invoke_id); /* write the invoke id */
|
||||
asn1r_fin_prim (aCtx, INT_CODE,UNI);
|
||||
|
||||
mmsl_msg_start = _ms_fin_pdu (aCtx, MMSRESP, &mmsl_msg_len);
|
||||
#ifdef DEBUG_SISCO
|
||||
_ms_fin_pdu_log (MMSRESP, mms_op_string[opcode],mmsl_msg_start,mmsl_msg_len);
|
||||
#endif
|
||||
|
||||
if (aCtx->asn1r_encode_overrun) /* Check for encode overrun */
|
||||
return (ME_ASN1_ENCODE_OVERRUN);
|
||||
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_fin_null_req */
|
||||
/* general NULL request function, used for prim NULL requests */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET _mms_fin_null_req (ST_INT opcode)
|
||||
{
|
||||
ASN1_ENC_CTXT localEncCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_ENC_CTXT *aCtx = &localEncCtx;
|
||||
|
||||
asn1r_strt_asn1_bld (aCtx, mmsl_enc_buf,mmsl_enc_buf_size); /* init the builder */
|
||||
|
||||
#ifdef CS_SUPPORT /* Check for CS information */
|
||||
if (cs_send.cs_pres)
|
||||
{
|
||||
asn1r_strt_constr (aCtx);
|
||||
asn1r_wr_delmnt (aCtx, cs_send.cs_ptr,cs_send.cs_len);
|
||||
cs_send.cs_pres = cs_send_reset_val;
|
||||
asn1r_fin_constr (aCtx, 79,CTX|CONSTR,DEF);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Write the context specific explicit asn1_tag for this opcode on a NULL */
|
||||
/* data element. */
|
||||
|
||||
asn1r_fin_prim (aCtx, (ST_INT16)opcode, CTX); /* asn1_tag = opcode, context */
|
||||
|
||||
#ifdef MOD_SUPPORT /* check for modifier info */
|
||||
if ( modifier_list.info_pres )
|
||||
{
|
||||
asn1r_strt_constr (aCtx);
|
||||
wr_mms_modlist( modifier_list.mod_list_ptr,
|
||||
modifier_list.num_of_mods );
|
||||
asn1r_fin_constr (aCtx, SEQ_CODE,UNI,DEF);
|
||||
modifier_list.info_pres = SD_FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
asn1r_wr_u32 (aCtx, mmsl_invoke_id++); /* write the invoke id */
|
||||
asn1r_fin_prim (aCtx, INT_CODE,UNI);
|
||||
|
||||
/* Complete the outer ASN.1 element */
|
||||
mmsl_msg_start = _ms_fin_pdu (aCtx, MMSREQ, &mmsl_msg_len);
|
||||
#ifdef DEBUG_SISCO
|
||||
_ms_fin_pdu_log (MMSREQ, mms_op_string[opcode],mmsl_msg_start,mmsl_msg_len);
|
||||
#endif
|
||||
|
||||
if (aCtx->asn1r_encode_overrun) /* Check for encode overrun */
|
||||
{
|
||||
return (ME_ASN1_ENCODE_OVERRUN);
|
||||
}
|
||||
|
||||
/* OK, message has been build successfully */
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_resp_fin */
|
||||
/* general mp_xxxxxx response function, used for prim responses */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET _mms_resp_fin (ST_INT opcode, ST_UINT32 invoke_id,
|
||||
ST_VOID (*mk_fun)(ASN1_ENC_CTXT *ac, ST_CHAR *info), ST_CHAR *info_ptr)
|
||||
{
|
||||
ASN1_ENC_CTXT localEncCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_ENC_CTXT *aCtx = &localEncCtx;
|
||||
|
||||
asn1r_strt_asn1_bld (aCtx, mmsl_enc_buf,mmsl_enc_buf_size); /* init the builder */
|
||||
|
||||
#ifdef CS_SUPPORT /* Check for CS information */
|
||||
if (cs_send.cs_pres)
|
||||
{
|
||||
asn1r_strt_constr (aCtx);
|
||||
asn1r_wr_delmnt (aCtx, cs_send.cs_ptr,cs_send.cs_len);
|
||||
cs_send.cs_pres = cs_send_reset_val;
|
||||
asn1r_fin_constr (aCtx, 79,CTX|CONSTR,DEF);
|
||||
}
|
||||
#endif
|
||||
|
||||
(*mk_fun) (aCtx, info_ptr);
|
||||
|
||||
asn1r_wr_u32 (aCtx, invoke_id); /* write the invoke id */
|
||||
asn1r_fin_prim (aCtx, INT_CODE,UNI);
|
||||
|
||||
mmsl_msg_start = _ms_fin_pdu (aCtx, MMSRESP, &mmsl_msg_len);
|
||||
#ifdef DEBUG_SISCO
|
||||
_ms_fin_pdu_log (MMSRESP, mms_op_string[opcode],mmsl_msg_start,mmsl_msg_len);
|
||||
#endif
|
||||
|
||||
if (aCtx->asn1r_encode_overrun) /* Check for encode overrun */
|
||||
{
|
||||
|
||||
printf("asn1r_encode_overrun %d\n",mmsl_enc_buf_size);
|
||||
return (ME_ASN1_ENCODE_OVERRUN);
|
||||
}
|
||||
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_req_fin */
|
||||
/* general mp_xxxxx request function, used for prim requests */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET _mms_req_fin (ST_INT opcode, ST_VOID (*mk_ptr)(ASN1_ENC_CTXT *ac, ST_CHAR *info),
|
||||
ST_CHAR *info_ptr)
|
||||
{
|
||||
ASN1_ENC_CTXT localEncCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_ENC_CTXT *aCtx = &localEncCtx;
|
||||
|
||||
asn1r_strt_asn1_bld (aCtx, mmsl_enc_buf,mmsl_enc_buf_size); /* init the builder */
|
||||
|
||||
#ifdef CS_SUPPORT /* Check for CS information */
|
||||
if (cs_send.cs_pres)
|
||||
{
|
||||
asn1r_strt_constr (aCtx);
|
||||
asn1r_wr_delmnt (aCtx, cs_send.cs_ptr,cs_send.cs_len);
|
||||
cs_send.cs_pres = cs_send_reset_val;
|
||||
asn1r_fin_constr (aCtx, 79,CTX|CONSTR,DEF);
|
||||
}
|
||||
#endif
|
||||
|
||||
(*mk_ptr)(aCtx, info_ptr); /* write the PDU */
|
||||
|
||||
#ifdef MOD_SUPPORT /* check for modifier info */
|
||||
if ( modifier_list.info_pres )
|
||||
{
|
||||
asn1r_strt_constr (aCtx);
|
||||
wr_mms_modlist( modifier_list.mod_list_ptr,
|
||||
modifier_list.num_of_mods );
|
||||
asn1r_fin_constr (aCtx, SEQ_CODE,UNI,DEF);
|
||||
modifier_list.info_pres = SD_FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
asn1r_wr_u32 (aCtx, mmsl_invoke_id++); /* write the invoke id */
|
||||
asn1r_fin_prim (aCtx, INT_CODE,UNI);
|
||||
|
||||
mmsl_msg_start = _ms_fin_pdu (aCtx, MMSREQ, &mmsl_msg_len);
|
||||
#ifdef DEBUG_SISCO
|
||||
_ms_fin_pdu_log (MMSREQ, mms_op_string[opcode],mmsl_msg_start,mmsl_msg_len);
|
||||
#endif
|
||||
|
||||
if (aCtx->asn1r_encode_overrun) /* Check for encode overrun */
|
||||
{
|
||||
return (ME_ASN1_ENCODE_OVERRUN);
|
||||
}
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* mms_unconf_req_fin */
|
||||
/* general mp_xxxxx request function, for unconfirmed requests */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET _mms_unconf_req_fin (ASN1_ENC_CTXT *aCtx, ST_INT opcode, ST_VOID (*mk_ptr)(ASN1_ENC_CTXT *ac, ST_CHAR *info),
|
||||
ST_CHAR *info_ptr)
|
||||
{
|
||||
ST_UCHAR *msg_ptr;
|
||||
ST_INT msg_len;
|
||||
|
||||
/* Make sure that "asn1r_strt_asn1_bld" was called for this context. */
|
||||
assert (aCtx->asn1r_magic == ASN1_ENC_MAGIC_NUMBER);
|
||||
|
||||
#ifdef CS_SUPPORT /* Check for CS information */
|
||||
if (cs_send.cs_pres)
|
||||
{
|
||||
asn1r_strt_constr (aCtx);
|
||||
asn1r_wr_delmnt (aCtx, cs_send.cs_ptr,cs_send.cs_len);
|
||||
cs_send.cs_pres = cs_send_reset_val;
|
||||
asn1r_fin_constr (aCtx, 79,CTX|CONSTR,DEF);
|
||||
}
|
||||
#endif
|
||||
|
||||
(*mk_ptr)(aCtx, info_ptr); /* write the PDU */
|
||||
|
||||
msg_ptr = _ms_fin_pdu (aCtx, MMSUNREQ, &msg_len);
|
||||
#ifdef DEBUG_SISCO
|
||||
_ms_fin_pdu_log (MMSUNREQ, mms_op_string[opcode],msg_ptr,msg_len);
|
||||
#endif
|
||||
|
||||
if (aCtx->asn1r_encode_overrun) /* Check for encode overrun */
|
||||
return (ME_ASN1_ENCODE_OVERRUN);
|
||||
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_resp_log */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mpl_resp_log (MVL_IND_PEND *indCtrl, ST_VOID *respInfo)
|
||||
{
|
||||
if ((mms_debug_sel & MMS_LOG_RESP) && ml_log_resp_info_fun != NULL)
|
||||
{
|
||||
if (mvl_conn_filtered_logging == SD_FALSE || indCtrl->event->net_info->log_enable)
|
||||
{
|
||||
(*ml_log_resp_info_fun) (indCtrl->event->u.mms.dec_rslt.id,
|
||||
indCtrl->op == MMSOP_RD_USR_HANDLED ? MMSOP_READ : indCtrl->op,
|
||||
respInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* mpl_req_log */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mpl_req_log (MVL_REQ_PEND *reqCtrl, ST_VOID *reqInfo)
|
||||
{
|
||||
if ((mms_debug_sel & MMS_LOG_REQ) && ml_log_req_info_fun != NULL)
|
||||
{
|
||||
if (mvl_conn_filtered_logging == SD_FALSE || reqCtrl->net_info->log_enable)
|
||||
{
|
||||
(*ml_log_req_info_fun) (reqCtrl->invoke_id, reqCtrl->op, reqInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* mpl_unsol_req_log */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mpl_unsol_req_log (MVL_NET_INFO *netInfo, ST_INT op, ST_VOID *reqInfo)
|
||||
{
|
||||
if ((mms_debug_sel & MMS_LOG_REQ) && ml_log_unsol_req_info_fun != NULL)
|
||||
{
|
||||
if (mvl_conn_filtered_logging == SD_FALSE || netInfo->log_enable)
|
||||
{
|
||||
(*ml_log_unsol_req_info_fun) (op, reqInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
232
mmslib/mmsl/mmslvar.c
Normal file
232
mmslib/mmsl/mmslvar.c
Normal file
@@ -0,0 +1,232 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1993 - 2005, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : mmslvar.c */
|
||||
/* PRODUCT(S) : MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* All global MMSEASE-LITE variables are defined in this module, */
|
||||
/* and declared in LMMSDEFS.H */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* NONE */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/17/08 JRB 15 Del m_use_long_ints flag. */
|
||||
/* 10/04/07 MDE 14 Tweaked LOGCFG_VALUE_GROUP/LOGCFGX_VALUE_MAP */
|
||||
/* 06/22/05 JRB 13 Remove static from usrLog* var. */
|
||||
/* 06/06/05 EJV 12 usrLogMaskMapCtrl not used when FOUNDRY def. */
|
||||
/* 05/23/05 EJV 11 Add xxxLogMaskMapCtrl for parsing logcfg.xml */
|
||||
/* 09/04/03 EJV 10 Chg mms_debug_sel to ST_UINT (from ST_UINT32)*/
|
||||
/* 03/13/03 JRB 09 Del u_ml_get_rt_type func ptr, it is func now*/
|
||||
/* 01/02/03 JRB 08 Add arg to u_ml_get_rt_type. */
|
||||
/* 03/15/01 JRB 07 Added user_debug_sel & _user_*_logstr */
|
||||
/* 09/13/99 MDE 06 Added SD_CONST modifiers */
|
||||
/* 02/23/99 JRB 05 Don't init m_data_algn_tbl, it's a constant. */
|
||||
/* 10/21/98 MDE 04 Removed VMS ifdef */
|
||||
/* 10/08/98 MDE 03 Migrated to updated SLOG interface */
|
||||
/* 11/05/97 MDE 02 Changed mmsl_msg_start to ST_UCHAR * */
|
||||
/* 09/10/97 MDE 01 MMS-LITE V4.0 Release */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_err.h"
|
||||
#include "mms_pvar.h"
|
||||
#include "mms_vvar.h"
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* MMSEASE-LITE Global Variables */
|
||||
/************************************************************************/
|
||||
|
||||
ST_INT mmsl_enc_buf_size;
|
||||
ST_UCHAR *mmsl_enc_buf;
|
||||
ST_INT mmsl_dec_info_size;
|
||||
|
||||
#if !defined(NO_GLB_VAR_INIT)
|
||||
ST_INT16 mmsl_version = 1; /* select IS for version */
|
||||
ST_UINT32 mmsl_invoke_id = 1;
|
||||
#else
|
||||
ST_INT16 mmsl_version; /* select IS for version */
|
||||
ST_UINT32 mmsl_invoke_id;
|
||||
#endif
|
||||
|
||||
ST_UCHAR *mmsl_msg_start;
|
||||
ST_INT mmsl_msg_len;
|
||||
|
||||
/************************************************************************/
|
||||
/* Variables in common with MMS-EASE */
|
||||
|
||||
#if !defined(NO_GLB_VAR_INIT)
|
||||
ST_UINT _mmsdec_ctxt = MMS_PCI;/* decode context type, default to core */
|
||||
#else
|
||||
ST_UINT _mmsdec_ctxt; /* decode context type, default to core */
|
||||
#endif
|
||||
ST_INT _mmsdec_msglen; /* MMS decode message length */
|
||||
ST_UCHAR *_mmsdec_msgptr; /* MMS decode message ptr */
|
||||
ST_BOOLEAN _mms_dec_info_pres;
|
||||
MMSDEC_INFO *_mmsdec_rslt;
|
||||
ST_VOID *_mms_dec_info;
|
||||
|
||||
ADTNL_ERR_RESP_INFO adtnl_err_info;
|
||||
|
||||
ST_RET mms_op_err;
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* Some Alternate Access related variables. These are defined in */
|
||||
/* mmsvar.c for MMS-EASE, but are put here for MMS-LITE */
|
||||
|
||||
#if !defined(NO_GLB_VAR_INIT)
|
||||
ST_INT m_max_dec_aa = 50;
|
||||
ST_INT m_max_rt_aa_ctrl = 1000;
|
||||
#else
|
||||
ST_INT m_max_dec_aa;
|
||||
ST_INT m_max_rt_aa_ctrl;
|
||||
#endif
|
||||
|
||||
ST_INT m_hw_dec_aa;
|
||||
ST_INT m_hw_rt_aa_ctrl;
|
||||
ST_BOOLEAN m_alt_acc_packed;
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* This variable can be set to force use of the DIS MMS floating point */
|
||||
/* type protocol (used in any over the wire and internal ASN.1 type */
|
||||
/* definitions). */
|
||||
/************************************************************************/
|
||||
|
||||
ST_BOOLEAN m_use_dis_float;
|
||||
|
||||
/************************************************************************/
|
||||
/* Global variables for modifier support */
|
||||
/************************************************************************/
|
||||
|
||||
#if !defined (NO_GLB_VAR_INIT)
|
||||
LIST_OF_MODS modifier_list; /* used to encode modifier info */
|
||||
ST_INT m_max_mods = 1; /* num of modifier structs calloced during dec. */
|
||||
#else
|
||||
LIST_OF_MODS modifier_list;
|
||||
ST_INT m_max_mods;
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/* Global variables for compantion standard (IS) */
|
||||
/************************************************************************/
|
||||
|
||||
CSI cs_send; /* SEND CS info structure */
|
||||
ST_BOOLEAN cs_send_reset_val;
|
||||
|
||||
/************************************************************************/
|
||||
/* Logging variables */
|
||||
/************************************************************************/
|
||||
|
||||
#if !defined(NO_GLB_VAR_INIT)
|
||||
ST_UINT mms_debug_sel = MMS_LOG_ERR;
|
||||
ST_UINT user_debug_sel = USER_LOG_ERR;
|
||||
#else
|
||||
ST_UINT mms_debug_sel;
|
||||
ST_UINT user_debug_sel;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_SISCO
|
||||
SD_CONST ST_CHAR *SD_CONST _mms_log_dec_logstr = "MMS_LOG_DEC";
|
||||
SD_CONST ST_CHAR *SD_CONST _mms_log_enc_logstr = "MMS_LOG_ENC";
|
||||
SD_CONST ST_CHAR *SD_CONST _mms_log_acse_logstr = "MMS_LOG_ACSE";
|
||||
SD_CONST ST_CHAR *SD_CONST _mms_log_llc_logstr = "MMS_LOG_LLC";
|
||||
SD_CONST ST_CHAR *SD_CONST _mms_log_ique_logstr = "MMS_LOG_IQUE";
|
||||
SD_CONST ST_CHAR *SD_CONST _mms_log_rque_logstr = "MMS_LOG_RQUE";
|
||||
SD_CONST ST_CHAR *SD_CONST _mms_log_ind_logstr = "MMS_LOG_IND";
|
||||
SD_CONST ST_CHAR *SD_CONST _mms_log_conf_logstr = "MMS_LOG_CONF";
|
||||
SD_CONST ST_CHAR *SD_CONST _mms_log_vm_logstr = "MMS_LOG_VM";
|
||||
SD_CONST ST_CHAR *SD_CONST _mms_log_err_logstr = "MMS_LOG_ERR";
|
||||
SD_CONST ST_CHAR *SD_CONST _mms_log_nerr_logstr = "MMS_LOG_NERR";
|
||||
SD_CONST ST_CHAR *SD_CONST _mms_log_pdu_logstr = "MMS_LOG_PDU";
|
||||
SD_CONST ST_CHAR *SD_CONST _mms_log_config_logstr = "MMS_LOG_CONFIG";
|
||||
SD_CONST ST_CHAR *SD_CONST _mms_log_always_logstr = "MMS_LOG_ALWAYS";
|
||||
|
||||
SD_CONST ST_CHAR *SD_CONST _user_err_logstr = "USER_LOG_ERR";
|
||||
SD_CONST ST_CHAR *SD_CONST _user_client_logstr = "USER_LOG_CLIENT";
|
||||
SD_CONST ST_CHAR *SD_CONST _user_server_logstr = "USER_LOG_SERVER";
|
||||
|
||||
LOGCFGX_VALUE_MAP mmsLogMaskMaps[] =
|
||||
{
|
||||
{"MMS_LOG_ERR", MMS_LOG_ERR, &mms_debug_sel, _LOGCFG_DATATYPE_UINT_MASK, NULL, "Error"},
|
||||
{"MMS_LOG_NERR", MMS_LOG_NERR, &mms_debug_sel, _LOGCFG_DATATYPE_UINT_MASK, NULL, "Notice"},
|
||||
{"MMS_LOG_DEC", MMS_LOG_DEC, &mms_debug_sel, _LOGCFG_DATATYPE_UINT_MASK, NULL, "Decode"},
|
||||
{"MMS_LOG_ENC", MMS_LOG_ENC, &mms_debug_sel, _LOGCFG_DATATYPE_UINT_MASK, NULL, "Encode"},
|
||||
|
||||
{"MMS_LOG_CLIENT", MMS_LOG_REQ|MMS_LOG_CONF, &mms_debug_sel, _LOGCFG_DATATYPE_UINT_MASK, NULL, "Client"},
|
||||
{"MMS_LOG_SERVER", MMS_LOG_IND|MMS_LOG_RESP, &mms_debug_sel, _LOGCFG_DATATYPE_UINT_MASK, NULL, "Server"},
|
||||
|
||||
{"MMS_LOG_REQ", MMS_LOG_REQ, &mms_debug_sel, _LOGCFG_DATATYPE_UINT_MASK, NULL, "Request"},
|
||||
{"MMS_LOG_RESP", MMS_LOG_RESP, &mms_debug_sel, _LOGCFG_DATATYPE_UINT_MASK, NULL, "Response"},
|
||||
{"MMS_LOG_IND", MMS_LOG_IND, &mms_debug_sel, _LOGCFG_DATATYPE_UINT_MASK, NULL, "Indication"},
|
||||
{"MMS_LOG_CONF", MMS_LOG_CONF, &mms_debug_sel, _LOGCFG_DATATYPE_UINT_MASK, NULL, "Confirm"},
|
||||
{"MMS_LOG_RT", MMS_LOG_RT, &mms_debug_sel, _LOGCFG_DATATYPE_UINT_MASK, NULL, "RuntimeType"},
|
||||
{"MMS_LOG_RTAA", MMS_LOG_RTAA, &mms_debug_sel, _LOGCFG_DATATYPE_UINT_MASK, NULL, "RuntimeAlternateAccess"},
|
||||
{"MMS_LOG_AA", MMS_LOG_AA, &mms_debug_sel, _LOGCFG_DATATYPE_UINT_MASK, NULL, "AlternateAccess"},
|
||||
};
|
||||
|
||||
LOGCFG_VALUE_GROUP mmsLogMaskMapCtrl =
|
||||
{
|
||||
{NULL,NULL},
|
||||
"MmsLogMasks", /* Parent Tag */
|
||||
sizeof(mmsLogMaskMaps)/sizeof(LOGCFGX_VALUE_MAP),
|
||||
mmsLogMaskMaps
|
||||
};
|
||||
|
||||
LOGCFGX_VALUE_MAP usrLogMaskMaps[] =
|
||||
{
|
||||
{"USER_LOG_ERR", USER_LOG_ERR, &user_debug_sel, _LOGCFG_DATATYPE_UINT_MASK, NULL, "Error"},
|
||||
{"USER_LOG_CLIENT", USER_LOG_CLIENT, &user_debug_sel, _LOGCFG_DATATYPE_UINT_MASK, NULL, "Client"},
|
||||
{"USER_LOG_SERVER", USER_LOG_SERVER, &user_debug_sel, _LOGCFG_DATATYPE_UINT_MASK, NULL, "Server"}
|
||||
};
|
||||
|
||||
LOGCFG_VALUE_GROUP usrLogMaskMapCtrl =
|
||||
{
|
||||
{NULL,NULL},
|
||||
"UserLogMasks", /* Parent Tag */
|
||||
sizeof(usrLogMaskMaps)/sizeof(LOGCFGX_VALUE_MAP),
|
||||
usrLogMaskMaps
|
||||
};
|
||||
#endif /* DEBUG_SISCO */
|
||||
|
||||
/************************************************************************/
|
||||
/* m_init_glb_vars */
|
||||
/************************************************************************/
|
||||
|
||||
#if defined(NO_GLB_VAR_INIT)
|
||||
ST_VOID a_init_glb_vars (ST_VOID);
|
||||
|
||||
ST_VOID m_init_glb_vars (ST_VOID)
|
||||
{
|
||||
a_init_glb_vars ();
|
||||
mmsl_version = 1;
|
||||
mmsl_invoke_id = 1;
|
||||
_mmsdec_ctxt = MMS_PCI;
|
||||
m_max_mods = 1;
|
||||
mms_debug_sel = MMS_LOG_ERR;
|
||||
#if defined(NO_GLB_VAR_INIT)
|
||||
if (!m_data_algn_tbl)
|
||||
m_data_algn_tbl = m_packed_data_algn_tbl;
|
||||
#endif
|
||||
m_max_dec_aa = 50;
|
||||
m_max_rt_aa_ctrl = 1000;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
205
mmslib/mmsl/mmsstat.c
Normal file
205
mmslib/mmsl/mmsstat.c
Normal file
@@ -0,0 +1,205 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : mmsstat.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the common functions to perform the decode */
|
||||
/* of a status response or an unsolicited status request, which */
|
||||
/* have identical syntax. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 06 Remove "thisFileName" */
|
||||
/* 03/31/03 JRB 05 asn1r_get_bitstr: add max_bits arg. */
|
||||
/* 12/20/01 JRB 04 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 03 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 02 Changes to decode buffer allocation scheme */
|
||||
/* 07/03/97 MDE 01 Op-specific info buffer handling changes */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pvmd.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
static STATUS_RESP_INFO *info;
|
||||
|
||||
static ST_VOID local_detail_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID get_local_detail_prim (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID get_local_detail_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID get_physical_stat (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID get_logical_stat (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_status */
|
||||
/* This function is called from mms_status_rsp (in rq_stat.c) or from */
|
||||
/* mms_ustatus_req (in rs_ustat.c) to decode either a Status response */
|
||||
/* PDU or an UnsolicitedStatus request PDU after the PDU type has been */
|
||||
/* determined. It sets up the parse of the next data element and */
|
||||
/* returns, letting the ASN.1 tools take over. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_status (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
/* Create status_resp_info structure data area to put decoded info into.*/
|
||||
info = (STATUS_RESP_INFO *) _m_get_dec_buf (aCtx, sizeof (STATUS_RESP_INFO));
|
||||
|
||||
/* (NOTE: A structure of typp_info is excactly the same as */
|
||||
/* a structure of type ustat so this logic works with both */
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX,0,get_logical_stat);/* Set up to parse 1st param.*/
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* get_logical_stat */
|
||||
/* The logical status parameter has been encountered. Read its value. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID get_logical_stat (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT high_lim;
|
||||
|
||||
MLOG_CDEC0 ("get_logical_stat");
|
||||
|
||||
if (asn1r_get_i16 (aCtx, &info->logical_stat)) /* Read logical status. */
|
||||
{ /* If error reading integer, */
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE); /* stop parse, report error */
|
||||
return; /* and return. */
|
||||
}
|
||||
|
||||
#ifndef MMS_LITE
|
||||
if (mms_chan_info[_mmsdechan].version) /* IS */
|
||||
#else
|
||||
if (mmsl_version) /* IS */
|
||||
#endif
|
||||
high_lim = 3;
|
||||
else /* DIS */
|
||||
high_lim = 2;
|
||||
|
||||
if ((info->logical_stat < 0) || (info->logical_stat > high_lim))
|
||||
{ /* validate range of values */
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
/* The next data element expected is the physical status. */
|
||||
ASN1R_TAG_ADD (aCtx, CTX,1,get_physical_stat);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* get_physical_stat */
|
||||
/* The physical status parameter has been encountered. Read its value. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID get_physical_stat (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("get_physical_stat");
|
||||
|
||||
/* Get the value of the physical status parameter. */
|
||||
|
||||
if (asn1r_get_i16 (aCtx, &info->physical_stat)) /* Read physical status. */
|
||||
{ /* If error reading integer, */
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE); /* stop parse, report error */
|
||||
return; /* and return. */
|
||||
}
|
||||
|
||||
if ((info->physical_stat < 0) || (info->physical_stat > 3))
|
||||
{ /* validate range [0..3] */
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
/* The next data element is either the local detail parameter or the */
|
||||
/* additional detail parameter, or there may be no other data elements. */
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX,2,get_local_detail_prim);
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,2,get_local_detail_cstr);
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* get_local_detail_prim */
|
||||
/* The local detail parameter has been encountered as a primitive data */
|
||||
/* element. Read its value. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID get_local_detail_prim (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("get_local_detail_prim");
|
||||
|
||||
/* Get the value of the local detail parameter. */
|
||||
|
||||
if (aCtx->asn1r_elmnt_len <= MAX_IDENT_LEN)/* check length before moving data */
|
||||
{
|
||||
if (!asn1r_get_bitstr (aCtx, info->local_detail, sizeof(info->local_detail)*8))
|
||||
{ /* If everything is kosher, */
|
||||
local_detail_done (aCtx); /* set up for the next data element. */
|
||||
return; /* Return success and continue parse. */
|
||||
}
|
||||
}
|
||||
|
||||
/* Problem getting value - stop parse and report error. */
|
||||
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* get_local_detail_cstr */
|
||||
/* The local detail parameter has been encountered as a constructor */
|
||||
/* data element. Read its value. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID get_local_detail_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("get_local_detail_cstr");
|
||||
|
||||
/* Set up to call this function when done with constructor bitstring. */
|
||||
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = local_detail_done;
|
||||
|
||||
/* Get the value of the local detail parameter. For constructor */
|
||||
/* bitstrings, this requires returning and letting the ASN.1 tools */
|
||||
/* parse it to any nesting level. */
|
||||
|
||||
asn1r_get_bitstr_cstr (aCtx, 16,info->local_detail);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* local_detail_done */
|
||||
/* Function called after the local_detail parameter has been parsed. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID local_detail_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
info -> local_detail_pres = SD_TRUE;
|
||||
info -> local_detail_len = aCtx->asn1r_bitcount;
|
||||
|
||||
/* The next data element, if there is one, is the additional detail */
|
||||
/* parameter. */
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
442
mmslib/mmsl/ms_ext.c
Normal file
442
mmslib/mmsl/ms_ext.c
Normal file
@@ -0,0 +1,442 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : ms_ext.c */
|
||||
/* PRODUCT(S) : MMSEASE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 04 Cleaned up "thisFileName" */
|
||||
/* 03/31/03 JRB 03 asn1r_get_bitstr: add max_bits arg. */
|
||||
/* 12/20/01 JRB 02 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 01 Added SD_CONST modifiers */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
#include "glbsem.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* For debug version, use a static pointer to avoid duplication of */
|
||||
/* __FILE__ strings. */
|
||||
|
||||
#if defined(DEBUG_SISCO) && defined(S_MT_SUPPORT)
|
||||
SD_CONST static ST_CHAR *SD_CONST thisFileName = __FILE__;
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID ms_get_extern (ASN1_DEC_CTXT *aCtx, EXTERN_INFO *dest);
|
||||
|
||||
static EXTERN_INFO *ext_dest;
|
||||
|
||||
static ST_VOID ext_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID ext_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
static ST_INT save_method; /* storage for decode method */
|
||||
|
||||
/************************************************************************/
|
||||
/* ms_decode_extern */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET ms_decode_extern (ST_UCHAR *asn1ptr, ST_INT asn1len,
|
||||
EXTERN_INFO *dest)
|
||||
{
|
||||
ST_RET ret;
|
||||
ASN1_DEC_CTXT localDecCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_DEC_CTXT *aCtx = &localDecCtx;
|
||||
|
||||
memset (aCtx, 0, sizeof (ASN1_DEC_CTXT)); /* CRITICAL: start clean. */
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
aCtx->asn1r_decode_method = ASN1_TAG_METHOD; /* select tag method */
|
||||
aCtx->asn1r_decode_done_fun = asn1r_done_err;/* not legal to be done at this time */
|
||||
aCtx->asn1r_err_fun = NULL;
|
||||
|
||||
ext_dest = dest;
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, UNI|CONSTR, EXTERN_CODE, ext_cstr);
|
||||
asn1r_decode_asn1 (aCtx, asn1ptr,asn1len);/* decode entire ASN.1 'Data' entity */
|
||||
|
||||
if (aCtx->asn1r_pdu_dec_err == NO_DECODE_ERR) /* check for sucess or return error */
|
||||
ret = SD_SUCCESS;
|
||||
else
|
||||
ret = MVE_DATA_CONVERT;
|
||||
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* ext_cstr */
|
||||
/* This function is called when an 'EXTERNAL' data element has been */
|
||||
/* found. It will put info into the selected structure. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID ext_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ms_get_extern (aCtx, ext_dest);
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = ext_cstr_done;
|
||||
}
|
||||
|
||||
|
||||
static ST_VOID ext_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
aCtx->asn1r_decode_done = SD_TRUE;
|
||||
aCtx->asn1r_decode_done_fun = NULL;
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
|
||||
static EXTERN_INFO *ext_info_ptr;
|
||||
static ST_VOID get_dir_ref (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID get_indir_ref (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID get_objdesc (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID get_sngl_asn1 (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID sngl_parse_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID sngl_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID get_oct_alignd_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID get_oct_alignd_prim (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID oct_alignd_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID get_arb_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID get_arb_prim (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID arb_done (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* ms_get_extern */
|
||||
/* This function is called when an 'EXTERNAL' data element has been */
|
||||
/* found. It will put info into the selected structure. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID ms_get_extern (ASN1_DEC_CTXT *aCtx, EXTERN_INFO *dest)
|
||||
{
|
||||
save_method = aCtx->asn1r_decode_method; /* use class method */
|
||||
aCtx->asn1r_decode_method = ASN1_TAG_METHOD;
|
||||
|
||||
ext_info_ptr = dest; /* save the destination */
|
||||
ext_info_ptr -> dir_ref_pres = SD_FALSE; /* clear pres flag */
|
||||
ext_info_ptr -> indir_ref_pres = SD_FALSE; /* clear pres flag */
|
||||
ext_info_ptr -> dv_descr_pres = SD_FALSE; /* clear present flag */
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, UNI,OBJ_ID_CODE,get_dir_ref); /* transfer syntax name */
|
||||
ASN1R_TAG_ADD (aCtx, UNI,INT_CODE,get_indir_ref); /* PCI */
|
||||
ASN1R_TAG_ADD (aCtx, UNI,OBJDSCR_CODE,get_objdesc); /* object descripter */
|
||||
/* Data Types */
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,0,get_sngl_asn1); /* single asn1 type */
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,1,get_oct_alignd_cstr); /* oct alignd, cstr */
|
||||
ASN1R_TAG_ADD (aCtx, CTX,1,get_oct_alignd_prim); /* oct alignd, prim */
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,2,get_arb_cstr); /* arbitrary, cstr */
|
||||
ASN1R_TAG_ADD (aCtx, CTX,2,get_arb_prim); /* arbitrary, prim */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* get_dir_ref */
|
||||
/* This is the function called when : */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID get_dir_ref (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("get_dir_ref");
|
||||
|
||||
ext_info_ptr->dir_ref_pres = SD_TRUE; /* mark present */
|
||||
|
||||
if (asn1r_get_objid (aCtx, ext_info_ptr->dir_ref.comps,
|
||||
&ext_info_ptr->dir_ref.num_comps))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, UNI,INT_CODE,get_indir_ref); /* indir ref maybe */
|
||||
ASN1R_TAG_ADD (aCtx, UNI,OBJDSCR_CODE,get_objdesc); /* object descripter */
|
||||
/* Data Types */
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,0,get_sngl_asn1); /* single asn1 type */
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,1,get_oct_alignd_cstr); /* oct alignd, cstr */
|
||||
ASN1R_TAG_ADD (aCtx, CTX,1,get_oct_alignd_prim); /* oct alignd, prim */
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,2,get_arb_cstr); /* arbitrary, cstr */
|
||||
ASN1R_TAG_ADD (aCtx, CTX,2,get_arb_prim); /* arbitrary, prim */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* get_indir_ref */
|
||||
/* This is the function called when the PCI element of a PDV is found */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID get_indir_ref (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("get_indir_ref");
|
||||
|
||||
if (asn1r_get_i32 (aCtx, &ext_info_ptr->indir_ref)) /* If out of range for us */
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
else
|
||||
{
|
||||
ext_info_ptr->indir_ref_pres = SD_TRUE;
|
||||
ASN1R_TAG_ADD (aCtx, UNI,OBJDSCR_CODE,get_objdesc); /* object descripter */
|
||||
/* Data Types */
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,0,get_sngl_asn1); /* single asn1 type */
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,1,get_oct_alignd_cstr); /* oct alignd, cstr */
|
||||
ASN1R_TAG_ADD (aCtx, CTX,1,get_oct_alignd_prim); /* oct alignd, prim */
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,2,get_arb_cstr); /* arbitrary, cstr */
|
||||
ASN1R_TAG_ADD (aCtx, CTX,2,get_arb_prim); /* arbitrary, prim */
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* get_objdesc */
|
||||
/* This is the function called when the PCI element of a PDV is found */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID get_objdesc (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("get_objdesc");
|
||||
|
||||
ext_info_ptr->dv_descr_pres = SD_TRUE; /* mark present */
|
||||
ext_info_ptr->dv_descr_len = aCtx->asn1r_elmnt_len; /* len of string */
|
||||
ext_info_ptr->dv_descr = aCtx->asn1r_field_ptr; /* leave it lie */
|
||||
aCtx->asn1r_field_ptr += aCtx->asn1r_elmnt_len; /* skip over */
|
||||
|
||||
/* set up to get presentation data values - choice of three */
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,0,get_sngl_asn1); /* single asn1 type */
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,1,get_oct_alignd_cstr); /* oct alignd, cstr */
|
||||
ASN1R_TAG_ADD (aCtx, CTX,1,get_oct_alignd_prim); /* oct alignd, prim */
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,2,get_arb_cstr); /* arbitrary, cstr */
|
||||
ASN1R_TAG_ADD (aCtx, CTX,2,get_arb_prim); /* arbitrary, prim */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* get_sngl_asn1 */
|
||||
/* This is the function called when : */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID get_sngl_asn1 (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("get_sngl_asn1");
|
||||
|
||||
/* aCtx->asn1r_field_ptr points to 'any', elmnt is length of data */
|
||||
ext_info_ptr->encoding_tag = 0; /* write tag */
|
||||
ext_info_ptr->data_len = aCtx->asn1r_elmnt_len; /* len of ANY */
|
||||
ext_info_ptr->data_ptr = aCtx->asn1r_field_ptr; /* leave it lie */
|
||||
|
||||
asn1r_parse_next (aCtx, sngl_parse_done);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* sngl_parse_done */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID sngl_parse_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("sngl_parse_done");
|
||||
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = sngl_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* sngl_done */
|
||||
/* This is the cstr done function called when : */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID sngl_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("sngl_done");
|
||||
|
||||
aCtx->asn1r_decode_method = save_method; /* this extern is now done */
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* get_oct_alignd_prim */
|
||||
/* This is the function called when : */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID get_oct_alignd_prim (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("get_oct_alignd_prim");
|
||||
|
||||
/* aCtx->asn1r_elmnt_len == # octects */
|
||||
|
||||
ext_info_ptr->encoding_tag = 1; /* write tag */
|
||||
ext_info_ptr->data_len = aCtx->asn1r_elmnt_len; /* len of ANY */
|
||||
ext_info_ptr->data_ptr = aCtx->asn1r_field_ptr; /* leave it lie */
|
||||
|
||||
aCtx->asn1r_field_ptr += aCtx->asn1r_elmnt_len; /* skip over data */
|
||||
|
||||
aCtx->asn1r_decode_method = save_method; /* this extern is now done */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* get_oct_alignd_cstr */
|
||||
/* This is the function called when : */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID get_oct_alignd_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("get_oct_alignd_cstr");
|
||||
|
||||
ext_info_ptr->encoding_tag = 1; /* write tag */
|
||||
ext_info_ptr->data_ptr = aCtx->asn1r_field_ptr; /* leave it lie */
|
||||
asn1r_get_octstr_cstr (aCtx, ASN1_MAX_PDU, aCtx->asn1r_field_ptr);
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = oct_alignd_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* oct_alignd_done */
|
||||
/* This is the cstr done function called when : */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID oct_alignd_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("oct_alignd_done");
|
||||
|
||||
ext_info_ptr->data_len = aCtx->asn1r_octetcount; /* len of octet string */
|
||||
aCtx->asn1r_decode_method = save_method; /* this extern is now done */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* get_arb_prim */
|
||||
/* This is the function called when : */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID get_arb_prim (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("get_arb_prim");
|
||||
|
||||
/* aCtx->asn1r_bitcount = bits */
|
||||
|
||||
ext_info_ptr->encoding_tag = 2; /* write tag */
|
||||
ext_info_ptr->data_len = aCtx->asn1r_elmnt_len-1; /* len of ANY */
|
||||
ext_info_ptr->data_ptr = aCtx->asn1r_field_ptr; /* leave it lie */
|
||||
asn1r_get_bitstr (aCtx, aCtx->asn1r_field_ptr,0); /* max_bits=0 (no limit)*/
|
||||
ext_info_ptr->num_bits = aCtx->asn1r_bitcount;
|
||||
aCtx->asn1r_decode_method = save_method; /* this extern is now done */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* get_arb_cstr */
|
||||
/* This is the function called when : */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID get_arb_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("get_arb_cstr");
|
||||
|
||||
ext_info_ptr->encoding_tag = 2; /* write tag */
|
||||
ext_info_ptr->data_ptr = aCtx->asn1r_field_ptr; /* leave it lie */
|
||||
|
||||
asn1r_get_bitstr_cstr (aCtx, ASN1_MAX_PDU, aCtx->asn1r_field_ptr);
|
||||
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = arb_done;
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* arb_done */
|
||||
/* This is the cstr done function called when : */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID arb_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("arb_done");
|
||||
|
||||
ext_info_ptr->num_bits = aCtx->asn1r_bitcount;
|
||||
ext_info_ptr->data_len = CALC_BIT_LEN (aCtx->asn1r_bitcount);
|
||||
aCtx->asn1r_decode_method = save_method; /* this extern is now done */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* ms_encode_extern */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET ms_encode_extern (EXTERN_INFO *ext, ST_UCHAR *dest, ST_INT dest_len,
|
||||
ST_INT *ext_len, ST_UCHAR **ext_ptr)
|
||||
{
|
||||
ST_RET ret;
|
||||
ASN1_ENC_CTXT localEncCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_ENC_CTXT *aCtx = &localEncCtx;
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
asn1r_strt_asn1_bld (aCtx, dest,dest_len); /* init the builder */
|
||||
wr_external (aCtx, ext);
|
||||
|
||||
*ext_ptr = aCtx->asn1r_field_ptr + 1;
|
||||
*ext_len = (dest+dest_len) - *ext_ptr;
|
||||
|
||||
if (!aCtx->asn1r_encode_overrun) /* Check for encode overrun */
|
||||
ret = SD_SUCCESS;
|
||||
else
|
||||
ret = ME_ASN1_ENCODE_OVERRUN;
|
||||
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* wr_external */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID wr_external (ASN1_ENC_CTXT *aCtx, EXTERN_INFO *ext)
|
||||
{
|
||||
asn1r_strt_constr (aCtx); /* start EXTERNAL */
|
||||
|
||||
if (ext->encoding_tag == 0) /* ANY */
|
||||
{
|
||||
asn1r_wr_octstr (aCtx, ext->data_ptr,ext->data_len);
|
||||
asn1r_fin_constr (aCtx, 0,CTX,DEF);
|
||||
}
|
||||
else if (ext->encoding_tag == 1) /* Octet Aligned */
|
||||
{
|
||||
asn1r_wr_octstr (aCtx, ext->data_ptr,ext->data_len);
|
||||
asn1r_fin_prim (aCtx, 1,CTX); /* finish octet-aligned string */
|
||||
}
|
||||
else if (ext->encoding_tag == 2) /* Arbitrary */
|
||||
{
|
||||
asn1r_wr_bitstr (aCtx, ext->data_ptr,ext->num_bits);
|
||||
asn1r_fin_prim (aCtx, 2,CTX);
|
||||
}
|
||||
|
||||
if (ext->dv_descr_pres)
|
||||
{
|
||||
asn1r_wr_octstr (aCtx, ext->dv_descr,ext->dv_descr_len);
|
||||
asn1r_fin_prim (aCtx, OBJDSCR_CODE,UNI); /* object descripter */
|
||||
}
|
||||
|
||||
if (ext->indir_ref_pres)
|
||||
{
|
||||
asn1r_wr_i32 (aCtx, ext->indir_ref);
|
||||
asn1r_fin_prim (aCtx, INT_CODE,UNI);
|
||||
}
|
||||
|
||||
if (ext->dir_ref_pres)
|
||||
{
|
||||
asn1r_wr_objid (aCtx, ext->dir_ref.comps,ext->dir_ref.num_comps);
|
||||
asn1r_fin_prim (aCtx, OBJ_ID_CODE,UNI);
|
||||
}
|
||||
|
||||
asn1r_fin_constr (aCtx, EXTERN_CODE,UNI,DEF); /* finish EXTERNAL */
|
||||
}
|
||||
|
||||
|
||||
600
mmslib/mmsl/ms_size.c
Normal file
600
mmslib/mmsl/ms_size.c
Normal file
@@ -0,0 +1,600 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : ms_size.c */
|
||||
/* PRODUCT(S) : MMSEASE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains support functions for estimating maximum */
|
||||
/* size of Variable Access service PDUs (Read, Write, and InfoRpt).*/
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 04/14/03 JRB 09 Eliminate compiler warnings. */
|
||||
/* 04/02/03 JRB 08 Add UTF8string support (see RT_UTF8_STRING). */
|
||||
/* 11/14/01 EJV 07 Added support for new MMS type UtcTime: */
|
||||
/* ms_data_size: added case for RT_UTC_TIME */
|
||||
/* 10/18/00 RKR 06 Changed RT_UNSIGNED in ms_data_size */
|
||||
/* 09/15/00 MDE 05 Fixed MMS-EASE compile error */
|
||||
/* 09/07/00 MDE 04 Added MMS-LITE support */
|
||||
/* 02/10/98 MDE 03 Now don't use runtime type loops element */
|
||||
/* 08/15/97 MDE 02 Minor cleanup */
|
||||
/* 06/09/97 MDE 01 Changed Runtime Type, and it's use */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
#include "glbsem.h"
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pvar.h"
|
||||
#include "mms_vvar.h"
|
||||
#include "asn1defs.h"
|
||||
#if defined(MMS_LITE)
|
||||
#include "mvl_defs.h"
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/* For debug version, use a static pointer to avoid duplication of */
|
||||
/* __FILE__ strings. */
|
||||
|
||||
#if defined(DEBUG_SISCO) && defined(S_MT_SUPPORT)
|
||||
static ST_CHAR *thisFileName = __FILE__;
|
||||
#endif
|
||||
|
||||
static ST_LONG address_size (VAR_ACC_ADDR *address, ST_BOOLEAN req);
|
||||
static ST_LONG obj_name_size (OBJECT_NAME *name, ST_BOOLEAN req);
|
||||
static ST_LONG ms_data_size (RUNTIME_TYPE *rt_ptr, ST_INT rt_num,
|
||||
ST_INT alt_len, ST_UCHAR *alt_ptr,
|
||||
ST_BOOLEAN req);
|
||||
|
||||
static ST_INT arr_loop_level;
|
||||
static ST_INT *arr_loops;
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* To allow the user to specify either MMS-EASE or UNKNOWN PDU style, */
|
||||
/* the following definitions & data structures are used. */
|
||||
/* See ms_size.doc for information on how these were derived. */
|
||||
|
||||
ST_INT ms_req_bld_id = UNKNOWN_BUILDER;
|
||||
ST_INT ms_resp_bld_id = UNKNOWN_BUILDER;
|
||||
|
||||
/* Because the MMS-EASE ASN.1 tools are a bit conservitive, need to */
|
||||
/* provide for a little extra overhead. */
|
||||
ST_INT ms_size_oh_pad = ASN1_MAX_ELEMENT_OVERHEAD;
|
||||
|
||||
ST_LONG large_el_oh[] =
|
||||
{
|
||||
6L, /* MMS-EASE is PDU Builder */
|
||||
8L /* UNKNOWN PDU Builder */
|
||||
};
|
||||
ST_LONG med_el_oh[] =
|
||||
{
|
||||
4L, /* MMS-EASE is PDU Builder */
|
||||
8L /* UNKNOWN PDU Builder */
|
||||
};
|
||||
ST_LONG small_el_oh[] =
|
||||
{
|
||||
2L, /* MMS-EASE is PDU Builder */
|
||||
8L /* UNKNOWN PDU Builder */
|
||||
};
|
||||
|
||||
#define LARGE_EL_REQ_OH large_el_oh[ms_req_bld_id]
|
||||
#define MED_EL_REQ_OH med_el_oh[ms_req_bld_id]
|
||||
#define SMALL_EL_REQ_OH small_el_oh[ms_req_bld_id]
|
||||
|
||||
#define LARGE_EL_RESP_OH large_el_oh[ms_resp_bld_id]
|
||||
#define MED_EL_RESP_OH med_el_oh[ms_resp_bld_id]
|
||||
#define SMALL_EL_RESP_OH small_el_oh[ms_resp_bld_id]
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* Overhead for various types of MMS ASN.1 data elements */
|
||||
|
||||
|
||||
#define CONF_REQ_PDU_OH (ms_size_oh_pad+MED_EL_REQ_OH+SMALL_EL_REQ_OH+4)
|
||||
#define CONF_RESP_PDU_OH (ms_size_oh_pad+MED_EL_RESP_OH+SMALL_EL_RESP_OH+4)
|
||||
#define UNCONF_PDU_OH (ms_size_oh_pad+MED_EL_REQ_OH)
|
||||
|
||||
/* Overhead for empty PDU's of various types */
|
||||
#define READ_REQ_OH (CONF_REQ_PDU_OH + (MED_EL_REQ_OH * 2))
|
||||
#define READ_RESP_OH (CONF_RESP_PDU_OH + (MED_EL_RESP_OH * 2))
|
||||
#define WRITE_REQ_OH (CONF_REQ_PDU_OH + (MED_EL_REQ_OH * 2))
|
||||
#define WRITE_RESP_OH (CONF_RESP_PDU_OH + MED_EL_RESP_OH)
|
||||
#define INFO_REQ_OH (UNCONF_PDU_OH + (MED_EL_REQ_OH * 2))
|
||||
|
||||
/* Overhead for various components of interest */
|
||||
#define SPEC_IN_RSLT_SIZE (MED_EL_REQ_OH + 1)
|
||||
|
||||
/* Object name overhead */
|
||||
#define VMD_OBJ_NAME_REQ_OH SMALL_EL_REQ_OH
|
||||
#define DOM_OBJ_NAME_REQ_OH (MED_EL_REQ_OH + (SMALL_EL_REQ_OH * 2))
|
||||
#define AA_OBJ_NAME_REQ_OH SMALL_EL_REQ_OH
|
||||
|
||||
#define VMD_OBJ_NAME_RESP_OH SMALL_EL_RESP_OH
|
||||
#define DOM_OBJ_NAME_RESP_OH (MED_EL_RESP_OH + (SMALL_EL_RESP_OH * 2))
|
||||
#define AA_OBJ_NAME_RESP_OH SMALL_EL_RESP_OH
|
||||
|
||||
|
||||
#define GENTIME_LEN 18L
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
|
||||
/************************************************************************/
|
||||
/* ms_init_va_size */
|
||||
/* This function is called from the user as a first step in estimating */
|
||||
/* the maximum size of both the request and response PDUs of any of the */
|
||||
/* Variable Access services (Read, Write, and InformationReport). This */
|
||||
/* function initializes the values pointed to by req_size and resp_size */
|
||||
/* to the overhead in the PDU (before determining the size of the data */
|
||||
/* and specification of each variable to be included). The companion */
|
||||
/* function ms_va_size is then called for each variable to add on the */
|
||||
/* estimated size attributable to that variable. This function returns */
|
||||
/* 0 for success, else an error code. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET ms_init_va_size (ST_INT op, ST_UCHAR spec_in_rslt, ST_INT16 var_acc_tag,
|
||||
OBJECT_NAME *vl_name, ST_LONG *req_size, ST_LONG *resp_size)
|
||||
{
|
||||
ST_RET ret;
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
ret = SD_SUCCESS;
|
||||
switch (op)
|
||||
{
|
||||
case MMSOP_READ:
|
||||
/* initialize sizes to include all overhead for basic request */
|
||||
*req_size = READ_REQ_OH;
|
||||
*resp_size = READ_RESP_OH;
|
||||
|
||||
/* To send request for spec in result takes extra bytes, do does */
|
||||
/* sending the VA spec in the response. */
|
||||
if (spec_in_rslt)
|
||||
{
|
||||
*req_size += SPEC_IN_RSLT_SIZE;
|
||||
*resp_size += MED_EL_RESP_OH;
|
||||
}
|
||||
break;
|
||||
|
||||
case MMSOP_WRITE:
|
||||
/* initialize sizes to include all overhead for basic request */
|
||||
*req_size = WRITE_REQ_OH;
|
||||
*resp_size = WRITE_RESP_OH;
|
||||
break;
|
||||
|
||||
case MMSOP_INFO_RPT:
|
||||
/* initialize sizes to include all overhead for basic request */
|
||||
*req_size = INFO_REQ_OH;
|
||||
*resp_size = 0;
|
||||
break;
|
||||
|
||||
default :
|
||||
ret = MVE_WRONG_OP;
|
||||
}
|
||||
|
||||
/* If the variable specification is a named list, add in the name, else */
|
||||
/* add in the sequence of sequence constructor overhead */
|
||||
/* Note that this is done here, NOT in later calls to ms_va_size */
|
||||
|
||||
if (var_acc_tag == VAR_ACC_NAMEDLIST) /* list of variables case */
|
||||
*req_size += MED_EL_REQ_OH + obj_name_size (vl_name,SD_TRUE);
|
||||
else
|
||||
*req_size += MED_EL_REQ_OH; /* seq of seq */
|
||||
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* ms_va_size */
|
||||
/* This function is called from the user repetitively for each variable */
|
||||
/* expected to be included in a Read, Write, or InfoRpt PDU. Note that */
|
||||
/* the function ms_init_va_size should be called first to initialize */
|
||||
/* the two outputs req_size and resp_size. The values pointed to by */
|
||||
/* req_size and resp_size are incremented by the appropriate amount, */
|
||||
/* so that after this function has been called for all variables, they */
|
||||
/* represent valid estimates of the size of the request and response */
|
||||
/* PDUs for the given service (indicated by op). In some cases, the */
|
||||
/* type of the variable may be indicated both by the vl_ptr argument */
|
||||
/* and by the type argument; in this case, both must still be specified */
|
||||
/* and it is up to the user to verify that they are equal. This */
|
||||
/* function returns 0 for success, else an error code. */
|
||||
/* */
|
||||
/* NOTE: In the case of accessing a variable list object (as opposed */
|
||||
/* to a list of variable objects), a variable_list structure must */
|
||||
/* be built and filled in appropriately, with var_spec_tag set to */
|
||||
/* 5. (Otherwise, the value pointed to by req_size and, in */
|
||||
/* certain cases, the value pointed to by resp_size will be */
|
||||
/* much larger than necessary. */
|
||||
/************************************************************************/
|
||||
|
||||
#if !defined(MMS_LITE)
|
||||
ST_RET ms_va_size (ST_INT op, ST_UCHAR spec_in_rslt, ST_INT16 var_acc_tag,
|
||||
VARIABLE_LIST *vl_ptr, NAMED_TYPE *type,
|
||||
ST_LONG *req_size, ST_LONG *resp_size)
|
||||
#else
|
||||
ST_RET ms_va_size (ST_INT op, ST_UCHAR spec_in_rslt, ST_INT16 var_acc_tag,
|
||||
VARIABLE_LIST *vl_ptr, ST_INT type_id,
|
||||
ST_LONG *req_size, ST_LONG *resp_size)
|
||||
#endif
|
||||
{
|
||||
ST_LONG size;
|
||||
ST_INT alt_acc_len;
|
||||
RUNTIME_TYPE *rt;
|
||||
ST_INT rt_num;
|
||||
#if defined(MMS_LITE)
|
||||
ST_INT rc;
|
||||
#endif
|
||||
|
||||
#if !defined(MMS_LITE)
|
||||
rt = type->rt_head;
|
||||
rt_num = type->rt_num;
|
||||
#else
|
||||
rc = mvl_get_runtime (type_id, &rt, &rt_num);
|
||||
if (rc != SD_SUCCESS)
|
||||
return (rc);
|
||||
#endif
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
|
||||
/* non functional at this time */
|
||||
if (vl_ptr->alt_access_pres)
|
||||
alt_acc_len = vl_ptr->alt_access.len;
|
||||
else
|
||||
alt_acc_len = 0;
|
||||
|
||||
/* get the size of the data element based on the MMS type and add the */
|
||||
/* data element size to the target PDU */
|
||||
|
||||
if (op == MMSOP_READ) /* read response carries data */
|
||||
{
|
||||
size = ms_data_size (rt, rt_num, alt_acc_len,
|
||||
vl_ptr->alt_access.data,SD_FALSE);
|
||||
*resp_size += size;
|
||||
}
|
||||
else /* WRITE or INFO */
|
||||
{
|
||||
size = ms_data_size (rt, rt_num, alt_acc_len,
|
||||
vl_ptr->alt_access.data,SD_TRUE);
|
||||
*req_size += size;
|
||||
|
||||
if (op == MMSOP_WRITE) /* Write response carries result */
|
||||
*resp_size += SMALL_EL_RESP_OH + 1; /* assume failure (+1) */
|
||||
}
|
||||
if (size <= 0) /* verify the data size was OK */
|
||||
{
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (MVE_TYPENAME);
|
||||
}
|
||||
|
||||
/* Now calculate the size of the variable access spec for this var. */
|
||||
/* Only req'd if var_acc_tag is list of vars (list name added already) */
|
||||
if (var_acc_tag == VAR_ACC_VARLIST)
|
||||
{
|
||||
size = MED_EL_REQ_OH;
|
||||
switch (vl_ptr->var_spec.var_spec_tag)
|
||||
{
|
||||
case VA_SPEC_NAMED :
|
||||
size += obj_name_size (&vl_ptr->var_spec.vs.name,SD_TRUE);
|
||||
break;
|
||||
|
||||
#if !defined(MMS_LITE)
|
||||
case VA_SPEC_DESCRIBED : /* described gets address & type */
|
||||
size += type->asn1len +
|
||||
address_size (&vl_ptr->var_spec.vs.address,SD_TRUE);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case VA_SPEC_ADDRESSED :
|
||||
size += address_size (&vl_ptr->var_spec.vs.address,SD_TRUE);
|
||||
break;
|
||||
|
||||
case VA_SPEC_SCATTERED : /* not currently supported */
|
||||
case VA_SPEC_INVALIDATED :
|
||||
default:
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (MVE_VM_SERVICE_NOTSUPP);
|
||||
}
|
||||
|
||||
/* not really supported at this time, leave in anyway */
|
||||
if (vl_ptr->alt_access_pres)
|
||||
size += (ST_LONG) alt_acc_len;
|
||||
|
||||
/* Now we have the variable specification size, add to the request */
|
||||
*req_size += size;
|
||||
|
||||
/* Now, if spec in result requested, calculate VA spec size for resp */
|
||||
if (op == MMSOP_READ && spec_in_rslt)
|
||||
{
|
||||
size = MED_EL_RESP_OH;
|
||||
switch (vl_ptr->var_spec.var_spec_tag)
|
||||
{
|
||||
case VA_SPEC_NAMED :
|
||||
size += obj_name_size (&vl_ptr->var_spec.vs.name,SD_FALSE);
|
||||
break;
|
||||
|
||||
#if !defined(MMS_LITE)
|
||||
case VA_SPEC_DESCRIBED : /* described gets address & type */
|
||||
size += type->asn1len +
|
||||
address_size (&vl_ptr->var_spec.vs.address,SD_FALSE);
|
||||
|
||||
break;
|
||||
#endif
|
||||
|
||||
case VA_SPEC_ADDRESSED :
|
||||
size += address_size (&vl_ptr->var_spec.vs.address,SD_FALSE);
|
||||
break;
|
||||
|
||||
case 5: /* variable list object case */
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (SD_SUCCESS); /* No variable spec. req'd */
|
||||
break;
|
||||
|
||||
case VA_SPEC_SCATTERED : /* not currently supported */
|
||||
case VA_SPEC_INVALIDATED :
|
||||
default:
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (MVE_VM_SERVICE_NOTSUPP);
|
||||
}
|
||||
*resp_size += size;
|
||||
}
|
||||
} /* if VAR_ACC_VARLIST */
|
||||
|
||||
/* Now, if WRITE, need to add write result */
|
||||
|
||||
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* obj_name_size */
|
||||
/* This function is called from ms_init_va_size and ms_va_size to */
|
||||
/* calculate (exactly) the size that a particular object name will take */
|
||||
/* up in a request or response PDU for the Read, Write, and InfoReport */
|
||||
/* services. Returns the size of the object name, or 0 if there is a */
|
||||
/* problem. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_LONG obj_name_size (OBJECT_NAME *name, ST_BOOLEAN req)
|
||||
{
|
||||
ST_LONG oh;
|
||||
|
||||
switch (name->object_tag)
|
||||
{
|
||||
case VMD_SPEC :
|
||||
if (req) /* if calculating for a request */
|
||||
oh = VMD_OBJ_NAME_REQ_OH;
|
||||
else
|
||||
oh = VMD_OBJ_NAME_RESP_OH;
|
||||
|
||||
return (oh + (ST_LONG) strlen (name->obj_name.vmd_spec));
|
||||
break;
|
||||
|
||||
case DOM_SPEC :
|
||||
if (req) /* if calculating for a request */
|
||||
oh = DOM_OBJ_NAME_REQ_OH;
|
||||
else
|
||||
oh = DOM_OBJ_NAME_RESP_OH;
|
||||
|
||||
return (oh + (ST_LONG) (strlen (name->obj_name.item_id) +
|
||||
strlen (name->domain_id)));
|
||||
break;
|
||||
|
||||
case AA_SPEC :
|
||||
if (req) /* if calculating for a request */
|
||||
oh = AA_OBJ_NAME_REQ_OH;
|
||||
else
|
||||
oh = AA_OBJ_NAME_RESP_OH;
|
||||
|
||||
return (oh + (ST_LONG) strlen (name->obj_name.aa_spec));
|
||||
break;
|
||||
}
|
||||
|
||||
mms_op_err = MVE_OBJECT_SCOPE;
|
||||
return (0L); /* indicates error condition */
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* address_size */
|
||||
/* This function is called from ms_va_size to calculate (exactly) the */
|
||||
/* size that a particular address will take up in a request or response */
|
||||
/* PDU for the Read, Write, and InfoReport services. Returns the size */
|
||||
/* of the address, or 0 if there is a problem. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_LONG address_size (VAR_ACC_ADDR *address, ST_BOOLEAN req)
|
||||
{
|
||||
ST_LONG size;
|
||||
ST_LONG numaddr;
|
||||
|
||||
switch (address->addr_tag)
|
||||
{
|
||||
case NUM_ADDR :
|
||||
if (req) /* if calculating for a request */
|
||||
size = SMALL_EL_REQ_OH;
|
||||
else
|
||||
size = SMALL_EL_RESP_OH;
|
||||
numaddr = address->addr.num_addr;
|
||||
if (numaddr < 128L)
|
||||
size += 1;
|
||||
else if (numaddr < 32768L)
|
||||
size += 2;
|
||||
else if (numaddr < 8388608L)
|
||||
size += 3;
|
||||
else
|
||||
size += 4;
|
||||
break;
|
||||
|
||||
case SYM_ADDR :
|
||||
if (req) /* if calculating for a request */
|
||||
size = MED_EL_REQ_OH;
|
||||
else
|
||||
size = MED_EL_RESP_OH;
|
||||
size += strlen (address->addr.sym_addr);
|
||||
break;
|
||||
|
||||
case UNCON_ADDR :
|
||||
if (req) /* if calculating for a request */
|
||||
size = MED_EL_REQ_OH;
|
||||
else
|
||||
size = MED_EL_RESP_OH;
|
||||
size += address->addr.unc_addr.unc_len;
|
||||
break;
|
||||
|
||||
default:
|
||||
mms_op_err = MVE_ADDR;
|
||||
return (0);
|
||||
}
|
||||
return (size);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* ms_data_size */
|
||||
/* This function is called from the user or the MMS-EASE virtual */
|
||||
/* machine to estimate the size that the data corresponding to a */
|
||||
/* particular type will take up in a request or response PDU for the */
|
||||
/* Read, Write, and InfoReport services. Returns the size of the data, */
|
||||
/* or 0 if there is a problem. (A rough error code can be found in */
|
||||
/* mms_op_err; a more detailed one in asn1_pdu_dec_err.) */
|
||||
/* */
|
||||
/* Note: Alternate access may be used to modify a type, thereby */
|
||||
/* affecting the size of the corresponding data. However, */
|
||||
/* the alternate access inputs are disregarded at this time. */
|
||||
/* This will be fixed in a later revision. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_LONG ms_data_size (RUNTIME_TYPE *rt_ptr, ST_INT rt_num,
|
||||
ST_INT alt_len, ST_UCHAR *alt_ptr,
|
||||
ST_BOOLEAN req)
|
||||
{
|
||||
ST_LONG size;
|
||||
RUNTIME_TYPE *rt_end;
|
||||
ST_LONG med_oh;
|
||||
ST_LONG small_oh;
|
||||
ST_UINT ellen;
|
||||
ST_LONG len;
|
||||
ST_INT arr_loop_buf[ASN1_MAX_LEVEL];
|
||||
ST_UINT el_size; /* num bytes to encode data */
|
||||
|
||||
arr_loop_level = 0;
|
||||
arr_loops = arr_loop_buf;
|
||||
|
||||
if (req) /* if calculating for a request */
|
||||
{
|
||||
med_oh = MED_EL_REQ_OH;
|
||||
small_oh = SMALL_EL_REQ_OH;
|
||||
}
|
||||
else /* calculating for response */
|
||||
{
|
||||
med_oh = MED_EL_RESP_OH;
|
||||
small_oh = SMALL_EL_RESP_OH;
|
||||
}
|
||||
|
||||
rt_end = rt_ptr + rt_num; /* end block */
|
||||
|
||||
size = 0;
|
||||
while (rt_ptr < rt_end)
|
||||
{
|
||||
if (rt_ptr->el_tag == RT_ARR_END) /* treat case of array ending */
|
||||
{ /* loops set at start of array */
|
||||
if (--arr_loops[arr_loop_level] > 0) /* if need to do next ar elmnt */
|
||||
rt_ptr -= rt_ptr->u.arr.num_rt_blks; /* mv rt_ptr to start of arr */
|
||||
else
|
||||
--arr_loop_level;
|
||||
}
|
||||
|
||||
ellen = abs (rt_ptr->u.p.el_len); /* make sure positive */
|
||||
switch (rt_ptr->el_tag)
|
||||
{
|
||||
case RT_ARR_START : /* arrays don't have to be aligned */
|
||||
++arr_loop_level;
|
||||
arr_loops[arr_loop_level] = rt_ptr->u.arr.num_elmnts;
|
||||
/* let fall through to STR_MMSOP_START */
|
||||
|
||||
case RT_STR_START : /* structure starting */
|
||||
size += med_oh; /* add in data element overhead */
|
||||
break;
|
||||
|
||||
case RT_UNSIGNED : /* unsigned integer */
|
||||
size += small_oh + ellen + 1; /* high order bit set needs 0x00*/
|
||||
break;
|
||||
|
||||
case RT_UTC_TIME : /* UTC time */
|
||||
case RT_BINARY_TIME : /* binary time */
|
||||
case RT_INTEGER : /* integer */
|
||||
case RT_FLOATING_POINT : /* float */
|
||||
size += small_oh + ellen;
|
||||
break;
|
||||
|
||||
case RT_VISIBLE_STRING : /* visible string */
|
||||
case RT_OCTET_STRING : /* octet string */
|
||||
size += ellen;
|
||||
if (ellen < 128)
|
||||
size += small_oh;
|
||||
else
|
||||
size += med_oh;
|
||||
break;
|
||||
|
||||
case RT_GENERAL_TIME : /* generalized time */
|
||||
size += small_oh + GENTIME_LEN;
|
||||
break;
|
||||
|
||||
case RT_BOOL : /* boolean */
|
||||
size += small_oh +1;
|
||||
break;
|
||||
|
||||
case RT_BCD : /* bcd */
|
||||
size += small_oh + ellen;
|
||||
break;
|
||||
|
||||
case RT_BIT_STRING : /* bit string */
|
||||
len = 1 + CALC_BIT_LEN (ellen);
|
||||
|
||||
if (len < 128)
|
||||
size += small_oh + len; /* add in data element overhead */
|
||||
else
|
||||
size += med_oh + len; /* add in data element overhead */
|
||||
|
||||
break;
|
||||
|
||||
case RT_UTF8_STRING : /* Unicode UTF8 string */
|
||||
el_size = ellen*4; /* Could take 4 bytes per char */
|
||||
size += el_size;
|
||||
if (el_size < 128)
|
||||
size += small_oh;
|
||||
else
|
||||
size += med_oh;
|
||||
break;
|
||||
|
||||
case RT_ARR_END : /* array done */
|
||||
case RT_STR_END : /* structure done */
|
||||
break;
|
||||
|
||||
default : /* should not be any other tag */
|
||||
return (0);
|
||||
break;
|
||||
}
|
||||
rt_ptr++; /* point to next block */
|
||||
} /* while (rt blocks) */
|
||||
return (size);
|
||||
}
|
||||
|
||||
|
||||
1153
mmslib/mmsl/ms_tdef.c
Normal file
1153
mmslib/mmsl/ms_tdef.c
Normal file
File diff suppressed because it is too large
Load Diff
226
mmslib/mmsl/ms_tdef2.c
Normal file
226
mmslib/mmsl/ms_tdef2.c
Normal file
@@ -0,0 +1,226 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : mms_tdef2.c */
|
||||
/* PRODUCT(S) : MMSEASE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* Functions to assist in using NESTED RUNTIME TYPES */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 08/01/05 JRB 13 Avoid risky cast to remove const. */
|
||||
/* 04/02/03 JRB 12 Add UTF8string support (see RT_UTF8_STRING). */
|
||||
/* 12/20/01 JRB 11 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 11/14/01 EJV 10 Added support for new MMS type UtcTime: */
|
||||
/* ms_runtime_to_asn1: add case for RT_UTC_TIME */
|
||||
/* 10/18/01 JRB 09 Eliminate warning. */
|
||||
/* 07/28/00 JRB 08 Use ms_comp_name_find for everyone. */
|
||||
/* 07/13/00 JRB 07 Use new ms_comp_name_find to get comp names. */
|
||||
/* 09/13/99 MDE 06 Added SD_CONST modifiers */
|
||||
/* 04/14/99 MDE 05 Removed unnecessary include files */
|
||||
/* 09/10/98 MDE 04 Removed 'mvlRtNames' declaration */
|
||||
/* 08/13/98 MDE 03 Added asn1 encode overrun test to loop */
|
||||
/* 03/11/98 MDE 02 Removed NEST_RT_TYPES */
|
||||
/* 04/08/97 MDE 01 Fixed 'RT Table too small prob w/named types */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
#include "glbsem.h"
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pvar.h"
|
||||
#include "mms_vvar.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* For debug version, use a static pointer to avoid duplication of */
|
||||
/* __FILE__ strings. */
|
||||
|
||||
#ifdef DEBUG_SISCO
|
||||
SD_CONST static ST_CHAR *SD_CONST thisFileName = __FILE__;
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* ms_runtime_to_tdl */
|
||||
/************************************************************************/
|
||||
/* Converts RUNTIME TYPE to ASN.1. ASN.1 build must be started */
|
||||
|
||||
ST_RET ms_runtime_to_asn1 (ASN1_ENC_CTXT *aCtx, SD_CONST RUNTIME_TYPE *rt, ST_INT rt_num)
|
||||
{
|
||||
ST_INT i;
|
||||
ST_INT level;
|
||||
SD_CONST RUNTIME_TYPE *rt_ptr;
|
||||
ST_BOOLEAN structComp[ASN1_MAX_LEVEL];
|
||||
ST_UCHAR v1;
|
||||
ST_UCHAR v2;
|
||||
const ST_CHAR *comp_name;
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
|
||||
level = 0;
|
||||
rt_ptr = rt + (rt_num - 1);
|
||||
for (i = 0; i < rt_num && aCtx->asn1r_encode_overrun == SD_FALSE; ++i, --rt_ptr)
|
||||
{
|
||||
switch (rt_ptr->el_tag)
|
||||
{
|
||||
case RT_ARR_START :
|
||||
--level;
|
||||
/* Finish typeSpecification */
|
||||
asn1r_fin_constr (aCtx, 2, CTX, SD_FALSE);
|
||||
|
||||
/* Write numberOfElements */
|
||||
asn1r_wr_i32 (aCtx, (ST_INT32) rt_ptr->u.arr.num_elmnts);
|
||||
asn1r_fin_prim (aCtx, 1,CTX);
|
||||
|
||||
/* Finish array */
|
||||
asn1r_fin_constr (aCtx, 1, CTX, SD_FALSE);
|
||||
break;
|
||||
|
||||
case RT_ARR_END :
|
||||
++level;
|
||||
structComp[level] = SD_FALSE;
|
||||
asn1r_strt_constr (aCtx); /* Start array */
|
||||
asn1r_strt_constr (aCtx); /* Start typeSpecification */
|
||||
break;
|
||||
|
||||
case RT_STR_START :
|
||||
--level;
|
||||
asn1r_fin_constr (aCtx, 1, CTX, SD_FALSE); /* Finish components */
|
||||
asn1r_fin_constr (aCtx, 2, CTX, SD_FALSE); /* Finish structure */
|
||||
break;
|
||||
|
||||
case RT_STR_END :
|
||||
++level;
|
||||
structComp[level] = SD_TRUE;
|
||||
|
||||
asn1r_strt_constr (aCtx); /* Start structure */
|
||||
asn1r_strt_constr (aCtx); /* Start components */
|
||||
/* prepare for first component */
|
||||
asn1r_strt_constr (aCtx); /* Start component seq of seq */
|
||||
asn1r_strt_constr (aCtx); /* Start component type */
|
||||
break;
|
||||
|
||||
case RT_BOOL :
|
||||
asn1r_fin_prim (aCtx, RT_BOOL, CTX);
|
||||
break;
|
||||
|
||||
case RT_INTEGER :
|
||||
asn1r_wr_u8 (aCtx, (ST_UCHAR) (rt_ptr->u.p.el_len * 8));
|
||||
asn1r_fin_prim (aCtx, RT_INTEGER, CTX);
|
||||
break;
|
||||
|
||||
case RT_UNSIGNED :
|
||||
asn1r_wr_u8 (aCtx, (ST_UCHAR) (rt_ptr->u.p.el_len * 8));
|
||||
asn1r_fin_prim (aCtx, RT_UNSIGNED, CTX);
|
||||
break;
|
||||
|
||||
case RT_FLOATING_POINT :
|
||||
asn1r_strt_constr (aCtx);
|
||||
if (rt_ptr->u.p.el_len == 4) /* single precision */
|
||||
{
|
||||
v1 = SNGL_EXP;
|
||||
if (!m_use_dis_float)
|
||||
v2 = SNGL_WHOLE;
|
||||
else
|
||||
v2 = SNGL_FRACT;
|
||||
}
|
||||
else
|
||||
{
|
||||
v1 = DOUBL_EXP;
|
||||
if (!m_use_dis_float)
|
||||
v2 = DOUBL_WHOLE;
|
||||
else
|
||||
v2 = DOUBL_FRACT;
|
||||
}
|
||||
asn1r_wr_u8 (aCtx, v1); /* write exp */
|
||||
asn1r_fin_prim (aCtx, INT_CODE,UNI);
|
||||
asn1r_wr_u8 (aCtx, v2);
|
||||
asn1r_fin_prim (aCtx, INT_CODE,UNI);
|
||||
asn1r_fin_constr (aCtx, RT_FLOATING_POINT, CTX, SD_FALSE);
|
||||
break;
|
||||
|
||||
case RT_BIT_STRING :
|
||||
case RT_OCTET_STRING :
|
||||
case RT_VISIBLE_STRING :
|
||||
case RT_UTF8_STRING : /* all same encoding w/ different tags*/
|
||||
asn1r_wr_i32 (aCtx, (ST_INT32) rt_ptr->u.p.el_len);
|
||||
asn1r_fin_prim (aCtx, rt_ptr->el_tag, CTX);
|
||||
break;
|
||||
|
||||
case RT_GENERAL_TIME :
|
||||
asn1r_fin_prim (aCtx, RT_GENERAL_TIME, CTX);
|
||||
break;
|
||||
|
||||
case RT_BINARY_TIME :
|
||||
if (rt_ptr->u.p.el_len == 4)
|
||||
asn1r_wr_u8 (aCtx, 0);
|
||||
else
|
||||
asn1r_wr_u8 (aCtx, 1);
|
||||
asn1r_fin_prim (aCtx, RT_BINARY_TIME, CTX);
|
||||
break;
|
||||
|
||||
case RT_UTC_TIME :
|
||||
asn1r_fin_prim (aCtx, RT_UTC_TIME, CTX);
|
||||
break;
|
||||
|
||||
case RT_BCD :
|
||||
asn1r_wr_u8 (aCtx, (ST_UCHAR) rt_ptr->u.p.el_len);
|
||||
asn1r_fin_prim (aCtx, RT_BCD, CTX);
|
||||
break;
|
||||
|
||||
case RT_BOOLEANARRAY :
|
||||
break;
|
||||
|
||||
default :
|
||||
MLOG_ERR1 ("MS_RUNTIME_TO_ASN1: Invalid element tag (%d)",
|
||||
rt_ptr->el_tag);
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (SD_FAILURE);
|
||||
break;
|
||||
}
|
||||
|
||||
if (level > 0 && structComp[level] == SD_TRUE &&
|
||||
rt_ptr->el_tag != RT_STR_END)
|
||||
{
|
||||
asn1r_fin_constr (aCtx, 1, CTX, SD_FALSE); /* Finish typeSpec */
|
||||
|
||||
comp_name = ms_comp_name_find (rt_ptr);
|
||||
if (strlen (comp_name))
|
||||
{
|
||||
asn1r_wr_vstr (aCtx, comp_name);
|
||||
asn1r_fin_prim (aCtx, 0, CTX);
|
||||
}
|
||||
asn1r_fin_constr (aCtx, SEQ_CODE, UNI, SD_FALSE);
|
||||
|
||||
if ((rt_ptr-1)->el_tag != RT_STR_START)
|
||||
{
|
||||
/* prepare for the next component */
|
||||
asn1r_strt_constr (aCtx); /* Start component seq of seq */
|
||||
asn1r_strt_constr (aCtx); /* Start component type */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
|
||||
if (aCtx->asn1r_encode_overrun)
|
||||
{
|
||||
MLOG_NERR0 ("ms_runtime_to_asn1 : ASN.1 encode overrun");
|
||||
return (SD_FAILURE);
|
||||
}
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
51
mmslib/mmsl/ms_tdef4.c
Normal file
51
mmslib/mmsl/ms_tdef4.c
Normal file
@@ -0,0 +1,51 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 2003 - 2003, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : ms_tdef4.c */
|
||||
/* PRODUCT(S) : MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* Function called by "ms_runtime_create" to find base types when */
|
||||
/* building complex types. */
|
||||
/* NOTE: This module should be included in a library & should contain */
|
||||
/* ONLY "u_ml_get_rt_type", so that the user can easily replace */
|
||||
/* this function with a customized function. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* u_ml_get_rt_type */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 02/21/07 JRB 02 Just log & return error (removes dependence */
|
||||
/* on "mvl" library). If base types needed, */
|
||||
/* user app should create customized funct. */
|
||||
/* 04/24/03 JRB 01 New module. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_vvar.h"
|
||||
|
||||
#ifdef DEBUG_SISCO
|
||||
SD_CONST static ST_CHAR *SD_CONST thisFileName = __FILE__;
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/* u_ml_get_rt_type */
|
||||
/* Called by "ms_runtime_create" to find base types (INT32S, etc.). */
|
||||
/************************************************************************/
|
||||
ST_RET u_ml_get_rt_type (ASN1_DEC_CTXT *aCtx, OBJECT_NAME *type_name,
|
||||
RUNTIME_TYPE **rt_out, ST_INT *num_rt_out)
|
||||
{
|
||||
/* DEBUG: if this error occurs, create customized function in user */
|
||||
/* application (see sample applications). */
|
||||
MLOG_ERR0 ("u_ml_get_rt_type: Finding base types not supported.");
|
||||
return (SD_FAILURE);
|
||||
}
|
||||
101
mmslib/mmsl/msdataas.c
Normal file
101
mmslib/mmsl/msdataas.c
Normal file
@@ -0,0 +1,101 @@
|
||||
/***********************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2002, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : msdataas.c */
|
||||
/* PRODUCT(S) : MMSEASE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 01/02/02 JRB 04 Convert to use ASN1R (re-entrant ASN1). */
|
||||
/* 04/28/00 JRB 03 Lint cleanup */
|
||||
/* 09/13/99 MDE 02 Added SD_CONST modifiers */
|
||||
/* 06/09/97 MDE 01 Modified Runtime Type handling */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
#include "glbsem.h"
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pvar.h"
|
||||
#include "mms_vvar.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* For debug version, use a static pointer to avoid duplication of */
|
||||
/* __FILE__ strings. */
|
||||
|
||||
#ifdef DEBUG_SISCO
|
||||
SD_CONST static ST_CHAR *SD_CONST thisFileName = __FILE__;
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/* Stub functions, included to allow transparent linking */
|
||||
/************************************************************************/
|
||||
|
||||
#ifdef DEBUG_SISCO
|
||||
static ST_CHAR *nfStubMsg = "Non-functional stub function called";
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* The real version of these functions are found in mmsdataa.c */
|
||||
|
||||
#ifndef MMS_LITE
|
||||
|
||||
ST_RET ms_asn1_to_locl_aa (NAMED_TYPE *tptr,
|
||||
ALT_ACCESS *alt_acc,
|
||||
ST_UCHAR *asn1ptr, /* pointer to ASN.1 'Data' */
|
||||
ST_INT asn1len, /* length of ASN.1 'Data' */
|
||||
ST_CHAR *dptr) /* local data buffer pointer */
|
||||
{
|
||||
MLOG_NERR0 (nfStubMsg);
|
||||
return (SD_FAILURE);
|
||||
}
|
||||
#endif
|
||||
|
||||
ST_RET ms_asn1_to_local_aa (SD_CONST RUNTIME_TYPE *rt_head,
|
||||
ST_INT rt_num,
|
||||
ALT_ACCESS *alt_acc,
|
||||
ST_UCHAR *asn1ptr,
|
||||
ST_INT asn1len,
|
||||
ST_CHAR *dptr)
|
||||
{
|
||||
MLOG_NERR0 (nfStubMsg);
|
||||
return (SD_FAILURE);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* The real version of these functions are found in mmsdataa.c */
|
||||
|
||||
#ifndef MMS_LITE
|
||||
|
||||
ST_RET ms_locl_to_asn1_aa (ASN1_ENC_CTXT *aCtx, NAMED_TYPE *tptr,
|
||||
ALT_ACCESS *alt_acc,
|
||||
ST_CHAR *dptr)
|
||||
{
|
||||
MLOG_NERR0 (nfStubMsg);
|
||||
return (SD_FAILURE);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
ST_RET ms_local_to_asn1_aa (ASN1_ENC_CTXT *aCtx, SD_CONST RUNTIME_TYPE *rt_head,
|
||||
ST_INT rt_num,
|
||||
ALT_ACCESS *alt_acc,
|
||||
ST_CHAR *dptr)
|
||||
{
|
||||
MLOG_NERR0 (nfStubMsg);
|
||||
return (SD_FAILURE);
|
||||
}
|
||||
|
||||
113
mmslib/mmsl/rq_ackev.c
Normal file
113
mmslib/mmsl/rq_ackev.c
Normal file
@@ -0,0 +1,113 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rq_ackev.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the requester portion of the acknowledge */
|
||||
/* event notification operation. It decodes the acknowledge event */
|
||||
/* notification response (confirm) & encodes the acknowledge event */
|
||||
/* notification request. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 12/20/01 JRB 02 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 06/15/98 MDE 01 Changes to allow compile under C++ */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pevn.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : NONE */
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_ackevnot_rsp */
|
||||
/* NOTE : Since the mms_ackevnot_type_rsp is a NULL PDU, the decode is */
|
||||
/* continued by '_mms_null_pdu_dec', which simply sets decode done = 1 */
|
||||
/* and sets the decode done function to point to the general decode done*/
|
||||
/* fun. See mmsdec.c for the general functions. */
|
||||
/************************************************************************/
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_ackevnot */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE & send the acknowledge event notification request. */
|
||||
/************************************************************************/
|
||||
|
||||
MMSREQ_PEND *mp_ackevnot (ST_INT chan, ACKEVNOT_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_send (MMSOP_ACK_EVENT_NOT,
|
||||
M_CAST_MK_FUN (_ms_mk_ackevnot_req),
|
||||
chan,(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_ackevnot */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the acknowledge event notification request. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_ackevnot (ACKEVNOT_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_fin (MMSOP_ACK_EVENT_NOT,
|
||||
M_CAST_MK_FUN (_ms_mk_ackevnot_req),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_ackevnot_req */
|
||||
/* construct an acknowledge event notification request. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_ackevnot_req (ASN1_ENC_CTXT *aCtx, ACKEVNOT_REQ_INFO *info)
|
||||
{
|
||||
/* check for acknowledgement event condition name */
|
||||
if (info->ackec_name_pres)
|
||||
{ /* ack event cond name present */
|
||||
asn1r_strt_constr (aCtx); /* start context tag 1 cstr */
|
||||
_ms_wr_mms_objname (aCtx, &info->ackec_name); /* write ack event cond name */
|
||||
asn1r_fin_constr (aCtx, 4, CTX, DEF); /* context tag 4 */
|
||||
}
|
||||
|
||||
asn1r_strt_constr (aCtx); /* start context tag 3 cstr */
|
||||
_ms_wr_mms_evtime (aCtx, &info->evtime);
|
||||
asn1r_fin_constr (aCtx, 3, CTX, DEF); /* finish context tag 3 */
|
||||
|
||||
asn1r_wr_i16 (aCtx, info->ack_state); /* write ack state */
|
||||
asn1r_fin_prim (aCtx, 2, CTX); /* context tag 2 */
|
||||
|
||||
asn1r_strt_constr (aCtx); /* start context tag 0 cstr */
|
||||
_ms_wr_mms_objname (aCtx, &info->evenroll_name);/* write event condition name */
|
||||
asn1r_fin_constr (aCtx, 0, CTX, DEF); /* context tag 0 */
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_ACK_EVENT_NOT,CTX,DEF); /* tag = opcode, ctx cstr */
|
||||
}
|
||||
153
mmslib/mmsl/rq_cancl.c
Normal file
153
mmslib/mmsl/rq_cancl.c
Normal file
@@ -0,0 +1,153 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2005, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rq_cancl.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the requester portion of the cancel */
|
||||
/* operation. It decodes the cancel response (confirm) & encodes */
|
||||
/* the cancel request. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 02/28/05 EJV 04 Elim Linux warnings in if (a=b) */
|
||||
/* 03/11/04 GLB 03 Cleaned up "thisFileName" */
|
||||
/* 12/20/01 JRB 02 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 01 Added SD_CONST modifiers */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
#include "glbsem.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pcon.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* For debug version, use a static pointer to avoid duplication of */
|
||||
/* __FILE__ strings. */
|
||||
|
||||
#if defined(DEBUG_SISCO) && defined(S_MT_SUPPORT)
|
||||
SD_CONST static ST_CHAR *SD_CONST thisFileName = __FILE__;
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
/* variables global to the DECODE portion : NONE */
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_cancel_rsp */
|
||||
/* This function is called from mmsdec when a response is received and */
|
||||
/* the opcode for this operation is decoded. Set up state machine */
|
||||
/* function pointers to end the parse, since the parse is complete. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_cancel_rsp (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("Cancel Response");
|
||||
|
||||
_mmsdec_rslt->data_pres = SD_FALSE; /* cancel just has invoke id */
|
||||
aCtx->asn1r_decode_done = SD_TRUE;
|
||||
asn1r_set_all_cstr_done (aCtx);
|
||||
aCtx->asn1r_decode_done_fun = NULL;
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_cancel */
|
||||
/* Send cancel request. Returns a pointer to the same request control */
|
||||
/* structure that was input unless the cancel request does not get sent.*/
|
||||
/************************************************************************/
|
||||
|
||||
MMSREQ_PEND *mp_cancel (MMSREQ_PEND *reqptr)
|
||||
{
|
||||
ST_UCHAR *msg_ptr;
|
||||
ST_INT msg_len;
|
||||
LLP_ADDR_INFO add_llp_info;
|
||||
ASN1_ENC_CTXT localEncCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_ENC_CTXT *aCtx = &localEncCtx;
|
||||
|
||||
if (reqptr -> op > MAX_MMS_OPCODE)
|
||||
{
|
||||
mms_op_err = MVE_WRONG_OP;
|
||||
return ((MMSREQ_PEND *)0);
|
||||
}
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
msg_ptr = _ms_mk_cancel (aCtx, SD_TRUE,m_build_buf,mms_max_msgsize,reqptr -> id);
|
||||
msg_len = M_BUILD_BUF_END - msg_ptr; /* find length of message */
|
||||
|
||||
add_llp_info.i.LLC.use_rem_addr = SD_FALSE;
|
||||
add_llp_info.i.LLC.send_type = CONFIRMED_REQ_PDU;
|
||||
add_llp_info.i.LLC.req_ptr = (ST_CHAR *)reqptr;
|
||||
|
||||
if (aCtx->asn1r_encode_overrun) /* Check for encode overrun */
|
||||
{
|
||||
mms_op_err = ME_ASN1_ENCODE_OVERRUN;
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return ((MMSREQ_PEND *)NULL); /* return error code */
|
||||
}
|
||||
else if ((mms_op_err = _mms_send_data (reqptr->chan, msg_len, msg_ptr,
|
||||
reqptr->context, &add_llp_info)) != 0)
|
||||
{
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return ((MMSREQ_PEND *)NULL); /* return error code */
|
||||
}
|
||||
else
|
||||
{ /* Adjust state of service request to be cancelled. */
|
||||
reqptr -> cancl_state = CANCEL_REQUESTED;
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (reqptr);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_cancel */
|
||||
/* Send cancel request. Returns a pointer to the same request control */
|
||||
/* structure that was input unless the cancel request does not get sent.*/
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_cancel (ST_VOID)
|
||||
{
|
||||
ST_RET ret;
|
||||
ASN1_ENC_CTXT localEncCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_ENC_CTXT *aCtx = &localEncCtx;
|
||||
|
||||
mmsl_msg_start = _ms_mk_cancel (aCtx, SD_TRUE, mmsl_enc_buf, mmsl_enc_buf_size,
|
||||
mmsl_invoke_id);
|
||||
mmsl_msg_len = (mmsl_enc_buf + mmsl_enc_buf_size) - mmsl_msg_start;
|
||||
|
||||
if (!aCtx->asn1r_encode_overrun) /* Check for encode overrun */
|
||||
ret = SD_SUCCESS;
|
||||
else
|
||||
ret = ME_ASN1_ENCODE_OVERRUN;
|
||||
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/* _ms_mk_cancel */
|
||||
/* Note that there is only one _ms_mk_cancel function, and it is listed in */
|
||||
/* the mmscancl.c module. */
|
||||
/************************************************************************/
|
||||
151
mmslib/mmsl/rq_concl.c
Normal file
151
mmslib/mmsl/rq_concl.c
Normal file
@@ -0,0 +1,151 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2007, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rq_concl.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the requester portion of the conclude */
|
||||
/* operation. It decodes the conclude response (confirm) & */
|
||||
/* encodes the conclude request. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 11/01/07 EJV 05 Rem obsolete LLC30... code. */
|
||||
/* 02/28/05 EJV 04 Elim Linux warnings in if (a=b) */
|
||||
/* 03/11/04 GLB 03 Cleaned up "thisFileName" */
|
||||
/* 12/20/01 JRB 02 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 01 Added SD_CONST modifiers */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
#include "glbsem.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pcon.h"
|
||||
#include "asn1defs.h"
|
||||
#include "slog.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* For debug version, use a static pointer to avoid duplication of */
|
||||
/* __FILE__ strings. */
|
||||
|
||||
#if defined(DEBUG_SISCO) && defined(S_MT_SUPPORT)
|
||||
SD_CONST static ST_CHAR *SD_CONST thisFileName = __FILE__;
|
||||
#endif
|
||||
|
||||
/* External functions (see mmsconcl) : */
|
||||
/* ST_CHAR *_ms_mk_conclude (buf_ptr,buf_len,pdutype) */
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_conclude_rsp */
|
||||
/* NOTE : Since a CONCLUDE is a NULL PDU, the decode is continued */
|
||||
/* by '_mms_null_pdu_dec', which simply sets decode done = 1 and sets */
|
||||
/* the decode done function to point to the general decode done fun */
|
||||
/* See mmsdec.c for the general functions. */
|
||||
/************************************************************************/
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_conclude */
|
||||
/* create and send a conclude request. */
|
||||
/************************************************************************/
|
||||
|
||||
MMSREQ_PEND *mp_conclude (ST_INT chan)
|
||||
{
|
||||
ST_UCHAR *msg_ptr;
|
||||
ST_INT msg_len;
|
||||
MMSREQ_PEND *reqptr;
|
||||
LLP_ADDR_INFO add_llp_info;
|
||||
ASN1_ENC_CTXT localEncCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_ENC_CTXT *aCtx = &localEncCtx;
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
|
||||
reqptr = _ms_get_req_ptr (chan,MMSOP_CONCLUDE,(ST_CHAR *) 0);
|
||||
if (!reqptr)
|
||||
{
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return ((MMSREQ_PEND *) 0);
|
||||
}
|
||||
|
||||
msg_ptr = _ms_mk_conclude (aCtx,m_build_buf,mms_max_msgsize,MMSCNCLREQ);
|
||||
msg_len = M_BUILD_BUF_END - msg_ptr; /* find length */
|
||||
|
||||
add_llp_info.i.LLC.use_rem_addr = SD_FALSE;
|
||||
add_llp_info.i.LLC.send_type = CONCLUDE_REQ_PDU;
|
||||
add_llp_info.i.LLC.req_ptr = (ST_CHAR *)reqptr;
|
||||
|
||||
if (aCtx->asn1r_encode_overrun) /* Check for encode overrun */
|
||||
{
|
||||
mms_op_err = ME_ASN1_ENCODE_OVERRUN;
|
||||
_ms_deact_pend_req (reqptr); /* move from pend to avail */
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return ((MMSREQ_PEND *) 0); /* return error code */
|
||||
}
|
||||
else if ((mms_op_err = _mms_send_data (chan, msg_len, msg_ptr,
|
||||
reqptr->context, &add_llp_info)) != 0)
|
||||
{ /* need to recover req ctrl */
|
||||
_ms_deact_pend_req (reqptr); /* move from pend to avail */
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return ((MMSREQ_PEND *) 0); /* return error code */
|
||||
}
|
||||
else
|
||||
{
|
||||
mms_chan_info[chan].ctxt.chan_state |= M_CONCL_REQ_PEND;
|
||||
|
||||
/* If a request logging function is installed, call it */
|
||||
if (m_log_req_info_fun && (mms_debug_sel & MMS_LOG_REQ))
|
||||
(*m_log_req_info_fun) (reqptr, NULL);
|
||||
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (reqptr);
|
||||
}
|
||||
}
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_conclude */
|
||||
/* create a conclude request. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_conclude (ST_VOID)
|
||||
{
|
||||
ST_RET ret;
|
||||
ASN1_ENC_CTXT localEncCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_ENC_CTXT *aCtx = &localEncCtx;
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
mmsl_msg_start = _ms_mk_conclude (aCtx, mmsl_enc_buf, mmsl_enc_buf_size, MMSCNCLREQ);
|
||||
mmsl_msg_len = (mmsl_enc_buf + mmsl_enc_buf_size) - mmsl_msg_start;
|
||||
|
||||
if (!aCtx->asn1r_encode_overrun) /* Check for encode overrun */
|
||||
ret = SD_SUCCESS;
|
||||
else
|
||||
ret = ME_ASN1_ENCODE_OVERRUN;
|
||||
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/* _ms_mk_conclude */
|
||||
/* Note that there is only one _ms_mk_conclude function, and it is listed */
|
||||
/* in the mmsconcl.c module. */
|
||||
/************************************************************************/
|
||||
|
||||
127
mmslib/mmsl/rq_defee.c
Normal file
127
mmslib/mmsl/rq_defee.c
Normal file
@@ -0,0 +1,127 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rq_defee.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the requester portion of define event */
|
||||
/* enrollment. It decodes the define event enrollment response */
|
||||
/* (confirm) & encodes the define event enrollment request. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 12/20/01 JRB 02 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 06/15/98 MDE 01 Changes to allow compile under C++ */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pevn.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : NONE */
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_defee_rsp */
|
||||
/* NOTE : Since the mms_defee_rsp is a NULL PDU, the decode is */
|
||||
/* continued by '_mms_null_pdu_dec', which simply sets decode done = 1 */
|
||||
/* and sets the decode done function to point to the general decode done*/
|
||||
/* fun. See mmsdec.c for the general functions. */
|
||||
/************************************************************************/
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_defee */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE and send the define event enrollment request. */
|
||||
/************************************************************************/
|
||||
|
||||
MMSREQ_PEND *mp_defee (ST_INT chan, DEFEE_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_send (MMSOP_DEF_EE,
|
||||
M_CAST_MK_FUN (_ms_mk_defee_req),
|
||||
chan,(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_defee */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the define event enrollment request. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_defee (DEFEE_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_fin (MMSOP_DEF_EE,
|
||||
M_CAST_MK_FUN (_ms_mk_defee_req),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_defee_req */
|
||||
/* ENCODE a define event enrollment REQUEST: */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_defee_req (ASN1_ENC_CTXT *aCtx, DEFEE_REQ_INFO *info)
|
||||
{
|
||||
if (info->ackec_name_pres)
|
||||
{
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 6 constructor */
|
||||
_ms_wr_mms_objname (aCtx, &info->ackec_name); /* write ack event cond name */
|
||||
asn1r_fin_constr (aCtx, 6,CTX,DEF); /* context specific tag 6 */
|
||||
}
|
||||
|
||||
if (info->client_app_pres)
|
||||
{
|
||||
asn1r_strt_constr (aCtx); /* start the ctx 5 constr */
|
||||
asn1r_wr_delmnt (aCtx, info->client_app,info->client_app_len);
|
||||
asn1r_fin_constr (aCtx, 5,CTX,DEF); /* finish ctx 5 constructor */
|
||||
}
|
||||
|
||||
if (info->evact_name_pres)
|
||||
{
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 4 constructor */
|
||||
_ms_wr_mms_objname (aCtx, &info->evact_name); /* write event action name */
|
||||
asn1r_fin_constr (aCtx, 4,CTX,DEF); /* context specific tag 4 */
|
||||
}
|
||||
|
||||
asn1r_wr_i16 (aCtx, info->alarm_ack_rule);
|
||||
asn1r_fin_prim (aCtx, 3, CTX);
|
||||
|
||||
asn1r_wr_bitstr (aCtx, (ST_UCHAR *)&info->ec_transitions, 7);
|
||||
asn1r_fin_prim (aCtx, 2, CTX);
|
||||
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 1 constructor */
|
||||
_ms_wr_mms_objname (aCtx, &info->evcon_name); /* write event condition name */
|
||||
asn1r_fin_constr (aCtx, 1,CTX,DEF); /* context specific tag 1 */
|
||||
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 0 constructor */
|
||||
_ms_wr_mms_objname (aCtx, &info->evenroll_name);/* write event enrollment name */
|
||||
asn1r_fin_constr (aCtx, 0,CTX,DEF); /* context specific tag 0 */
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_DEF_EE,CTX,DEF); /* tag = opcode, ctx constr */
|
||||
}
|
||||
181
mmslib/mmsl/rq_evnot.c
Normal file
181
mmslib/mmsl/rq_evnot.c
Normal file
@@ -0,0 +1,181 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2004, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rq_evnot.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the requester portion of the event */
|
||||
/* notification service. It encodes the event notification */
|
||||
/* request. There is no response (confirm). */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/28/05 JRB 05 Incl suicacse if MMS_LITE not defined. */
|
||||
/* 09/17/04 EJV 04 Use new mms_chk_resource. */
|
||||
/* 12/12/02 JRB 03 Add ASN1_ENC_CTXT arg to mpl_evnot */
|
||||
/* 12/20/01 JRB 02 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 06/15/98 MDE 01 Changes to allow compile under C++ */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
#ifndef MMS_LITE
|
||||
#include "mms_pevn.h"
|
||||
#include "suicacse.h" /* for SE_QUE_FULL only */
|
||||
|
||||
/************************************************************************/
|
||||
/* For debug version, use a static pointer to avoid duplication of */
|
||||
/* __FILE__ strings. */
|
||||
|
||||
#ifdef DEBUG_SISCO
|
||||
SD_CONST static ST_CHAR *SD_CONST thisFileName = __FILE__;
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_evnot */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE & send the event notification request. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_evnot (ST_INT chan, EVNOT_REQ_INFO *info_ptr)
|
||||
{
|
||||
ST_RET rc;
|
||||
ST_INT avail;
|
||||
|
||||
/* locking here will assure that _mms_chk_resource will work in */
|
||||
/* multiple threads when mp_* functions are called to send */
|
||||
/* unconfirmed requests */
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
|
||||
avail = _mms_chk_resource (chan);
|
||||
if (avail > 0)
|
||||
rc = _mms_unconf_req_send (MMSOP_EVENT_NOT,
|
||||
M_CAST_MK_FUN (_ms_mk_evnot_req),
|
||||
chan,(ST_CHAR *)info_ptr);
|
||||
else
|
||||
rc = SE_QUE_FULL;
|
||||
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
|
||||
return (rc);
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_evnot */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the event notification request. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_evnot (ASN1_ENC_CTXT *aCtx, EVNOT_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_unconf_req_fin (aCtx, MMSOP_EVENT_NOT,
|
||||
M_CAST_MK_FUN (_ms_mk_evnot_req),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_evnot_req */
|
||||
/* construct an event notification request. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_evnot_req (ASN1_ENC_CTXT *aCtx, EVNOT_REQ_INFO *info)
|
||||
{
|
||||
if (info->evact_result_pres)
|
||||
{ /* write event action result */
|
||||
asn1r_strt_constr (aCtx); /* start context tag 8 cstr */
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 0 or 1 cstr */
|
||||
|
||||
if (info->evact_result_tag == 1) /* failure, write service error */
|
||||
{ /* then check for modifier pos */
|
||||
_ms_wr_service_err (aCtx, (info->serv_err)->eclass,(info->serv_err)->code,
|
||||
&(info->serv_err)->adtnl);
|
||||
asn1r_fin_constr (aCtx, 1, CTX, DEF);
|
||||
|
||||
#ifdef MOD_SUPPORT
|
||||
if (info->mod_pos_pres)
|
||||
{
|
||||
asn1r_wr_u32 (aCtx, info->mod_pos);
|
||||
asn1r_fin_prim (aCtx, 0, CTX);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else /* SD_SUCCESS */
|
||||
{
|
||||
#ifdef CS_SUPPORT /* first check for CS response detail */
|
||||
if (info->cs_rdetail_pres)
|
||||
{
|
||||
asn1r_strt_constr (aCtx); /* start context tag 79 cstr */
|
||||
asn1r_wr_delmnt (aCtx, info->cs_rdetail, info->cs_rdetail_len);
|
||||
asn1r_fin_constr (aCtx, 79, CTX, DEF); /* CS is cstr 79 */
|
||||
}
|
||||
#endif
|
||||
asn1r_wr_delmnt (aCtx, info->conf_serv_resp, info->conf_serv_resp_len);
|
||||
}
|
||||
asn1r_fin_constr (aCtx, info->evact_result_tag, CTX, DEF); /* cstr 0 or 1 */
|
||||
_ms_wr_mms_objname (aCtx, &info->evact_name); /* write event action name */
|
||||
asn1r_fin_constr (aCtx, 8, CTX, DEF); /* finish context tag 8 cstr */
|
||||
}
|
||||
|
||||
if (info->alarm_ack_rule_pres)
|
||||
{ /* write alarm ack rule */
|
||||
asn1r_wr_i16 (aCtx, info->alarm_ack_rule);
|
||||
asn1r_fin_prim (aCtx, 7, CTX);
|
||||
}
|
||||
|
||||
if (info->not_lost)
|
||||
{ /* not the defalut */
|
||||
asn1r_wr_bool (aCtx, info->not_lost); /* write notification lost */
|
||||
asn1r_fin_prim (aCtx, 6, CTX);
|
||||
}
|
||||
|
||||
asn1r_strt_constr (aCtx); /* start context tag 4 cstr */
|
||||
_ms_wr_mms_evtime (aCtx, &info->trans_time); /* write event time */
|
||||
asn1r_fin_constr (aCtx, 4, CTX, DEF); /* finish context tag 4 cstr */
|
||||
|
||||
if (info->cur_state_pres)
|
||||
{
|
||||
asn1r_wr_i16 (aCtx, info->cur_state); /* write the current state */
|
||||
asn1r_fin_prim (aCtx, 3, CTX);
|
||||
}
|
||||
|
||||
asn1r_wr_u8 (aCtx, info->severity); /* write the severity */
|
||||
asn1r_fin_prim (aCtx, 2, CTX);
|
||||
|
||||
asn1r_strt_constr (aCtx); /* start context tag 1 cstr */
|
||||
_ms_wr_mms_objname (aCtx, &info->evcon_name); /* write event condition name */
|
||||
asn1r_fin_constr (aCtx, 1,CTX,DEF); /* finish the ev con name cstr */
|
||||
|
||||
asn1r_strt_constr (aCtx); /* start event enrollment name */
|
||||
_ms_wr_mms_objname (aCtx, &info->evenroll_name);/* write event enrollment name */
|
||||
asn1r_fin_constr (aCtx, 0, CTX, DEF); /* finish eventenrollment cstr */
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, 2,CTX,DEF); /* tag = opcode, ctx */
|
||||
}
|
||||
225
mmslib/mmsl/rq_getcl.c
Normal file
225
mmslib/mmsl/rq_getcl.c
Normal file
@@ -0,0 +1,225 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rq_getcl.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the requester portion of get capability */
|
||||
/* list. It decodes the get capability list response (confirm) & */
|
||||
/* encodes the get capability list request. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 06 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 05 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 04 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 03 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 02 Changes to allow compile under C++ */
|
||||
/* 07/03/97 MDE 01 Op-specific info buffer handling changes */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pvmd.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : NONE */
|
||||
|
||||
static GETCL_RESP_INFO *rsp_info;
|
||||
|
||||
static ST_CHAR **cap_ptr;
|
||||
static ST_INT max_capabilities;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID getcl_cap_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getcl_get_cap (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getcl_cap_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getcl_get_more_follows (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_getcl_rsp */
|
||||
/* This function is called from MMSDEC when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_getcl_rsp (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT rsp_size;
|
||||
|
||||
MLOG_CDEC0 ("Get Capability List Response");
|
||||
|
||||
#if defined(FIXED_DECBUF)
|
||||
max_capabilities = m_cl_max_getcl_cap;
|
||||
rsp_size = mmsl_dec_info_size;
|
||||
#else
|
||||
/* determine maximum size */
|
||||
max_capabilities = _mmsdec_msglen/2;
|
||||
if (m_cl_max_getcl_cap && (max_capabilities > m_cl_max_getcl_cap))
|
||||
max_capabilities = m_cl_max_getcl_cap;
|
||||
|
||||
/* get storage for resp info */
|
||||
rsp_size = sizeof (GETCL_RESP_INFO)
|
||||
+ (max_capabilities * (sizeof (ST_CHAR *)));
|
||||
#endif
|
||||
|
||||
/* get storage for request information */
|
||||
rsp_info = (GETCL_RESP_INFO *) _m_get_dec_buf (aCtx, rsp_size);
|
||||
cap_ptr = (ST_CHAR **) (rsp_info + 1);
|
||||
rsp_info->more_follows = SD_TRUE;
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 0, getcl_cap_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getcl_cap_cstr */
|
||||
/* get capability list RESPONSE (confirm) is being decoded: */
|
||||
/* capability list constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getcl_cap_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("getcl_cap_cstr");
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, UNI, VISTR_CODE, getcl_get_cap);
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = getcl_cap_cstr_done;
|
||||
aCtx->asn1r_decode_done_fun = _mms_dec_done_ok;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getcl_get_cap */
|
||||
/* get capability list RESPONSE (confirm) is being decoded: */
|
||||
/* capability was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getcl_get_cap (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("getcl_get_cap");
|
||||
|
||||
rsp_info->num_of_capab++; /* increment # of capabilities */
|
||||
if (rsp_info->num_of_capab > max_capabilities)
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
/* copy capability back onto itself shifted by one character */
|
||||
*cap_ptr = (ST_CHAR *) aCtx->asn1r_field_ptr - 1;
|
||||
if (asn1r_get_vstr (aCtx, *cap_ptr))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
cap_ptr++;
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, UNI, VISTR_CODE, getcl_get_cap);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getcl_cap_cstr_done */
|
||||
/* get capability list RESPONSE (confirm) is being decoded: */
|
||||
/* capability list constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getcl_cap_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT rsp_size;
|
||||
|
||||
/* find actual size for response info */
|
||||
/* OK to be done, or may have more follows indicator */
|
||||
rsp_size = sizeof (GETCL_RESP_INFO)
|
||||
+ (sizeof (ST_CHAR *) * rsp_info->num_of_capab);
|
||||
|
||||
/* give back unused _mms_dec_info; */
|
||||
_mms_dec_info = (*m_realloc_os_fun) (_mms_dec_info,rsp_size);
|
||||
rsp_info = (GETCL_RESP_INFO *) _mms_dec_info;
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX,1,getcl_get_more_follows);
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getcl_get_more_follows */
|
||||
/* get capability list RESPONSE (confirm) is being decoded: */
|
||||
/* more follows was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getcl_get_more_follows (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("getcl_get_more_follows");
|
||||
|
||||
if (asn1r_get_bool (aCtx, &rsp_info->more_follows))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_getcl */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE and send the get capability list request. */
|
||||
/************************************************************************/
|
||||
|
||||
MMSREQ_PEND *mp_getcl (ST_INT chan, GETCL_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_send (MMSOP_GET_CAP_LIST,
|
||||
M_CAST_MK_FUN (_ms_mk_getcl_req),
|
||||
chan,(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_getcl */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the get capability list request. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_getcl (GETCL_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_fin (MMSOP_GET_CAP_LIST,
|
||||
M_CAST_MK_FUN (_ms_mk_getcl_req),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_getcl_req */
|
||||
/* ENCODE a get capability list REQUEST: */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_getcl_req (ASN1_ENC_CTXT *aCtx, GETCL_REQ_INFO *info)
|
||||
{
|
||||
|
||||
if (info->cont_after_pres)
|
||||
{
|
||||
asn1r_wr_vstr (aCtx, info->continue_after); /* write the continue after */
|
||||
asn1r_fin_prim (aCtx, VISTR_CODE,UNI);
|
||||
}
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_GET_CAP_LIST,CTX,DEF); /* tag = opcode, context */
|
||||
}
|
||||
354
mmslib/mmsl/rq_getdo.c
Normal file
354
mmslib/mmsl/rq_getdo.c
Normal file
@@ -0,0 +1,354 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rq_getdom.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the requester portion of get domain */
|
||||
/* attribute. It decodes the get domain attribute response */
|
||||
/* (confirm) & encodes the get domain attribute request. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 05 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 04 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 03 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 02 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 01 Changes to allow compile under C++ */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pdom.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : NONE */
|
||||
|
||||
static GETDOM_RESP_INFO *rsp_info;
|
||||
|
||||
|
||||
static ST_CHAR **cap_ptr;
|
||||
static ST_CHAR **pin_ptr;
|
||||
static ST_INT max_capabilities;
|
||||
static ST_INT max_pi_names;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID getdom_get_upl_in_prog (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getdom_get_pin (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getdom_pin_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getdom_pin_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getdom_get_sharable (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getdom_get_mms_deletable (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getdom_get_state (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getdom_get_cap (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getdom_cap_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getdom_cap_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_get_dom_attr_rsp */
|
||||
/* This function is called from MMSDEC when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_get_dom_attr_rsp (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT rsp_size;
|
||||
|
||||
MLOG_CDEC0 ("Get Domain Attribute Response");
|
||||
|
||||
#if defined(FIXED_DECBUF)
|
||||
max_capabilities = _mmsdec_msglen/2;
|
||||
max_pi_names = _mmsdec_msglen/2;
|
||||
rsp_size = mmsl_dec_info_size;
|
||||
#else
|
||||
/* determine maximum size */
|
||||
max_capabilities = _mmsdec_msglen/2;
|
||||
max_pi_names = _mmsdec_msglen/2;
|
||||
if (m_cl_max_getdom_cap && (max_capabilities > m_cl_max_getdom_cap))
|
||||
max_capabilities = m_cl_max_getdom_cap;
|
||||
if (m_cl_max_getdom_pi && (max_pi_names > m_cl_max_getdom_pi))
|
||||
max_pi_names = m_cl_max_getdom_pi;
|
||||
rsp_size = sizeof (GETDOM_RESP_INFO)
|
||||
+ (max_capabilities * (sizeof (ST_CHAR *)))
|
||||
+ (max_pi_names * (sizeof (ST_CHAR *)));
|
||||
/* get storage for resp info */
|
||||
#endif
|
||||
|
||||
/* get storage for request information */
|
||||
rsp_info = (GETDOM_RESP_INFO *) _m_get_dec_buf (aCtx, rsp_size);
|
||||
cap_ptr = (ST_CHAR **) (rsp_info + 1);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 0, getdom_cap_cstr);/* cap list is next*/
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getdom_cap_cstr */
|
||||
/* get domain attribute RESPONSE (confirm) is being decoded: */
|
||||
/* capability list constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getdom_cap_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("getdom_cap_cstr");
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, UNI, VISTR_CODE, getdom_get_cap);
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = getdom_cap_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getdom_get_cap */
|
||||
/* get domain attribute RESPONSE (confirm) is being decoded: */
|
||||
/* capability was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getdom_get_cap (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("getdom_get_cap");
|
||||
|
||||
rsp_info->num_of_capab++; /* increment # of capabilities */
|
||||
if (rsp_info->num_of_capab > max_capabilities)
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
/* copy capability back onto itself shifted by one character */
|
||||
*cap_ptr = (ST_CHAR *) aCtx->asn1r_field_ptr - 1;
|
||||
if (asn1r_get_vstr (aCtx, *cap_ptr))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
cap_ptr++;
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, UNI, VISTR_CODE, getdom_get_cap);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getdom_cap_cstr_done */
|
||||
/* get domain attribute RESPONSE (confirm) is being decoded: */
|
||||
/* capability list constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getdom_cap_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 1, getdom_get_state);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getdom_get_state */
|
||||
/* get domain attribute RESPONSE (confirm) is being decoded: */
|
||||
/* state was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getdom_get_state (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT ver;
|
||||
|
||||
MLOG_CDEC0 ("getdom_get_state");
|
||||
|
||||
#ifndef MMS_LITE
|
||||
ver = mms_chan_info[_mmsdechan].version;
|
||||
#else
|
||||
ver = mmsl_version;
|
||||
#endif
|
||||
|
||||
if ((asn1r_get_i16 (aCtx, &(rsp_info->state))) || /* get & verify state */
|
||||
(rsp_info->state < 0) ||
|
||||
(!ver && rsp_info->state > 5) || /* DIS */
|
||||
(ver && rsp_info->state > 15)) /* IS */
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 2, getdom_get_mms_deletable);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getdom_get_mms_deletable */
|
||||
/* get domain attribute RESPONSE (confirm) is being decoded: */
|
||||
/* mms deletable was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getdom_get_mms_deletable (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("getdom_get_mms_deletable");
|
||||
|
||||
if (asn1r_get_bool (aCtx, &(rsp_info->mms_deletable))) /* get mms deletable */
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 3, getdom_get_sharable);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getdom_get_sharable */
|
||||
/* get domain attribute RESPONSE (confirm) is being decoded: */
|
||||
/* sharable was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getdom_get_sharable (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("getdom_get_sharable");
|
||||
|
||||
if (asn1r_get_bool (aCtx, &(rsp_info->sharable))) /* get sharable */
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 4, getdom_pin_cstr);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* getdom_pin_cstr */
|
||||
/* get domain attribute RESPONSE (confirm) is being decoded: */
|
||||
/* program invocation name list constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getdom_pin_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("getdom_pin_cstr");
|
||||
|
||||
pin_ptr = (ST_CHAR **) (cap_ptr);
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, UNI, VISTR_CODE, getdom_get_pin);
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = getdom_pin_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getdom_get_pin */
|
||||
/* get domain attribute RESPONSE (confirm) is being decoded: */
|
||||
/* progran invocation name was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getdom_get_pin (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("getdom_get_pin");
|
||||
|
||||
rsp_info->num_of_pinames++; /* increment # of pi names */
|
||||
if (rsp_info->num_of_pinames > max_pi_names)
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
/* copy pi name back onto itself shifted by one character */
|
||||
*pin_ptr = (ST_CHAR *) aCtx->asn1r_field_ptr - 1;
|
||||
if (asn1r_get_identifier (aCtx, *pin_ptr))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
pin_ptr++;
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, UNI, VISTR_CODE, getdom_get_pin);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getdom_pin_cstr_done */
|
||||
/* get domain attribute RESPONSE (confirm) is being decoded: */
|
||||
/* program invocation name list constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getdom_pin_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 5, getdom_get_upl_in_prog);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getdom_get_upl_in_prog */
|
||||
/* get domain attribute RESPONSE (confirm) is being decoded: */
|
||||
/* upload in progress was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getdom_get_upl_in_prog (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT rsp_size;
|
||||
|
||||
MLOG_CDEC0 ("getdom_get_upl_in_prog");
|
||||
|
||||
if (asn1r_get_i8 (aCtx, &(rsp_info->upload_in_progress)))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
/* find actual size for response info */
|
||||
rsp_size = sizeof (GETDOM_RESP_INFO)
|
||||
+ (sizeof (ST_CHAR *) * rsp_info->num_of_capab)
|
||||
+ (sizeof (ST_CHAR *) * rsp_info->num_of_pinames);
|
||||
|
||||
/* give back unused storage */
|
||||
_mms_dec_info = (*m_realloc_os_fun) (_mms_dec_info,rsp_size);
|
||||
rsp_info = (GETDOM_RESP_INFO *) _mms_dec_info;
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_getdom */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE and send the get domain attribute request. */
|
||||
/************************************************************************/
|
||||
|
||||
MMSREQ_PEND *mp_getdom (ST_INT chan, GETDOM_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_send (MMSOP_GET_DOM_ATTR,
|
||||
M_CAST_MK_FUN (_ms_mk_getdom_req),
|
||||
chan,(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_getdom */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the get domain attribute request. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_getdom (GETDOM_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_fin (MMSOP_GET_DOM_ATTR,
|
||||
M_CAST_MK_FUN (_ms_mk_getdom_req),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_getdom_req */
|
||||
/* ENCODE a get domain attribute REQUEST: */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_getdom_req (ASN1_ENC_CTXT *aCtx, GETDOM_REQ_INFO *info)
|
||||
{
|
||||
asn1r_wr_vstr (aCtx, info->dname); /* write the domain name */
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_prim (aCtx, MMSOP_GET_DOM_ATTR,CTX); /* tag = opcode, context */
|
||||
}
|
||||
290
mmslib/mmsl/rq_getea.c
Normal file
290
mmslib/mmsl/rq_getea.c
Normal file
@@ -0,0 +1,290 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rq_geteaa.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the requester portion of the get event */
|
||||
/* action attributes. It decodes the get event action attributes */
|
||||
/* response (confirm) & encodes the get event action attributes */
|
||||
/* request. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 07 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 06 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 04/28/00 JRB 05 Lint cleanup */
|
||||
/* 09/13/99 MDE 04 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 03 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 02 Changes to allow compile under C++ */
|
||||
/* 07/03/97 MDE 01 Op-specific info buffer handling changes */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pevn.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static GETEAA_RESP_INFO *rsp_info;
|
||||
|
||||
#ifdef MOD_SUPPORT
|
||||
static MODIFIER *mod_ptr;
|
||||
static ST_INT max_modifiers;
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID geteaa_get_mms_deletable (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteaa_get_modlist (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteaa_modlist_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteaa_conf_serv_req_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteaa_conf_serv_req_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteaa_conf_serv_req_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
#ifdef CS_SUPPORT
|
||||
static ST_VOID geteaa_cs_rdetail_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteaa_cs_rdetail_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteaa_cs_rdetail_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_geteaa_rsp */
|
||||
/* This function is called from MMSDEC when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_geteaa_rsp (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT rsp_size;
|
||||
|
||||
MLOG_CDEC0 ("Get Event Action Attributes Response");
|
||||
/* find maximum size for response info */
|
||||
|
||||
#if defined(FIXED_DECBUF)
|
||||
rsp_size = sizeof (GETEAA_RESP_INFO);
|
||||
#else
|
||||
#ifdef MOD_SUPPORT
|
||||
max_modifiers = _mmsdec_msglen / 2;
|
||||
rsp_size = sizeof (GETEAA_RESP_INFO)
|
||||
+ (sizeof (MODIFIER) * max_modifiers);
|
||||
mod_ptr = (MODIFIER *) (rsp_info + 1);
|
||||
#else
|
||||
rsp_size = sizeof (GETEAA_RESP_INFO);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* get storage for request information */
|
||||
rsp_info = (GETEAA_RESP_INFO *) _m_get_dec_buf (aCtx, rsp_size);
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 0, geteaa_get_mms_deletable);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 1, geteaa_get_modlist);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteaa_get_mms_deletable */
|
||||
/* Decoding get event action attributes response: mms deletable was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteaa_get_mms_deletable (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("geteaa_get_mms_deletable");
|
||||
/* read mms deletable */
|
||||
if (asn1r_get_bool (aCtx, &(rsp_info->mms_deletable)))
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 1, geteaa_get_modlist);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteaa_get_modlist */
|
||||
/* Decoding get event action attributes response: list of modifiers */
|
||||
/* constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteaa_get_modlist (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("geteaa_get_modlist");
|
||||
|
||||
#ifdef MOD_SUPPORT
|
||||
_ms_get_mms_modlist (aCtx, mod_ptr, &rsp_info->num_of_modifiers,
|
||||
max_modifiers, geteaa_modlist_done);
|
||||
#else /* must be empty if not supported */
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = geteaa_modlist_done;
|
||||
#endif
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteaa_modlist_done */
|
||||
/* Decoding get event action attributes response: list of modifiers */
|
||||
/* constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteaa_modlist_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("geteaa_modlist_done");
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 2, geteaa_conf_serv_req_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteaa_conf_serv_req_cstr */
|
||||
/* Decoding get event action attributes response: confirmed service */
|
||||
/* request constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteaa_conf_serv_req_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT rsp_size;
|
||||
|
||||
MLOG_CDEC0 ("geteaa_conf_serv_req_cstr");
|
||||
/* find actual size for response info */
|
||||
rsp_size = sizeof (GETEAA_RESP_INFO)
|
||||
+ (sizeof (MODIFIER)*rsp_info->num_of_modifiers);
|
||||
|
||||
/* give back unused storage */
|
||||
_mms_dec_info = (*m_realloc_os_fun) (_mms_dec_info, rsp_size);
|
||||
rsp_info = (GETEAA_RESP_INFO *) _mms_dec_info;
|
||||
|
||||
/* get the confirmed service request */
|
||||
rsp_info->conf_serv_req = aCtx->asn1r_field_ptr;
|
||||
|
||||
asn1r_parse_next (aCtx, geteaa_conf_serv_req_done); /* parse the contents */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteaa_conf_serv_req_done */
|
||||
/* Decoding get event action attributes response: confirmed service */
|
||||
/* request has been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteaa_conf_serv_req_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("geteaa_conf_serv_req_done");
|
||||
|
||||
rsp_info->conf_serv_req_len = aCtx->asn1r_octetcount; /* save the length */
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = geteaa_conf_serv_req_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteaa_conf_serv_req_cstr_done */
|
||||
/* Decoding get event action attributes response: confirmed service */
|
||||
/* request constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteaa_conf_serv_req_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
#ifdef CS_SUPPORT
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 79, geteaa_cs_rdetail_cstr);
|
||||
#endif
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
#ifdef CS_SUPPORT
|
||||
/************************************************************************/
|
||||
/* geteaa_cs_rdetail_cstr */
|
||||
/* Decoding get event action attributes response: companion standard */
|
||||
/* request detail was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteaa_cs_rdetail_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("geteaa_cs_rdetail_cstr");
|
||||
|
||||
rsp_info->cs_rdetail_pres = SD_TRUE; /* set flag */
|
||||
|
||||
rsp_info->cs_rdetail = aCtx->asn1r_field_ptr; /* get the CS request detail */
|
||||
asn1r_parse_next (aCtx, geteaa_cs_rdetail_done); /* parse the contents */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteaa_cs_rdetail_done */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteaa_cs_rdetail_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("geteaa_cs_rdetail_done");
|
||||
|
||||
rsp_info->cs_rdetail_len = aCtx->asn1r_octetcount; /* save the length */
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = geteaa_cs_rdetail_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteaa_cs_rdetail_cstr_done */
|
||||
/* event notification request is being decoded: action result success: */
|
||||
/* confirmed service response cstr done has been encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteaa_cs_rdetail_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_geteaa */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE & send the get event action attributes request */
|
||||
/************************************************************************/
|
||||
|
||||
MMSREQ_PEND *mp_geteaa (ST_INT chan, GETEAA_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_send (MMSOP_GET_EA_ATTR,
|
||||
M_CAST_MK_FUN (_ms_mk_geteaa_req),
|
||||
chan,(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_geteaa */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the get event action attributes request. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_geteaa (GETEAA_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_fin (MMSOP_GET_EA_ATTR,
|
||||
M_CAST_MK_FUN (_ms_mk_geteaa_req),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_geteaa_req */
|
||||
/* construct a get event action attributes request */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_geteaa_req (ASN1_ENC_CTXT *aCtx, GETEAA_REQ_INFO *info)
|
||||
{
|
||||
_ms_wr_mms_objname (aCtx, &info->evact_name); /* write event action name */
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_GET_EA_ATTR,CTX,DEF); /* tag = opcode, ctx */
|
||||
}
|
||||
321
mmslib/mmsl/rq_getec.c
Normal file
321
mmslib/mmsl/rq_getec.c
Normal file
@@ -0,0 +1,321 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rq_geteca.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the requester portion of get event */
|
||||
/* condition attributes. It decodes the get event condition */
|
||||
/* attributes response (confirm) and encodes the get event */
|
||||
/* condition attributes request. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 06 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 05 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 04 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 03 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 02 Changes to allow compile under C++ */
|
||||
/* 07/03/97 MDE 01 Op-specific info buffer handling changes */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pevn.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static GETECA_RESP_INFO *rsp_info;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID geteca_var_ref_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteca_get_ec_class (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteca_get_severity (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteca_get_as_reports (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteca_monitored_var_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteca_monitored_var_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteca_get_eval_int (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteca_get_var_ref_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteca_get_undefined (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteca_get_priority (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteca_get_mms_deletable (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_geteca_rsp */
|
||||
/* This function is called from mmsdec when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_geteca_rsp (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("Get Event Condition Attributes Response");
|
||||
|
||||
|
||||
/* get storage for request information */
|
||||
rsp_info = (GETECA_RESP_INFO *) _m_get_dec_buf (aCtx, sizeof (GETECA_RESP_INFO));
|
||||
rsp_info->priority = MMS_NORM_PRIORITY; /* set default value */
|
||||
rsp_info->severity = MMS_NORM_SEVERITY;
|
||||
/* rsp_info->mms_deletable = SD_FALSE; */
|
||||
/* rsp_info->as_reports = SD_FALSE; */
|
||||
/* rsp_info->addl_detail_pres = SD_FALSE; */
|
||||
/* rsp_info->eval_int_pres = SD_FALSE; */
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 0, geteca_get_mms_deletable);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 1, geteca_get_ec_class);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteca_get_mms_deletable */
|
||||
/* Decoding get event condition attributes response: mms deletable was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteca_get_mms_deletable (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("geteca_get_mms_deletable");
|
||||
/* read mms deletable */
|
||||
if (asn1r_get_u8 (aCtx, &(rsp_info->mms_deletable)))
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 1, geteca_get_ec_class);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteca_get_ec_class */
|
||||
/* Decoding get event condition attributes response: ec class was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteca_get_ec_class (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("geteca_get_ec_class");
|
||||
/* read event condition class */
|
||||
if (asn1r_get_i16 (aCtx, &(rsp_info->eclass)))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
else if ((rsp_info->eclass < 0) || (rsp_info->eclass > 1))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 2, geteca_get_priority);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 3, geteca_get_severity);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 4, geteca_get_as_reports);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 6, geteca_monitored_var_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 7, geteca_get_eval_int);
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteca_get_priority */
|
||||
/* Decoding get event condition attributes response: priority was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteca_get_priority (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("geteca_get_priority");
|
||||
/* read priority */
|
||||
if (asn1r_get_u8 (aCtx, &(rsp_info->priority)))
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 3, geteca_get_severity);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 4, geteca_get_as_reports);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 6, geteca_monitored_var_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 7, geteca_get_eval_int);
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteca_get_severity */
|
||||
/* Decoding get event condition attributes response: severity was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteca_get_severity (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("geteca_get_severity");
|
||||
/* read severity */
|
||||
if (asn1r_get_u8 (aCtx, &(rsp_info->severity)))
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 4, geteca_get_as_reports);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 6, geteca_monitored_var_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 7, geteca_get_eval_int);
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteca_get_as_reports */
|
||||
/* Decoding get event condition attributes response: alarm summary */
|
||||
/* reports was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteca_get_as_reports (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("geteca_get_as_reports");
|
||||
/* read alarm summary reports */
|
||||
if (asn1r_get_u8 (aCtx, &(rsp_info->as_reports)))
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 6, geteca_monitored_var_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 7, geteca_get_eval_int);
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteca_monitored_var_cstr */
|
||||
/* Decoding get event condition attributes response: monitored variable */
|
||||
/* was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteca_monitored_var_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("geteca_monitored_var_cstr");
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 0, geteca_get_var_ref_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 1, geteca_get_undefined);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteca_get_var_ref_cstr */
|
||||
/* Decoding get event condition attributes response: variable reference */
|
||||
/* was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteca_get_var_ref_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("geteca_get_var_ref_cstr");
|
||||
|
||||
rsp_info->mon_var_tag = SD_SUCCESS; /* set to variable reference */
|
||||
|
||||
_ms_get_va_var_spec (aCtx, &rsp_info->var_ref, geteca_var_ref_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteca_var_ref_done */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteca_var_ref_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("geteca_var_ref_done");
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = NULL;
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level-1] = geteca_monitored_var_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteca_get_undefined */
|
||||
/* Decoding get event condition attributes response: undefined was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteca_get_undefined (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("geteca_get_undefined");
|
||||
|
||||
rsp_info->mon_var_tag = SD_FAILURE; /* set to undefined */
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = geteca_monitored_var_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteca_monitored_var_cstr_done */
|
||||
/* Decoding get event condition attributes response: monitored variable */
|
||||
/* constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteca_monitored_var_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
rsp_info->mon_var_pres = SD_TRUE;
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 7, geteca_get_eval_int);
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteca_get_eval_int */
|
||||
/* Decoding get event condition attributes response: evaluation */
|
||||
/* interval was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteca_get_eval_int (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("geteca_get_eval_int");
|
||||
|
||||
rsp_info->eval_int_pres = SD_TRUE;
|
||||
/* read evaluation interval */
|
||||
if (asn1r_get_u32 (aCtx, &(rsp_info->eval_interval)))
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_geteca */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE and send the get event condition attributes */
|
||||
/* request. */
|
||||
/************************************************************************/
|
||||
|
||||
MMSREQ_PEND *mp_geteca (ST_INT chan, GETECA_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_send (MMSOP_GET_EC_ATTR,
|
||||
M_CAST_MK_FUN (_ms_mk_geteca_req),
|
||||
chan,(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_geteca */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the get event condition attributes request. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_geteca (GETECA_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_fin (MMSOP_GET_EC_ATTR,
|
||||
M_CAST_MK_FUN (_ms_mk_geteca_req),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_geteca_req */
|
||||
/* construct a get event condition attributes request */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_geteca_req (ASN1_ENC_CTXT *aCtx, GETECA_REQ_INFO *info)
|
||||
{
|
||||
_ms_wr_mms_objname (aCtx, &info->evcon_name); /* write the object name */
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_GET_EC_ATTR,CTX,DEF); /* tag = opcode, ctx constr */
|
||||
}
|
||||
807
mmslib/mmsl/rq_getee.c
Normal file
807
mmslib/mmsl/rq_getee.c
Normal file
@@ -0,0 +1,807 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rq_geteea.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the requester portion of the get event */
|
||||
/* enrollment attributes. It decodes the get event enrollment */
|
||||
/* attributes response (confirm) & encodes the get event */
|
||||
/* enrollment attributes request. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 07 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 06 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 04/28/00 JRB 05 Lint cleanup */
|
||||
/* 09/13/99 MDE 04 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 03 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 02 Changes to allow compile under C++ */
|
||||
/* 07/03/97 MDE 01 Op-specific info buffer handling changes */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pevn.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static GETEEA_RESP_INFO *rsp_info;
|
||||
|
||||
static EVENT_ENROLLMENT *ee_ptr;
|
||||
static ST_INT max_ev_enrolls;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID _g_eelist_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_evenroll_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_eename_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_eename_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_eename_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_ecname_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_ecname_objname (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_ecname_objname_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_ecname_objname_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_ecname_undefined (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_ecname_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_eaname_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_eaname_objname (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_eaname_objname_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_eaname_objname_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_eaname_undefined (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_eaname_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_client_app_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_app_ref_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_client_app_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_get_mms_deletable (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_get_ee_class (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_get_duration (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_get_invoke (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_get_rem_acc_delay (ASN1_DEC_CTXT *aCtx);
|
||||
#ifdef CS_SUPPORT
|
||||
static ST_VOID _g_addl_detail_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_addl_detail_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_addl_detail_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
#endif
|
||||
static ST_VOID _g_aecname_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_aecname_objname (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_aecname_objname_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_aecname_objname_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_aecname_undefined (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_aecname_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_evenroll_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_eelist_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_get_more_follows (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID _g_dec_done (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_geteea_rsp */
|
||||
/* This function is called from MMSDEC when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_geteea_rsp (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT rsp_size;
|
||||
|
||||
MLOG_CDEC0 ("Get Event Enrollment Attributes Response");
|
||||
|
||||
#if defined(FIXED_DECBUF)
|
||||
max_ev_enrolls = m_cl_max_event_enrollment;
|
||||
rsp_size = mmsl_dec_info_size;
|
||||
#else
|
||||
max_ev_enrolls = _mmsdec_msglen / 2; /* find maximum size for response info */
|
||||
if (m_cl_max_event_enrollment && (max_ev_enrolls > m_cl_max_event_enrollment))
|
||||
max_ev_enrolls = m_cl_max_event_enrollment;
|
||||
|
||||
/* get storage for request information */
|
||||
rsp_size = sizeof (GETEEA_RESP_INFO)
|
||||
+ (sizeof (EVENT_ENROLLMENT) * max_ev_enrolls);
|
||||
#endif
|
||||
|
||||
/* get storage for request information */
|
||||
rsp_info = (GETEEA_RESP_INFO *) _m_get_dec_buf (aCtx, rsp_size);
|
||||
ee_ptr = (EVENT_ENROLLMENT *) (rsp_info + 1);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 0, _g_eelist_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_eelist_cstr */
|
||||
/* Decoding get event enrollment attributes response: list of event */
|
||||
/* enrollment names constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_eelist_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("_g_eelist_cstr");
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, UNI | CONSTR, SEQ_CODE, _g_evenroll_cstr);
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = _g_eelist_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_evenroll_cstr */
|
||||
/* decoding get event enrollment attributes response: event enrollment */
|
||||
/* constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_evenroll_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("_g_evenroll_cstr");
|
||||
|
||||
rsp_info->num_of_evenroll++; /* inc # of event enrollments */
|
||||
if (rsp_info->num_of_evenroll > max_ev_enrolls)
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
else
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 0, _g_eename_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_eename_cstr */
|
||||
/* decoding get event enrollment attributes response: event enrollment */
|
||||
/* name constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_eename_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("_g_eename_cstr");
|
||||
|
||||
_ms_get_mms_objname (aCtx, &ee_ptr->evenroll_name, _g_eename_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_eename_done */
|
||||
/* decoding get event enrollment attributes response: event enrollment */
|
||||
/* name has been decoded. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_eename_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("_g_eename_done");
|
||||
/* set the cstr done function */
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = _g_eename_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_eename_cstr_done */
|
||||
/* decoding get event enrollment attributes response: event enrollment */
|
||||
/* name constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_eename_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 1, _g_ecname_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_ecname_cstr */
|
||||
/* decoding get event enrollment attributes response: event condition */
|
||||
/* name constructor was encountered */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_ecname_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("_g_ecname_cstr");
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 0, _g_ecname_objname);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 1, _g_ecname_undefined);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_ecname_objname */
|
||||
/* decoding get event enrollment attributes response: event condition */
|
||||
/* name object name constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_ecname_objname (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("_g_ecname_objname");
|
||||
|
||||
ee_ptr->evcon_name_tag = 0; /* set tag to event condition */
|
||||
|
||||
_ms_get_mms_objname (aCtx, &ee_ptr->evcon_name, _g_ecname_objname_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_ecname_objname_done */
|
||||
/* decoding get event enrollment attributes response: event condition */
|
||||
/* name object name has been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_ecname_objname_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("_g_ecname_objname_done");
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = _g_ecname_objname_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_ecname_objname_cstr_done */
|
||||
/* decoding get event enrollment attributes response: event condition */
|
||||
/* name object name constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_ecname_objname_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = _g_ecname_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_ecname_undefined */
|
||||
/* decoding get event enrollment attributes response: event condition */
|
||||
/* name undefined primitive was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_ecname_undefined (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("_g_ecname_undefined");
|
||||
|
||||
ee_ptr->evcon_name_tag = 1; /* set tag to undefined */
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = _g_ecname_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_ecname_cstr_done */
|
||||
/* decoding get event enrollment attributes response: event condition */
|
||||
/* name constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_ecname_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 2, _g_eaname_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 3, _g_client_app_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 4, _g_get_mms_deletable);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 5, _g_get_ee_class);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_eaname_cstr */
|
||||
/* decoding get event enrollment attributes response: event action */
|
||||
/* name constructor was encountered */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_eaname_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("_g_eaname_cstr");
|
||||
|
||||
ee_ptr->evact_name_pres = SD_TRUE; /* event action name present */
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 0, _g_eaname_objname);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 1, _g_eaname_undefined);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_eaname_objname */
|
||||
/* decoding get event enrollment attributes response: event action */
|
||||
/* name object name constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_eaname_objname (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("_g_eaname_objname");
|
||||
|
||||
ee_ptr->evact_name_tag = 0; /* set tag to event action */
|
||||
|
||||
_ms_get_mms_objname (aCtx, &ee_ptr->evact_name, _g_eaname_objname_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_eaname_objname_done */
|
||||
/* decoding get event enrollment attributes response: event action */
|
||||
/* name object name has been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_eaname_objname_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("_g_eaname_objname_done");
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = _g_eaname_objname_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_eaname_objname_cstr_done */
|
||||
/* decoding get event enrollment attributes response: event action */
|
||||
/* name object name constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_eaname_objname_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = _g_eaname_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_eaname_undefined */
|
||||
/* decoding get event enrollment attributes response: event action */
|
||||
/* name undefined primitive was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_eaname_undefined (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("_g_eaname_undefined");
|
||||
|
||||
ee_ptr->evact_name_tag = 1; /* set tag to undefined */
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = _g_eaname_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_eaname_cstr_done */
|
||||
/* decoding get event enrollment attributes response: event action */
|
||||
/* name constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_eaname_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 3, _g_client_app_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 4, _g_get_mms_deletable);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 5, _g_get_ee_class);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_client_app_cstr */
|
||||
/* Decoding get event enrollment attributes response: client application*/
|
||||
/* constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_client_app_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("_g_client_app_cstr");
|
||||
|
||||
ee_ptr->client_app_pres = SD_TRUE; /* set client app present */
|
||||
|
||||
_ms_get_mms_app_ref (aCtx, &ee_ptr->client_app,&ee_ptr->client_app_len,
|
||||
_g_app_ref_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_app_ref_done */
|
||||
/* Decoding get event enrollment attributes response: client application*/
|
||||
/* has been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_app_ref_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = _g_client_app_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_client_app_cstr_done */
|
||||
/* Decoding get event enrollment attributes response: client application*/
|
||||
/* constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_client_app_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 4, _g_get_mms_deletable);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 5, _g_get_ee_class);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_get_mms_deletable */
|
||||
/* Decoding get event enrollment attributes response: mms deletable was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_get_mms_deletable (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("_g_get_mms_deletable");
|
||||
/* read mms deletable */
|
||||
if (asn1r_get_bool (aCtx, &(ee_ptr->mms_deletable)))
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 5, _g_get_ee_class);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_get_ee_class */
|
||||
/* Decoding get event enrollment attributes response: event enrollment */
|
||||
/* class was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_get_ee_class (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("_g_get_ee_class");
|
||||
/* read event condition class */
|
||||
if (asn1r_get_i16 (aCtx, &(ee_ptr->ee_class)))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
else if ((ee_ptr->ee_class < 0) || (ee_ptr->ee_class > 1))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 6, _g_get_duration);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 7, _g_get_invoke);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 8, _g_get_rem_acc_delay);
|
||||
#ifdef CS_SUPPORT
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 9, _g_addl_detail_cstr);
|
||||
#endif
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR,10, _g_aecname_cstr);
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = _g_evenroll_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_get_duration */
|
||||
/* Decoding get event enrollment attributes response: duration was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_get_duration (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("_g_get_duration");
|
||||
/* read the duration */
|
||||
if (asn1r_get_i16 (aCtx, &(ee_ptr->duration)))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
else if ((ee_ptr->duration < 0) || (ee_ptr->duration > 1))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 7, _g_get_invoke);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 8, _g_get_rem_acc_delay);
|
||||
#ifdef CS_SUPPORT
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 9, _g_addl_detail_cstr);
|
||||
#endif
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR,10, _g_aecname_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_get_invoke */
|
||||
/* Decoding get event enrollment attributes response: invoke was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_get_invoke (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("_g_get_invoke");
|
||||
|
||||
ee_ptr->invoke_id_pres = SD_TRUE; /* set invoke id present */
|
||||
|
||||
/* read the invoke id */
|
||||
if (asn1r_get_u32 (aCtx, &(ee_ptr->invoke_id)))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 8, _g_get_rem_acc_delay);
|
||||
#ifdef CS_SUPPORT
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 9, _g_addl_detail_cstr);
|
||||
#endif
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR,10, _g_aecname_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_get_rem_acc_delay */
|
||||
/* Decoding get event enrollment attributes response: remaining */
|
||||
/* acceptable delay was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_get_rem_acc_delay (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("_g_get_rem_acc_delay");
|
||||
|
||||
ee_ptr->rem_acc_delay_pres = SD_TRUE; /* set rem acc delay present */
|
||||
|
||||
/* read the rem acc delay */
|
||||
if (asn1r_get_u32 (aCtx, &(ee_ptr->rem_acc_delay)))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CS_SUPPORT
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 9, _g_addl_detail_cstr);
|
||||
#endif
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR,10, _g_aecname_cstr);
|
||||
}
|
||||
|
||||
#ifdef CS_SUPPORT
|
||||
/************************************************************************/
|
||||
/* _g_addl_detail_cstr */
|
||||
/* Decoding get event enrollment attributes response: additional detail */
|
||||
/* was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_addl_detail_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("_g_addl_detail_cstr");
|
||||
|
||||
ee_ptr->addl_detail_pres = SD_TRUE; /* set flag */
|
||||
ee_ptr->addl_detail = aCtx->asn1r_field_ptr;
|
||||
|
||||
asn1r_parse_next (aCtx, _g_addl_detail_done); /* parse the contents */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_addl_detail_done */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_addl_detail_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("_g_addl_detail_done");
|
||||
|
||||
ee_ptr->addl_detail_len = aCtx->asn1r_octetcount; /* save length */
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = _g_addl_detail_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_addl_detail_cstr_done */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_addl_detail_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR,10, _g_aecname_cstr);
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_aecname_cstr */
|
||||
/* decoding get event enrollment attributes response: acknowledgement */
|
||||
/* event condition name constructor was encountered */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_aecname_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("_g_aecname_cstr");
|
||||
|
||||
ee_ptr->ackec_name_pres = SD_TRUE; /* event action name present */
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 0, _g_aecname_objname);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 1, _g_aecname_undefined);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_aecname_objname */
|
||||
/* decoding get event enrollment attributes response: acknowledgement */
|
||||
/* event condition name object name was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_aecname_objname (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("_g_aecname_objname");
|
||||
|
||||
ee_ptr->ackec_name_tag = 0; /* set tag to event action */
|
||||
|
||||
_ms_get_mms_objname (aCtx, &ee_ptr->ackec_name, _g_aecname_objname_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_aecname_objname_done */
|
||||
/* decoding get event enrollment attributes response: acknowledgement */
|
||||
/* event condition name object name has been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_aecname_objname_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("_g_aecname_objname_done");
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = _g_aecname_objname_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_aecname_objname_cstr_done */
|
||||
/* decoding get event enrollment attributes response: acknowledgement */
|
||||
/* event condition name object name constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_aecname_objname_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = _g_aecname_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_aecname_undefined */
|
||||
/* decoding get event enrollment attributes response: acknowledgement */
|
||||
/* event condition name undefined primitive was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_aecname_undefined (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("_g_aecname_undefined");
|
||||
|
||||
ee_ptr->ackec_name_tag = 1; /* set tag to undefined */
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = _g_aecname_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_aecname_cstr_done */
|
||||
/* decoding get event enrollment attributes response: acknowledgement */
|
||||
/* event condition name constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_aecname_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = _g_evenroll_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_evenroll_cstr_done */
|
||||
/* Decoding get event enrollment attributes response: event enrollment */
|
||||
/* constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_evenroll_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ee_ptr++; /* point to where next will go */
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, UNI | CONSTR, SEQ_CODE, _g_evenroll_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_eelist_cstr_done */
|
||||
/* Decoding get event enrollment attributes response: list of event */
|
||||
/* enrollments constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_eelist_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 1, _g_get_more_follows);
|
||||
|
||||
aCtx->asn1r_decode_done_fun = _g_dec_done; /* ok to be done */
|
||||
_ms_set_cs_check2 (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_get_more_follows */
|
||||
/* Decoding get event enrollment attributes response: more follows was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_get_more_follows (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("_g_get_more_follows");
|
||||
/* read more follows */
|
||||
if (asn1r_get_bool (aCtx, &(rsp_info->more_follows)))
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
|
||||
_ms_set_cs_check2 (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* _g_dec_done */
|
||||
/* decode done, realloc the structure to desired size */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID _g_dec_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT rsp_size;
|
||||
/* find actual size for request info */
|
||||
rsp_size = sizeof (GETEEA_RESP_INFO)
|
||||
+ (sizeof (EVENT_ENROLLMENT) * rsp_info->num_of_evenroll);
|
||||
|
||||
/* give back unused storage */
|
||||
_mms_dec_info = (*m_realloc_os_fun) (_mms_dec_info,rsp_size);
|
||||
rsp_info = (GETEEA_RESP_INFO *) _mms_dec_info;
|
||||
|
||||
_mms_dec_done_ok (aCtx);
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_geteea */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE & send the get event enrollment attributes request */
|
||||
/************************************************************************/
|
||||
|
||||
MMSREQ_PEND *mp_geteea (ST_INT chan, GETEEA_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_send (MMSOP_GET_EE_ATTR,
|
||||
M_CAST_MK_FUN (_ms_mk_geteea_req),
|
||||
chan,(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_geteea */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the get event enrollment attributes request. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_geteea (GETEEA_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_fin (MMSOP_GET_EE_ATTR,
|
||||
M_CAST_MK_FUN (_ms_mk_geteea_req),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_geteea_req */
|
||||
/* construct a get event enrollment attributes request */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_geteea_req (ASN1_ENC_CTXT *aCtx, GETEEA_REQ_INFO *info)
|
||||
{
|
||||
ST_INT i;
|
||||
OBJECT_NAME *obj_ptr;
|
||||
|
||||
if (info->ca_name_pres)
|
||||
{
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 5 constructor */
|
||||
_ms_wr_mms_objname (aCtx, &info->ca_name); /* write continue after name */
|
||||
asn1r_fin_constr (aCtx, 5,CTX,DEF); /* finish ctx tag 5 constructor */
|
||||
}
|
||||
|
||||
if (info->evact_name_pres)
|
||||
{
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 4 constructor */
|
||||
_ms_wr_mms_objname (aCtx, &info->evact_name); /* write event enrollment name */
|
||||
asn1r_fin_constr (aCtx, 4,CTX,DEF); /* finish ctx tag 4 constructor */
|
||||
}
|
||||
|
||||
if (info->evcon_name_pres)
|
||||
{
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 3 constructor */
|
||||
_ms_wr_mms_objname (aCtx, &info->evcon_name); /* write event condition name */
|
||||
asn1r_fin_constr (aCtx, 3,CTX,DEF); /* finish ctx tag 3 constructor */
|
||||
}
|
||||
|
||||
if (info->client_app_pres)
|
||||
{
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 2 constructor */
|
||||
asn1r_wr_delmnt (aCtx, info->client_app,info->client_app_len);
|
||||
asn1r_fin_constr (aCtx, 2,CTX,DEF); /* finish ctx tag 2 constructor */
|
||||
}
|
||||
|
||||
if (info->eenames_pres)
|
||||
{
|
||||
asn1r_strt_constr (aCtx); /* start context tag 1 cstr */
|
||||
obj_ptr = (OBJECT_NAME *) (info + 1);
|
||||
obj_ptr +=info->num_of_eenames-1; /* point to last object name */
|
||||
for (i = 0; i < info->num_of_eenames; i++)
|
||||
{
|
||||
_ms_wr_mms_objname (aCtx, obj_ptr);
|
||||
obj_ptr--;
|
||||
}
|
||||
asn1r_fin_constr (aCtx, 1,CTX,DEF); /* finish context tag 1 cstr */
|
||||
}
|
||||
|
||||
if (info->scope_of_req != 1)
|
||||
{ /* not the default (1 = client) */
|
||||
asn1r_wr_i16 (aCtx, info->scope_of_req); /* write the scope of request */
|
||||
asn1r_fin_prim (aCtx, 0, CTX); /* ctx tag 0 */
|
||||
}
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_GET_EE_ATTR,CTX,DEF); /* tag = opcode, ctx */
|
||||
}
|
||||
327
mmslib/mmsl/rq_getpi.c
Normal file
327
mmslib/mmsl/rq_getpi.c
Normal file
@@ -0,0 +1,327 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rq_getpi.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the requester portion of get program */
|
||||
/* invocation attribute. It decodes the get program invocation */
|
||||
/* attribute response (confirm) & encodes the get program */
|
||||
/* invocation attribute request. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 06 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 05 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 04 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 03 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 02 Changes to allow compile under C++ */
|
||||
/* 07/03/97 MDE 01 Op-specific info buffer handling changes */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pprg.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static GETPI_RESP_INFO *rsp_info;
|
||||
|
||||
static ST_CHAR **dom_ptr;
|
||||
static ST_INT max_domain_names;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID getpi_get_monitor (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getpi_get_start_arg (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getpi_domain_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getpi_get_reusable (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getpi_get_mms_deletable (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getpi_get_domain_name (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getpi_domain_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getpi_get_state (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID extern_done (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_get_pi_rsp */
|
||||
/* This function is called from MMSDEC when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_get_pi_rsp (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT rsp_size;
|
||||
|
||||
MLOG_CDEC0 ("Get Program Invocation Attribute Response");
|
||||
|
||||
#if defined(FIXED_DECBUF)
|
||||
max_domain_names = m_cl_max_getpi_doms;
|
||||
rsp_size = mmsl_dec_info_size;
|
||||
#else
|
||||
/* determine maximum size */
|
||||
max_domain_names = _mmsdec_msglen/2;
|
||||
if (m_cl_max_getpi_doms && (max_domain_names > m_cl_max_getpi_doms))
|
||||
max_domain_names = m_cl_max_getpi_doms;
|
||||
|
||||
/* get storage for resp info */
|
||||
rsp_size = sizeof (GETPI_RESP_INFO) + (max_domain_names * (sizeof (ST_CHAR *)));
|
||||
#endif
|
||||
|
||||
/* get storage for request information */
|
||||
rsp_info = (GETPI_RESP_INFO *) _m_get_dec_buf (aCtx, rsp_size);
|
||||
dom_ptr = (ST_CHAR **) (rsp_info + 1);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 0, getpi_get_state); /* state is next */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getpi_get_state */
|
||||
/* get program invocation attribute RESPONSE (confirm) is being decoded:*/
|
||||
/* decode the state. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getpi_get_state (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("getpi_get_state");
|
||||
|
||||
if (asn1r_get_i16 (aCtx, &(rsp_info->state))) /* read state from the message */
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 1, getpi_domain_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getpi_domain_cstr */
|
||||
/* get program invocation attribute RESPONSE (confirm) is being decoded:*/
|
||||
/* domain name list constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getpi_domain_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("getpi_domain_cstr");
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, UNI, VISTR_CODE, getpi_get_domain_name);
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = getpi_domain_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getpi_get_domain_name */
|
||||
/* get program invocation attribute RESPONSE (confirm) is being decoded:*/
|
||||
/* domain name was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getpi_get_domain_name (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("getpi_get_domain_name");
|
||||
|
||||
rsp_info->num_of_dnames++; /* increment # of domain names */
|
||||
if (rsp_info->num_of_dnames > max_domain_names)
|
||||
{ /* too many domain names */
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (aCtx->asn1r_elmnt_len > MAX_IDENT_LEN)
|
||||
{ /* domain name is too ST_INT32 */
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
/* copy domain name back onto itself shifted by one character */
|
||||
*dom_ptr = (ST_CHAR *) aCtx->asn1r_field_ptr - 1;
|
||||
if (asn1r_get_identifier (aCtx, *dom_ptr))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
dom_ptr++;
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, UNI, VISTR_CODE, getpi_get_domain_name);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getpi_domain_cstr_done */
|
||||
/* get program invocation attribute RESPONSE (confirm) is being decoded:*/
|
||||
/* domain name list constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getpi_domain_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT rsp_size;
|
||||
|
||||
rsp_size = sizeof (GETPI_RESP_INFO)
|
||||
+ (sizeof (ST_CHAR *) * rsp_info->num_of_dnames);
|
||||
|
||||
/* give back unused storage */
|
||||
_mms_dec_info = (*m_realloc_os_fun) (_mms_dec_info,rsp_size);
|
||||
rsp_info = (GETPI_RESP_INFO *) _mms_dec_info;
|
||||
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 2, getpi_get_mms_deletable);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getpi_get_mms_deletable */
|
||||
/* get program invocation attribute RESPONSE (confirm) is being decoded:*/
|
||||
/* decode the mms deletable flag. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getpi_get_mms_deletable (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("getpi_get_mms_deletable");
|
||||
|
||||
if (asn1r_get_bool (aCtx, &(rsp_info->mms_deletable))) /* read mms deletable */
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 3, getpi_get_reusable);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getpi_get_reusable */
|
||||
/* get program invocation attribute RESPONSE (confirm) is being decoded:*/
|
||||
/* decode the mms reusable flag. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getpi_get_reusable (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("getpi_get_reusable");
|
||||
|
||||
if (asn1r_get_bool (aCtx, &(rsp_info->reusable))) /* read mms deletable */
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 4, getpi_get_monitor);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getpi_get_monitor */
|
||||
/* get program invocation attribute RESPONSE (confirm) is being decoded:*/
|
||||
/* decode the monitor flag. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getpi_get_monitor (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("getpi_get_monitor");
|
||||
|
||||
if (asn1r_get_bool (aCtx, &(rsp_info->monitor))) /* read monitor from message */
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 5, getpi_get_start_arg);
|
||||
|
||||
/* If MMS IS, Check for ENCODED string */
|
||||
#ifndef MMS_LITE
|
||||
if (mms_chan_info[_mmsdechan].version) /* IS */
|
||||
#else
|
||||
if (mmsl_version) /* IS */
|
||||
#endif
|
||||
_ms_chk_for_extern (aCtx, &rsp_info->start_arg_len,
|
||||
&rsp_info->start_arg,
|
||||
extern_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getpi_get_start_arg */
|
||||
/* get program invocation attribute RESPONSE (confirm) is being decoded:*/
|
||||
/* decode the start argument. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getpi_get_start_arg (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("getpi_get_start_arg");
|
||||
|
||||
rsp_info->start_arg = (ST_UCHAR *) aCtx->asn1r_field_ptr - 1;
|
||||
rsp_info->start_arg_type = ARG_TYPE_SIMPLE;
|
||||
|
||||
if (asn1r_get_vstr (aCtx, (ST_CHAR *) rsp_info->start_arg))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* extern_done */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID extern_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("extern_done");
|
||||
|
||||
rsp_info->start_arg_type = ARG_TYPE_ENCODED;
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_getpi */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE and send the get program invocation attrubute */
|
||||
/* request. */
|
||||
/************************************************************************/
|
||||
|
||||
MMSREQ_PEND *mp_getpi (ST_INT chan, GETPI_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_send (MMSOP_GET_PI_ATTR,
|
||||
M_CAST_MK_FUN (_ms_mk_getpi_req),
|
||||
chan,(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_getpi */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the get program invocation attrubute request. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_getpi (GETPI_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_fin (MMSOP_GET_PI_ATTR,
|
||||
M_CAST_MK_FUN (_ms_mk_getpi_req),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_getpi_req */
|
||||
/* ENCODE a get program invocation attribute REQUEST: */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_getpi_req (ASN1_ENC_CTXT *aCtx, GETPI_REQ_INFO *info)
|
||||
{
|
||||
|
||||
asn1r_wr_vstr (aCtx, info->piname); /* write pgm invocation name */
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_prim (aCtx, MMSOP_GET_PI_ATTR,CTX); /* tag = opcode, context */
|
||||
}
|
||||
141
mmslib/mmsl/rq_getty.c
Normal file
141
mmslib/mmsl/rq_getty.c
Normal file
@@ -0,0 +1,141 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rq_gettype.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the requester portion of the get named */
|
||||
/* type attributes. It decodes the get named type attributes */
|
||||
/* response (confirm) & encodes the get named type attributes */
|
||||
/* request. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 06 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 05 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 04 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 03 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 02 Changes to allow compile under C++ */
|
||||
/* 07/03/97 MDE 01 Op-specific info buffer handling changes */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pvar.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static GETTYPE_RESP_INFO *rsp_info;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID gettype_type_spec_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID gettype_get_mms_deletable (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_get_type_rsp */
|
||||
/* This function is called from MMSDEC when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_get_type_rsp (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("Get Named Type Attributes Response");
|
||||
|
||||
/* get storage for request information */
|
||||
rsp_info = (GETTYPE_RESP_INFO *) _m_get_dec_buf (aCtx, sizeof (GETTYPE_RESP_INFO));
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 0, gettype_get_mms_deletable);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* gettype_get_mms_deletable */
|
||||
/* Decoding get named type attributes response: mms deletable was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID gettype_get_mms_deletable (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("gettype_get_mms_deletable");
|
||||
/* read mms deletable */
|
||||
if (asn1r_get_bool (aCtx, &(rsp_info->mms_deletable)))
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
|
||||
_ms_get_va_type_spec (aCtx, &rsp_info->type_spec, gettype_type_spec_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* gettype_type_spec_done */
|
||||
/* Decoding get named type attributes response: type specification has */
|
||||
/* been decoded. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID gettype_type_spec_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_gettype */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE and send the get named type attributes request. */
|
||||
/************************************************************************/
|
||||
|
||||
MMSREQ_PEND *mp_gettype (ST_INT chan, GETTYPE_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_send (MMSOP_GET_TYPE,
|
||||
M_CAST_MK_FUN (_ms_mk_gettype_req),
|
||||
chan,(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_gettype */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the get named type attributes request. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_gettype (GETTYPE_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_fin (MMSOP_GET_TYPE,
|
||||
M_CAST_MK_FUN (_ms_mk_gettype_req),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_gettype_req */
|
||||
/* construct a get named type attributes request */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_gettype_req (ASN1_ENC_CTXT *aCtx, GETTYPE_REQ_INFO *info)
|
||||
{
|
||||
_ms_wr_mms_objname (aCtx, &info->type_name); /* write the type name */
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_GET_TYPE,CTX,DEF); /* tag = opcode, ctx */
|
||||
}
|
||||
225
mmslib/mmsl/rq_getva.c
Normal file
225
mmslib/mmsl/rq_getva.c
Normal file
@@ -0,0 +1,225 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rq_getvar.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the requester portion of the get variable */
|
||||
/* access attributes. It decodes the get variable access */
|
||||
/* attributes response (confirm) & encodes the get variable access */
|
||||
/* attributes request. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 06 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 05 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 04 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 03 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 02 Changes to allow compile under C++ */
|
||||
/* 07/03/97 MDE 01 Op-specific info buffer handling changes */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pvar.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static GETVAR_RESP_INFO *rsp_info;
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
/* static functions with multiple references */
|
||||
|
||||
static ST_VOID getvar_typespec_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getvar_typespec_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getvar_address_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getvar_address_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getvar_address_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getvar_get_mms_deletable (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getvar_typespec_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_get_var_rsp */
|
||||
/* This function is called from MMSDEC when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_get_var_rsp (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("Get Variable Access Attributes Response");
|
||||
|
||||
/* get storage for request information */
|
||||
rsp_info = (GETVAR_RESP_INFO *) _m_get_dec_buf (aCtx, sizeof (GETVAR_RESP_INFO));
|
||||
rsp_info->address_pres = SD_FALSE; /* set default value */
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 0, getvar_get_mms_deletable);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getvar_get_mms_deletable */
|
||||
/* Decoding get variable access attributes response: mms deletable was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getvar_get_mms_deletable (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("getvar_get_mms_deletable");
|
||||
/* read mms deletable */
|
||||
if (asn1r_get_bool (aCtx, &(rsp_info->mms_deletable)))
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 1, getvar_address_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 2, getvar_typespec_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getvar_address_cstr */
|
||||
/* get variable access attributes request: address constructor was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getvar_address_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("getvar_address_cstr");
|
||||
|
||||
rsp_info->address_pres = SD_TRUE; /* set address present */
|
||||
|
||||
_ms_get_va_address (aCtx, &rsp_info->address, getvar_address_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getvar_address_done */
|
||||
/* get variable access attributes request: address has been decoded */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getvar_address_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("getvar_address_done");
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = getvar_address_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getvar_address_cstr_done */
|
||||
/* get variable access attributes request: address constructor done was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getvar_address_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 2, getvar_typespec_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getvar_typespec_cstr */
|
||||
/* get variable access attributes request: type spec constructor was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getvar_typespec_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("getvar_typespec_cstr");
|
||||
|
||||
_ms_get_va_type_spec (aCtx, &rsp_info->type_spec, getvar_typespec_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getvar_typespec_done */
|
||||
/* get variable access attributes request: type spec has been decoded */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getvar_typespec_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("getvar_typespec_done");
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = getvar_typespec_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getvar_typespec_cstr_done */
|
||||
/* get variable access attributes request: typespec constructor done was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getvar_typespec_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_getvar */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE & send the get variable access attributes request. */
|
||||
/************************************************************************/
|
||||
|
||||
MMSREQ_PEND *mp_getvar (ST_INT chan, GETVAR_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_send (MMSOP_GET_VAR,
|
||||
M_CAST_MK_FUN (_ms_mk_getvar_req),
|
||||
chan,(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_getvar */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the get variable access attributes request. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_getvar (GETVAR_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_fin (MMSOP_GET_VAR,
|
||||
M_CAST_MK_FUN (_ms_mk_getvar_req),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_getvar_req */
|
||||
/* construct a get variable access attributes request */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_getvar_req (ASN1_ENC_CTXT *aCtx, GETVAR_REQ_INFO *info)
|
||||
{
|
||||
if (info->req_tag == 1)
|
||||
{
|
||||
asn1r_strt_constr (aCtx); /* start context tag 1 cstr */
|
||||
_ms_wr_va_address (aCtx, &info->address); /* write the address */
|
||||
asn1r_fin_constr (aCtx, 1, CTX, DEF); /* finish context tag 1 cstr */
|
||||
}
|
||||
else
|
||||
{
|
||||
asn1r_strt_constr (aCtx); /* start context tag 0 cstr */
|
||||
_ms_wr_mms_objname (aCtx, &info->name); /* write the object name */
|
||||
asn1r_fin_constr (aCtx, 0, CTX, DEF); /* finish context tag 0 cstr */
|
||||
}
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_GET_VAR,CTX,DEF); /* tag = opcode, ctx */
|
||||
}
|
||||
187
mmslib/mmsl/rq_getvl.c
Normal file
187
mmslib/mmsl/rq_getvl.c
Normal file
@@ -0,0 +1,187 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rq_getvlist.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the requester portion of the get named */
|
||||
/* variable list attributes. It decodes the get named variable */
|
||||
/* list attributes response (confirm) & encodes the get named */
|
||||
/* variable list attributes request. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 06 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 05 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 04 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 03 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 02 Changes to allow compile under C++ */
|
||||
/* 07/03/97 MDE 01 Op-specific info buffer handling changes */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pvar.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static GETVLIST_RESP_INFO *rsp_info;
|
||||
|
||||
static VARIABLE_LIST *vl_ptr;
|
||||
static ST_INT max_vars;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID getvlist_list_of_var_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getvlist_get_varlist (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getvlist_get_mms_deletable (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_get_vlist_rsp */
|
||||
/* This function is called from MMSDEC when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_get_vlist_rsp (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT rsp_size;
|
||||
|
||||
MLOG_CDEC0 ("Get Named Variable List Attributes Response");
|
||||
|
||||
#if defined(FIXED_DECBUF)
|
||||
max_vars = m_cl_max_getvla_vars;
|
||||
rsp_size = mmsl_dec_info_size;
|
||||
#else
|
||||
/* find maximum storage required */
|
||||
max_vars = _mmsdec_msglen / 4;
|
||||
if (m_cl_max_getvla_vars && (max_vars > m_cl_max_getvla_vars))
|
||||
max_vars = m_cl_max_getvla_vars;
|
||||
|
||||
rsp_size = sizeof (GETVLIST_RESP_INFO)
|
||||
+ (sizeof (VARIABLE_LIST) * max_vars);
|
||||
#endif
|
||||
|
||||
/* get storage for request information */
|
||||
rsp_info = (GETVLIST_RESP_INFO *) _m_get_dec_buf (aCtx, rsp_size);
|
||||
vl_ptr = (VARIABLE_LIST *) (rsp_info + 1);
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 0, getvlist_get_mms_deletable);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getvlist_get_mms_deletable */
|
||||
/* Decoding get named variable list attributes response: mms deletable */
|
||||
/* was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getvlist_get_mms_deletable (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("getvlist_get_mms_deletable");
|
||||
/* read mms deletable */
|
||||
if (asn1r_get_bool (aCtx, &(rsp_info->mms_deletable)))
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 1, getvlist_get_varlist);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getvlist_get_varlist */
|
||||
/* Decoding get named variable list attributes response: list of */
|
||||
/* variables constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getvlist_get_varlist (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("getvlist_get_varlist");
|
||||
|
||||
_ms_get_va_var_list (aCtx, vl_ptr, &rsp_info->num_of_variables,
|
||||
max_vars, getvlist_list_of_var_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getvlist_list_of_var_done */
|
||||
/* get named variable list attributes request: list of variables has */
|
||||
/* been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getvlist_list_of_var_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT rsp_size;
|
||||
|
||||
MLOG_CDEC0 ("getvlist_list_of_var_done");
|
||||
/* find actual size for request info */
|
||||
rsp_size = sizeof (GETVLIST_RESP_INFO)
|
||||
+ (sizeof (VARIABLE_LIST) * rsp_info->num_of_variables);
|
||||
|
||||
/* give back unused storage */
|
||||
_mms_dec_info = (*m_realloc_os_fun) (_mms_dec_info,rsp_size);
|
||||
rsp_info = (GETVLIST_RESP_INFO *) _mms_dec_info;
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_getvlist */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE & send the get named variable list attributes */
|
||||
/* request. */
|
||||
/************************************************************************/
|
||||
|
||||
MMSREQ_PEND *mp_getvlist (ST_INT chan, GETVLIST_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_send (MMSOP_GET_VLIST,
|
||||
M_CAST_MK_FUN (_ms_mk_getvlist_req),
|
||||
chan,(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_getvlist */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the get named variable list attributes request. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_getvlist (GETVLIST_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_fin (MMSOP_GET_VLIST,
|
||||
M_CAST_MK_FUN (_ms_mk_getvlist_req),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_getvlist_req */
|
||||
/* construct a get named variable list attributes request */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_getvlist_req (ASN1_ENC_CTXT *aCtx, GETVLIST_REQ_INFO *info)
|
||||
{
|
||||
_ms_wr_mms_objname (aCtx, &info->vl_name); /* write named var list name */
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_GET_VLIST,CTX,DEF); /* tag = opcode, ctx */
|
||||
}
|
||||
247
mmslib/mmsl/rq_ident.c
Normal file
247
mmslib/mmsl/rq_ident.c
Normal file
@@ -0,0 +1,247 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rq_ident.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the requester portion of the Identify */
|
||||
/* service. It decodes the Identify response (indication) and */
|
||||
/* encodes the Identify request. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 05 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 04 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 03 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 02 Changes to decode buffer allocation scheme */
|
||||
/* 07/03/97 MDE 01 Op-specific info buffer handling changes */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pvmd.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : NONE */
|
||||
|
||||
static IDENT_RESP_INFO *info;
|
||||
static ST_CHAR *vstr;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID ident_get_model (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID ident_get_vendor (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID ident_get_rev (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID ident_start_as (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID ident_get_as (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID ident_as_seq_done (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_identify_rsp */
|
||||
/* Function called to decode an Identify response PDU after the PDU */
|
||||
/* type has been determined. Sets up state machine function pointers */
|
||||
/* and returns, letting the ASN1DE tools take over. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_identify_rsp (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("Identify Response");
|
||||
|
||||
|
||||
/* get storage for request information */
|
||||
info = (IDENT_RESP_INFO *) _m_get_dec_buf (aCtx, sizeof (IDENT_RESP_INFO));
|
||||
ASN1R_TAG_ADD (aCtx, CTX,0,ident_get_vendor);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* ident_get_vendor */
|
||||
/* Identify response is being decoded: vendor name has been encountered.*/
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID ident_get_vendor (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("ident_get_vendor");
|
||||
|
||||
/* copy vendor name back onto itself shifted by one character */
|
||||
|
||||
vstr = (ST_CHAR *) aCtx->asn1r_field_ptr - 1;
|
||||
if (asn1r_get_vstr (aCtx, vstr))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strlen (vstr) < MAX_VEND_LEN)
|
||||
strcpy (info->vend, vstr);
|
||||
else
|
||||
memcpy (info->vend, vstr, MAX_VEND_LEN); /* only take up to MAX_VEND_LEN */
|
||||
info->vend[ MAX_VEND_LEN ] = 0x00; /* NULL term. end just in case */
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX,1,ident_get_model);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* ident_get_model */
|
||||
/* Identify response is being decoded: model name has been encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID ident_get_model (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("ident_get_model");
|
||||
|
||||
vstr = (ST_CHAR *) aCtx->asn1r_field_ptr - 1;
|
||||
if (asn1r_get_vstr (aCtx, vstr))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strlen (vstr) < MAX_MOD_LEN)
|
||||
strcpy (info->model, vstr);
|
||||
else
|
||||
memcpy (info->model, vstr, MAX_MOD_LEN); /* only take up to MAX_MOD_LEN */
|
||||
info->model[ MAX_MOD_LEN ] = 0x00; /* NULL term. end just in case */
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX,2,ident_get_rev);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* ident_get_rev */
|
||||
/* Identify response is being decoded: revision name was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID ident_get_rev (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("ident_get_rev");
|
||||
|
||||
vstr = (ST_CHAR *) aCtx->asn1r_field_ptr - 1;
|
||||
if (asn1r_get_vstr (aCtx, vstr))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strlen (vstr) < MAX_REV_LEN)
|
||||
strcpy (info->rev, vstr);
|
||||
else
|
||||
memcpy (info->rev, vstr, MAX_REV_LEN); /* only take up to MAX_REV_LEN */
|
||||
info->rev[ MAX_REV_LEN ] = 0x00; /* NULL term. end just in case */
|
||||
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for CS info */
|
||||
|
||||
/* if using IS, could have a list of abstract syntax's following */
|
||||
|
||||
#ifndef MMS_LITE
|
||||
if (mms_chan_info[_mmsdechan].version) /* IS */
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,3,ident_start_as);
|
||||
#else
|
||||
if (mmsl_version) /* IS */
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,3,ident_start_as);
|
||||
#endif
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* ident_start_as */
|
||||
/* Identify response is being decoded: AS sequence detected */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID ident_start_as (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("ident_start_as");
|
||||
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = ident_as_seq_done;
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, UNI,OBJ_ID_CODE,ident_get_as);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* ident_get_as */
|
||||
/* Identify response is being decoded: AS obj id found */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID ident_get_as (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT new_size;
|
||||
struct mms_obj_id *obj;
|
||||
|
||||
MLOG_CDEC0 ("ident_get_as");
|
||||
|
||||
new_size = sizeof (IDENT_RESP_INFO) +
|
||||
(sizeof (struct mms_obj_id) * (info->num_as+1));
|
||||
|
||||
_mms_dec_info = (*m_realloc_os_fun) (_mms_dec_info,new_size);
|
||||
info = (IDENT_RESP_INFO *) _mms_dec_info;
|
||||
obj = (struct mms_obj_id *) (info +1); /* point to first */
|
||||
obj += info->num_as; /* point to next spot */
|
||||
|
||||
|
||||
if (asn1r_get_objid (aCtx, obj->comps,&obj->num_comps))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
/* get ready for another in the sequence */
|
||||
ASN1R_TAG_ADD (aCtx, UNI,OBJ_ID_CODE,ident_get_as);
|
||||
info->num_as++;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* ident_as_seq_done */
|
||||
/* Identify response is being decoded: AS sequence complete */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID ident_as_seq_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("ident_as_seq_done");
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for CS info */
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_ident */
|
||||
/* This function is called from the user to ENCODE and send the */
|
||||
/* Identify request PDU. */
|
||||
/************************************************************************/
|
||||
|
||||
MMSREQ_PEND *mp_ident (ST_INT chan)
|
||||
{
|
||||
return (_mms_send_null_req (chan,MMSOP_IDENTIFY));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_ident */
|
||||
/* This function is called from the user to ENCODE and send the */
|
||||
/* Identify request PDU. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_ident (ST_VOID)
|
||||
{
|
||||
return (_mms_fin_null_req (MMSOP_IDENTIFY));
|
||||
}
|
||||
|
||||
#endif
|
||||
127
mmslib/mmsl/rq_info.c
Normal file
127
mmslib/mmsl/rq_info.c
Normal file
@@ -0,0 +1,127 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2004, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rq_info.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the requester portion of information */
|
||||
/* report. It encodes the information report request. There */
|
||||
/* is no response (confirm). */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/28/05 JRB 05 Incl suicacse if MMS_LITE not defined. */
|
||||
/* 09/17/04 EJV 04 Use new mms_chk_resource. */
|
||||
/* 12/12/02 JRB 03 Add ASN1_ENC_CTXT arg to mpl_info */
|
||||
/* 12/20/01 JRB 02 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 06/15/98 MDE 01 Changes to allow compile under C++ */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pvar.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : NONE */
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
#include "mms_vcon.h"
|
||||
#include "suicacse.h" /* for SE_QUE_FULL only */
|
||||
|
||||
/************************************************************************/
|
||||
/* For debug version, use a static pointer to avoid duplication of */
|
||||
/* __FILE__ strings. */
|
||||
|
||||
#ifdef DEBUG_SISCO
|
||||
SD_CONST static ST_CHAR *SD_CONST thisFileName = __FILE__;
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_info */
|
||||
/* Create and send an information report request. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_info (ST_INT chan, INFO_REQ_INFO *info_ptr)
|
||||
{
|
||||
ST_RET rc;
|
||||
ST_INT avail;
|
||||
|
||||
/* locking here will assure that _mms_chk_resource will work in */
|
||||
/* multiple threads when mp_* functions are called to send */
|
||||
/* unconfirmed requests */
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
|
||||
avail = _mms_chk_resource (chan);
|
||||
if (avail > 0)
|
||||
rc = _mms_unconf_req_send (MMSOP_INFO_RPT,
|
||||
M_CAST_MK_FUN (_ms_mk_info_req),
|
||||
chan,(ST_CHAR *)info_ptr);
|
||||
else
|
||||
rc = SE_QUE_FULL;
|
||||
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
|
||||
return (rc);
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_info */
|
||||
/* Create an information report request. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_info (ASN1_ENC_CTXT *aCtx, INFO_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_unconf_req_fin (aCtx, MMSOP_INFO_RPT,
|
||||
M_CAST_MK_FUN (_ms_mk_info_req),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_info_req */
|
||||
/* construct an information report request */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_info_req (ASN1_ENC_CTXT *aCtx, INFO_REQ_INFO *info_ptr)
|
||||
{
|
||||
ST_INT i;
|
||||
ACCESS_RESULT *ar_ptr;
|
||||
|
||||
asn1r_strt_constr (aCtx); /* start context tag 0 cstr */
|
||||
ar_ptr = info_ptr->acc_rslt_list;
|
||||
ar_ptr += info_ptr->num_of_acc_result - 1;
|
||||
for (i = 0; i < info_ptr->num_of_acc_result; i++)
|
||||
{
|
||||
_ms_wr_va_access_rslt (aCtx, ar_ptr);
|
||||
ar_ptr--;
|
||||
}
|
||||
asn1r_fin_constr (aCtx, 0, CTX, DEF); /* finish context tag 0 cstr */
|
||||
|
||||
_ms_wr_va_spec (aCtx, &info_ptr->va_spec);
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, 0,CTX,DEF); /* tag = opcode, ctx constr */
|
||||
}
|
||||
251
mmslib/mmsl/rq_init.c
Normal file
251
mmslib/mmsl/rq_init.c
Normal file
@@ -0,0 +1,251 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2005, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rq_init.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the requester portion of the initiate */
|
||||
/* operation. It decodes the initiate response (confirm) & */
|
||||
/* encodes the initiate request. */
|
||||
/* This module makes use of common functions in mmsinit.c */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 02/28/05 EJV 04 Elim Linux warnings in if (a=b) */
|
||||
/* Fixed thisFileName for MMS-EASE */
|
||||
/* 03/11/04 GLB 03 Cleaned up "thisFileName" */
|
||||
/* 12/20/01 JRB 02 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 01 Added SD_CONST modifiers */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
#include "glbsem.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pcon.h"
|
||||
#ifndef MMS_LITE
|
||||
#include "mms_ms.h"
|
||||
#endif
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* For debug version, use a static pointer to avoid duplication of */
|
||||
/* __FILE__ strings. */
|
||||
|
||||
#if defined(DEBUG_SISCO) && (defined(S_MT_SUPPORT) || !defined(MMS_LITE))
|
||||
SD_CONST static ST_CHAR *SD_CONST thisFileName = __FILE__;
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_init_rsp */
|
||||
/* Function called to decode an Initiate response PDU after the PDU */
|
||||
/* type has been determined. Sets request to false, and calls the */
|
||||
/* common initiate decode function. */
|
||||
/* */
|
||||
/* NOTE : This functionality has been moved to mmsinit.c, because the */
|
||||
/* request and response are identical. The call to mms_init_rsp was */
|
||||
/* put back to better support MMSEASE-LITE. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_init_rsp (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("decode initiate response");
|
||||
_mms_init_dec (aCtx, SD_FALSE);
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_init */
|
||||
/* create and send an initiate request. */
|
||||
/************************************************************************/
|
||||
|
||||
MMSREQ_PEND *mp_init (ST_INT chan, ST_CHAR *partner, INIT_INFO *info_ptr)
|
||||
{
|
||||
ST_UCHAR *msg_ptr;
|
||||
MMSREQ_PEND *reqptr;
|
||||
LLP_ADDR_INFO add_llp_info;
|
||||
ST_INT i;
|
||||
ST_INT num_ui;
|
||||
INIT_UI *ui;
|
||||
INIT_UI *ui_ptr;
|
||||
ST_UCHAR *buf;
|
||||
ST_INT16 pend_req_save;
|
||||
ST_INT num_cs;
|
||||
ST_INT cs_count;
|
||||
CS_INIT_INFO *cs_info_ptr;
|
||||
ST_UCHAR *cs_build_bufs[MAX_INIT_CONTEXTS];
|
||||
ST_INT req_count;
|
||||
ASN1_ENC_CTXT localEncCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_ENC_CTXT *aCtx = &localEncCtx;
|
||||
|
||||
if (info_ptr->num_cs_init > MAX_INIT_CONTEXTS)
|
||||
{
|
||||
mms_op_err = ME_TOO_MANY_CONTEXTS;
|
||||
return ((MMSREQ_PEND *) 0);
|
||||
}
|
||||
|
||||
/* Make sure this channel is IDLE */
|
||||
if (mms_chan_info[chan].ctxt.chan_state != M_IDLE)
|
||||
{
|
||||
mms_op_err = ME_CHAN_STATE;
|
||||
return ((MMSREQ_PEND *) 0);
|
||||
}
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
|
||||
/* Flush all pending requests (should be 0 already, check anyway) */
|
||||
req_count = ms_count_req_pend (chan);
|
||||
if (req_count)
|
||||
{
|
||||
MLOG_ERR2 ("%d Pending Requests on Idle Channel %d ",
|
||||
req_count,
|
||||
(ST_INT) chan);
|
||||
}
|
||||
ms_disconn_pend_req (chan);
|
||||
|
||||
|
||||
/* Need to save the max pending request count (could be 0) before */
|
||||
/* getting the request control pointer. */
|
||||
|
||||
pend_req_save = mms_chan_info[chan].maxpend_req;
|
||||
mms_chan_info[chan].maxpend_req = 1;
|
||||
|
||||
reqptr = _ms_get_req_ptr (chan,MMSOP_INITIATE,(ST_CHAR *)info_ptr);
|
||||
|
||||
/* restore max pending request for initiate request */
|
||||
mms_chan_info[chan].maxpend_req = pend_req_save;
|
||||
|
||||
if (reqptr)
|
||||
{
|
||||
_mms_pend_init[chan].req = reqptr; /* save INITIATE request ctrl */
|
||||
|
||||
num_ui = num_cs = info_ptr->num_cs_init;
|
||||
if (info_ptr->mms_p_context_pres)
|
||||
num_ui++;
|
||||
|
||||
ui = ui_ptr = (INIT_UI *) chk_calloc (num_ui, sizeof (INIT_UI));
|
||||
cs_count = 0;
|
||||
cs_info_ptr = (CS_INIT_INFO *) (info_ptr + 1);
|
||||
for (i = 0; i < num_ui; ++i, ++ui_ptr)
|
||||
{
|
||||
/* build the core initiate, if used and position reached or if no */
|
||||
/* companion standard initiates are to be sent */
|
||||
|
||||
if ((info_ptr->mms_p_context_pres && i == info_ptr->core_position) ||
|
||||
!info_ptr->num_cs_init)
|
||||
{
|
||||
msg_ptr = _ms_mk_init (aCtx, m_build_buf,mms_max_msgsize,info_ptr,MMSINITREQ,SD_FALSE);
|
||||
ui_ptr->context = MMS_PCI;
|
||||
ui_ptr->ui_len = M_BUILD_BUF_END - msg_ptr;
|
||||
ui_ptr->ui_ptr = msg_ptr;
|
||||
}
|
||||
else /* build a CS Initiate PDU */
|
||||
{
|
||||
buf = cs_build_bufs[cs_count++] = (ST_UCHAR *)
|
||||
chk_calloc (1,M_INIT_BUILD_LEN);
|
||||
msg_ptr = _ms_mk_init (aCtx, buf,M_INIT_BUILD_LEN,
|
||||
(INIT_INFO *) cs_info_ptr,MMSINITREQ,SD_TRUE);
|
||||
|
||||
ui_ptr->context = cs_info_ptr->p_context;
|
||||
ui_ptr->ui_len = (buf + M_INIT_BUILD_LEN) - msg_ptr;
|
||||
ui_ptr->ui_ptr = msg_ptr;
|
||||
++cs_info_ptr;
|
||||
}
|
||||
}
|
||||
|
||||
add_llp_info.i.LLC.use_rem_addr = SD_FALSE;
|
||||
add_llp_info.i.LLC.req_ptr = (ST_CHAR *)reqptr;
|
||||
add_llp_info.i.LLC.send_type = INITIATE_REQ_PDU;
|
||||
|
||||
/* If a request logging function is installed, call it */
|
||||
if (m_log_req_info_fun && (mms_debug_sel & MMS_LOG_REQ))
|
||||
(*m_log_req_info_fun) (reqptr, info_ptr);
|
||||
|
||||
if ((mms_op_err = _mllp_init_req (chan, partner, reqptr->context,
|
||||
num_ui, ui,&add_llp_info)) != 0)
|
||||
{
|
||||
_ms_deact_pend_req (reqptr);
|
||||
chk_free (ui);
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return ((MMSREQ_PEND *) 0);
|
||||
}
|
||||
|
||||
chk_free (ui);
|
||||
for (i = 0; i < num_cs; ++i) /* free CS build buffers */
|
||||
chk_free (cs_build_bufs[i]);
|
||||
}
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (reqptr); /* return request control ptr */
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_init */
|
||||
/* create a core initiate request. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_init (INIT_INFO *info_ptr)
|
||||
{
|
||||
ST_RET ret;
|
||||
ASN1_ENC_CTXT localEncCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_ENC_CTXT *aCtx = &localEncCtx;
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
mmsl_msg_start = _ms_mk_init (aCtx, mmsl_enc_buf, mmsl_enc_buf_size,
|
||||
info_ptr,MMSINITREQ,SD_FALSE);
|
||||
mmsl_msg_len = (mmsl_enc_buf + mmsl_enc_buf_size) - mmsl_msg_start;
|
||||
|
||||
if (!aCtx->asn1r_encode_overrun) /* Check for encode overrun */
|
||||
ret = SD_SUCCESS;
|
||||
else
|
||||
ret = ME_ASN1_ENCODE_OVERRUN;
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ret);
|
||||
}
|
||||
|
||||
#ifdef CS_SUPPORT
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_cs_init */
|
||||
/* create a companion standard initiate request. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_INT16 mpl_cs_init (CS_INIT_INFO *info_ptr)
|
||||
{
|
||||
ASN1_ENC_CTXT localEncCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_ENC_CTXT *aCtx = &localEncCtx;
|
||||
|
||||
mmsl_msg_start = _ms_mk_init (aCtx, mmsl_enc_buf, mmsl_enc_buf_size,
|
||||
(INIT_INFO *) info_ptr,MMSINITREQ,SD_TRUE);
|
||||
mmsl_msg_len = (mmsl_enc_buf + mmsl_enc_buf_size) - mmsl_msg_start;
|
||||
|
||||
if (aCtx->asn1r_encode_overrun) /* Check for encode overrun */
|
||||
return (ME_ASN1_ENCODE_OVERRUN);
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/* mk_initiate */
|
||||
/* Note that there is only one mk_initiate function, and it is listed */
|
||||
/* in the mmsinit.c module. */
|
||||
/************************************************************************/
|
||||
|
||||
253
mmslib/mmsl/rq_namel.c
Normal file
253
mmslib/mmsl/rq_namel.c
Normal file
@@ -0,0 +1,253 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rq_namelist.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the requester portion of the GetNameList */
|
||||
/* service. It decodes the GetNameList response (indication) and */
|
||||
/* encodes the GetNameList request. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 06 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 05 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 04 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 03 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 02 Changes to allow compile under C++ */
|
||||
/* 07/03/97 MDE 01 Op-specific info buffer handling changes */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pvmd.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : NONE */
|
||||
|
||||
static NAMELIST_RESP_INFO *info;
|
||||
|
||||
static ST_CHAR **nptr;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID namelist_get_list_of_ident (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID namelist_get_identifier (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID namelist_list_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID namelist_more_follows (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_namelist_rsp */
|
||||
/* Function called to decode a GetNameList response PDU after the PDU */
|
||||
/* type has been determined. Sets up state machine function pointers */
|
||||
/* and returns, letting the ASN1DE tools take over. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_namelist_rsp (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT rsp_size;
|
||||
ST_INT max_vstr;
|
||||
|
||||
MLOG_CDEC0 ("Get Named List");
|
||||
|
||||
#if defined(FIXED_DECBUF)
|
||||
max_vstr = m_cl_max_namel_names;
|
||||
rsp_size = mmsl_dec_info_size;
|
||||
#else
|
||||
|
||||
/* Allocate enough memory to hold the namelist_resp_info structure and */
|
||||
/* a list of pointers to the names returned in the GetNameList response.*/
|
||||
|
||||
max_vstr = _mmsdec_msglen/2;
|
||||
if (m_cl_max_namel_names && (max_vstr > m_cl_max_namel_names))
|
||||
max_vstr = m_cl_max_namel_names;
|
||||
rsp_size = sizeof(NAMELIST_RESP_INFO) + (sizeof(ST_CHAR *) * max_vstr);
|
||||
#endif
|
||||
|
||||
/* get storage for request information */
|
||||
info = (NAMELIST_RESP_INFO *) _m_get_dec_buf (aCtx, rsp_size);
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,0,namelist_get_list_of_ident); /* declare next elmnt expected */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* namelist_get_list_of_ident */
|
||||
/* GetNameList response is being decoded: the SEQUENCEOF Identifier has */
|
||||
/* been encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID namelist_get_list_of_ident (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("namelist_get_list_of_ident");
|
||||
|
||||
/* Initialize nptr to just after the namelist_resp_info structure, and */
|
||||
/* initialize the number of names to zero. */
|
||||
|
||||
nptr = (ST_CHAR **) (info + 1);
|
||||
info -> num_names = 0;
|
||||
info -> more_follows = SD_TRUE; /* set the default value */
|
||||
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = namelist_list_done;
|
||||
ASN1R_TAG_ADD (aCtx, UNI,VISTR_CODE,namelist_get_identifier);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* namelist_get_identifier */
|
||||
/* GetNameList resp. is being decoded: model name has been encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID namelist_get_identifier (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("namelist_get_identifier");
|
||||
|
||||
/* Increment the number of names, assign the pointer to the new name, */
|
||||
/* and read the name into the space in the existing message. */
|
||||
|
||||
nptr[info->num_names] = (ST_CHAR *) aCtx->asn1r_field_ptr - 1;
|
||||
if (asn1r_get_identifier (aCtx, nptr[info->num_names]))
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
++info->num_names;
|
||||
|
||||
asn1r_tag_restore (aCtx);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* namelist_list_done */
|
||||
/* GetNameList response is being decoded: end of name list encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID namelist_list_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT resp_size;
|
||||
|
||||
/* There are no other data elements in the message, resize the struct. */
|
||||
|
||||
/* find the exact size of the storage used */
|
||||
resp_size = sizeof (NAMELIST_RESP_INFO) +
|
||||
(info->num_names) * sizeof (ST_CHAR *);
|
||||
|
||||
/* give back unused storage */
|
||||
_mms_dec_info = (*m_realloc_os_fun) (_mms_dec_info,resp_size);
|
||||
info = (NAMELIST_RESP_INFO *) _mms_dec_info;
|
||||
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
ASN1R_TAG_ADD (aCtx, CTX,1,namelist_more_follows);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* namelist_more_follows */
|
||||
/* GetNameList response is being decoded: the more follows parameter */
|
||||
/* has been encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID namelist_more_follows (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("namelist_more_follows");
|
||||
|
||||
if (aCtx->asn1r_elmnt_len != 1)
|
||||
{ /* If not of length 1 (boolean),*/
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE); /* stop parse, report error */
|
||||
return; /* and return. */
|
||||
}
|
||||
|
||||
if (asn1r_get_bool (aCtx, &info -> more_follows)) /* Read more_follows boolean. */
|
||||
{ /* If error reading integer, */
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE); /* stop parse, report error */
|
||||
return; /* and return. */
|
||||
}
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_namelist */
|
||||
/* ENCODE and send a GetNameList REQUEST: */
|
||||
/************************************************************************/
|
||||
|
||||
MMSREQ_PEND *mp_namelist (ST_INT chan, NAMELIST_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_send (MMSOP_GET_NAMLIST,
|
||||
M_CAST_MK_FUN (_ms_mk_namel_req),
|
||||
chan,(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_namelist */
|
||||
/* ENCODE a GetNameList REQUEST: */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_namelist (NAMELIST_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_fin (MMSOP_GET_NAMLIST,
|
||||
M_CAST_MK_FUN (_ms_mk_namel_req),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_namel_req */
|
||||
/* ENCODE a GetNameList REQUEST: */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_namel_req (ASN1_ENC_CTXT *aCtx, NAMELIST_REQ_INFO *info_ptr)
|
||||
{
|
||||
|
||||
if (info_ptr->cont_after_pres)
|
||||
{
|
||||
asn1r_wr_vstr (aCtx, info_ptr->continue_after); /* write continue-after name */
|
||||
asn1r_fin_prim (aCtx, 2,CTX);
|
||||
}
|
||||
|
||||
asn1r_strt_constr (aCtx); /* start the object scope cstr */
|
||||
|
||||
if (info_ptr->objscope == DOM_SPEC) /* if domain specific */
|
||||
asn1r_wr_vstr (aCtx, info_ptr->dname); /* write domain_name identifier */
|
||||
asn1r_fin_prim (aCtx, info_ptr->objscope,CTX); /* either NULL or identifier */
|
||||
|
||||
asn1r_fin_constr (aCtx, 1,CTX,DEF); /* finish the object scope cstr */
|
||||
|
||||
asn1r_strt_constr (aCtx); /* start extendedObjectClass */
|
||||
#ifdef CS_SUPPORT
|
||||
if (info_ptr->cs_objclass_pres) /* if companion standard */
|
||||
{
|
||||
asn1r_wr_octstr (aCtx, info_ptr->obj.cs.cs_class,info_ptr->obj.cs.len);
|
||||
asn1r_fin_constr (aCtx, 1,CTX,DEF);
|
||||
}
|
||||
else
|
||||
{
|
||||
asn1r_wr_i16 (aCtx, info_ptr->obj.mms_class); /* write the object scope */
|
||||
asn1r_fin_prim (aCtx, 0,CTX);
|
||||
}
|
||||
#else
|
||||
asn1r_wr_i16 (aCtx, info_ptr->obj.mms_class); /* write the object scope */
|
||||
asn1r_fin_prim (aCtx, 0,CTX);
|
||||
#endif
|
||||
asn1r_fin_constr (aCtx, 0,CTX,DEF); /* finish the extendedObjClass */
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_GET_NAMLIST,CTX,DEF); /* complete GetNameList req */
|
||||
}
|
||||
|
||||
276
mmslib/mmsl/rq_read.c
Normal file
276
mmslib/mmsl/rq_read.c
Normal file
@@ -0,0 +1,276 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rq_read.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the requester portion of variable read. */
|
||||
/* It decodes the variable read response (confirm) & encodes */
|
||||
/* the variable read request. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 08 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 07 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 05/29/01 RKR 06 Corrected max_acc_rslt = _mmsdec_msglen / 2 */
|
||||
/* 01/21/00 MDE 05 Corrected buffer size calculations for */
|
||||
/* 'm_cl_max_read_acc_rslt' != 0 */
|
||||
/* 09/13/99 MDE 04 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 03 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 02 Changes to allow compile under C++ */
|
||||
/* 06/27/97 MDE 01 Fixed max_acc_rslt bug */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pvar.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static READ_RESP_INFO *rsp_info;
|
||||
static ACCESS_RESULT *ar_ptr;
|
||||
|
||||
static ST_INT max_vars;
|
||||
static ST_INT max_acc_rslt;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID read_acc_rslt_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID read_acc_rslt_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID read_acc_rslt_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID read_va_spec_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID read_va_spec_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID read_va_spec_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_read_rsp */
|
||||
/* This function is called from MMSDEC when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_read_rsp (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT rsp_size;
|
||||
ST_INT rsp_size2;
|
||||
|
||||
MLOG_CDEC0 ("Variable Read Response");
|
||||
|
||||
#if defined(FIXED_DECBUF)
|
||||
max_acc_rslt = m_cl_max_read_acc_rslt;
|
||||
max_vars = m_cl_max_read_var_spec;
|
||||
rsp_size = mmsl_dec_info_size;
|
||||
#else
|
||||
max_vars = _mmsdec_msglen / 4;
|
||||
max_acc_rslt = _mmsdec_msglen / 2;
|
||||
if (m_cl_max_read_acc_rslt && (max_acc_rslt > m_cl_max_read_acc_rslt))
|
||||
max_acc_rslt = m_cl_max_read_acc_rslt;
|
||||
|
||||
if (m_cl_read_spec_in_result)
|
||||
{
|
||||
if (m_cl_max_read_var_spec && (max_vars > m_cl_max_read_var_spec))
|
||||
max_vars = m_cl_max_read_var_spec;
|
||||
rsp_size2 = sizeof(READ_RESP_INFO) + (sizeof(VARIABLE_LIST) * max_vars);
|
||||
}
|
||||
else
|
||||
rsp_size2 = 0;
|
||||
|
||||
rsp_size = sizeof(READ_RESP_INFO) + (sizeof(ACCESS_RESULT) * max_acc_rslt);
|
||||
if (rsp_size < rsp_size2)
|
||||
rsp_size = rsp_size2;
|
||||
#endif
|
||||
|
||||
/* get storage for request information */
|
||||
rsp_info = (READ_RESP_INFO *) _m_get_dec_buf (aCtx, rsp_size);
|
||||
rsp_info->va_spec_pres = SD_FALSE; /* set default value */
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 0, read_va_spec_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 1, read_acc_rslt_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* read_va_spec_cstr */
|
||||
/* decoding variable read request: variable access constructor was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID read_va_spec_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("read_va_spec_cstr");
|
||||
|
||||
rsp_info->va_spec_pres = SD_TRUE; /* set va spec present */
|
||||
|
||||
_ms_get_va_spec (aCtx, &rsp_info->va_spec, max_vars, read_va_spec_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* read_va_spec_done */
|
||||
/* decoding variable read request: variable access specification */
|
||||
/* has been decoded. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID read_va_spec_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("read_va_spec_done");
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = read_va_spec_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* read_va_spec_cstr_done */
|
||||
/* decoding variable read request: variable access constructor done */
|
||||
/* was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID read_va_spec_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 1, read_acc_rslt_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* read_acc_rslt_cstr */
|
||||
/* decoding variable read request: access result constructor was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID read_acc_rslt_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
VARIABLE_LIST *temp;
|
||||
|
||||
MLOG_CDEC0 ("read_acc_rslt_cstr");
|
||||
|
||||
temp = (VARIABLE_LIST *) (rsp_info + 1);
|
||||
temp += rsp_info->va_spec.num_of_variables;
|
||||
|
||||
rsp_info->num_of_acc_result = 0;
|
||||
rsp_info->acc_rslt_list = (ACCESS_RESULT *) temp;
|
||||
ar_ptr = rsp_info->acc_rslt_list;
|
||||
|
||||
_ms_get_va_access_rslt (aCtx, ar_ptr, read_acc_rslt_done);
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = read_acc_rslt_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* read_acc_rslt_done */
|
||||
/* decoding variable read request: access result has been decoded. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID read_acc_rslt_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("read_acc_rslt_done");
|
||||
|
||||
rsp_info->num_of_acc_result++;
|
||||
if ((rsp_info->num_of_acc_result + 1) <= max_acc_rslt)
|
||||
{
|
||||
ar_ptr++;
|
||||
_ms_get_va_access_rslt (aCtx, ar_ptr, read_acc_rslt_done);
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* read_acc_rslt_cstr_done */
|
||||
/* decoding variable read request: access result constructor done */
|
||||
/* was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID read_acc_rslt_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT rsp_size;
|
||||
VARIABLE_LIST *temp;
|
||||
|
||||
MLOG_CDEC0 ("read_acc_rslt_cstr_done");
|
||||
|
||||
/* find actual size for request info */
|
||||
rsp_size = sizeof (READ_RESP_INFO)
|
||||
+ (sizeof (VARIABLE_LIST)*rsp_info->va_spec.num_of_variables)
|
||||
+ (sizeof (ACCESS_RESULT)*rsp_info->num_of_acc_result);
|
||||
|
||||
/* give back unused storage */
|
||||
_mms_dec_info = (*m_realloc_os_fun) (_mms_dec_info,rsp_size);
|
||||
rsp_info = (READ_RESP_INFO *) _mms_dec_info;
|
||||
|
||||
/* some C run time library mem mgmt. functions will always give back a */
|
||||
/* new pointer when reallocating smaller. In the case of read_resp_info*/
|
||||
/* we have to update the acc_rslt_list ptr to point to this new mem loc */
|
||||
|
||||
temp = (VARIABLE_LIST *) (rsp_info + 1);
|
||||
temp += rsp_info->va_spec.num_of_variables;
|
||||
rsp_info->acc_rslt_list = (ACCESS_RESULT *) temp;
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_read */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE & send the variable read request. */
|
||||
/************************************************************************/
|
||||
|
||||
MMSREQ_PEND *mp_read (ST_INT chan, READ_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_send (MMSOP_READ,
|
||||
M_CAST_MK_FUN (_ms_mk_read_req),
|
||||
chan,(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_read */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the variable read request. */
|
||||
/************************************************************************/
|
||||
|
||||
|
||||
ST_RET mpl_read (READ_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_fin (MMSOP_READ,
|
||||
M_CAST_MK_FUN (_ms_mk_read_req),
|
||||
(ST_CHAR *) info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_read_req */
|
||||
/* construct a variable read request. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_read_req (ASN1_ENC_CTXT *aCtx, READ_REQ_INFO *info)
|
||||
{
|
||||
|
||||
asn1r_strt_constr (aCtx); /* start context tag 1 cstr */
|
||||
_ms_wr_va_spec (aCtx, &info->va_spec);
|
||||
asn1r_fin_constr (aCtx, 1, CTX, DEF); /* finish context tag 1 cstr */
|
||||
|
||||
if (info->spec_in_result)
|
||||
{ /* not the default (false) */
|
||||
asn1r_wr_bool (aCtx, info->spec_in_result); /* write specification in rslt */
|
||||
asn1r_fin_prim (aCtx, 0, CTX); /* context tag 0 primitive */
|
||||
}
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_READ,CTX,DEF); /* tag = opcode, ctx */
|
||||
}
|
||||
117
mmslib/mmsl/rq_repea.c
Normal file
117
mmslib/mmsl/rq_repea.c
Normal file
@@ -0,0 +1,117 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rq_repeas.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the requester portion of the report event */
|
||||
/* action status. It decodes the report event action status */
|
||||
/* response (confirm) & encodes the report event action status */
|
||||
/* request. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 06 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 05 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 04 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 03 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 02 Changes to allow compile under C++ */
|
||||
/* 07/03/97 MDE 01 Op-specific info buffer handling changes */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pevn.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static REPEAS_RESP_INFO *rsp_info;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_repeas_rsp */
|
||||
/* This function is called from MMSDEC when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_repeas_rsp (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("Report Event Action Status Response");
|
||||
|
||||
/* get storage for request information */
|
||||
rsp_info = (REPEAS_RESP_INFO *) _m_get_dec_buf (aCtx, sizeof (REPEAS_RESP_INFO));
|
||||
|
||||
if (asn1r_get_u32 (aCtx, &rsp_info->num_of_ev_enroll))
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
else
|
||||
{
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_repeas */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE & send the report event action status request. */
|
||||
/************************************************************************/
|
||||
|
||||
MMSREQ_PEND *mp_repeas (ST_INT chan, REPEAS_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_send (MMSOP_REP_EA_STAT,
|
||||
M_CAST_MK_FUN (_ms_mk_repeas_req),
|
||||
chan,(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_repeas */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the report event action status request. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_repeas (REPEAS_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_fin (MMSOP_REP_EA_STAT,
|
||||
M_CAST_MK_FUN (_ms_mk_repeas_req),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_repeas_req */
|
||||
/* construct a get event action attributes request */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_repeas_req (ASN1_ENC_CTXT *aCtx, REPEAS_REQ_INFO *info)
|
||||
{
|
||||
_ms_wr_mms_objname (aCtx, &info->evact_name); /* write event action name */
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_REP_EA_STAT,CTX,DEF); /* tag = opcode, ctx */
|
||||
}
|
||||
249
mmslib/mmsl/rq_repec.c
Normal file
249
mmslib/mmsl/rq_repec.c
Normal file
@@ -0,0 +1,249 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rq_repecs.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the requester portion of report event */
|
||||
/* condition status. It decodes the report event condition */
|
||||
/* status response (confirm) and encodes the report event */
|
||||
/* condition status request. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 06 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 05 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 04 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 03 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 02 Changes to allow compile under C++ */
|
||||
/* 07/03/97 MDE 01 Op-specific info buffer handling changes */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pevn.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static REPECS_RESP_INFO *rsp_info;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID repecs_tta_time_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID repecs_tti_time_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID repecs_tta_time_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID repecs_tta_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID repecs_get_enabled (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID repecs_get_enrolls (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID repecs_get_cur_state (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID repecs_tti_done (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_repecs_rsp */
|
||||
/* This function is called from mmsdec when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_repecs_rsp (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("Report Event Condition Status Response");
|
||||
|
||||
|
||||
|
||||
/* get storage for request information */
|
||||
rsp_info = (REPECS_RESP_INFO *) _m_get_dec_buf (aCtx, sizeof (REPECS_RESP_INFO));
|
||||
rsp_info->enabled_pres = SD_FALSE; /* set default value */
|
||||
rsp_info->tta_time_pres = SD_FALSE;
|
||||
rsp_info->tti_time_pres = SD_FALSE;
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 0, repecs_get_cur_state);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* repecs_get_cur_state */
|
||||
/* Decoding report event condition status response: current state was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID repecs_get_cur_state (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("repecs_get_cur_state");
|
||||
/* read current state */
|
||||
if (asn1r_get_i16 (aCtx, &(rsp_info->cur_state)))
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 1, repecs_get_enrolls);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* repecs_get_enrolls */
|
||||
/* Decoding report event condition status response: number of event */
|
||||
/* enrollments was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID repecs_get_enrolls (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("repecs_get_enrolls");
|
||||
/* read number of event enrollments */
|
||||
if (asn1r_get_u32 (aCtx, &(rsp_info->num_of_ev_enroll)))
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 2, repecs_get_enabled);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 3, repecs_tta_time_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 4, repecs_tti_time_cstr);
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* repecs_get_enabled */
|
||||
/* Decoding report event condition status response: enabled indicator */
|
||||
/* was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID repecs_get_enabled (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("repecs_get_enabled");
|
||||
|
||||
rsp_info->enabled_pres = SD_TRUE; /* set enabled present */
|
||||
/* read enabled indicator */
|
||||
if (asn1r_get_bool (aCtx, &(rsp_info->enabled)))
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 3, repecs_tta_time_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 4, repecs_tti_time_cstr);
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* repecs_tta_time_cstr */
|
||||
/* Decoding report event condition status response: transition to */
|
||||
/* active time cstr was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID repecs_tta_time_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("repecs_tta_time_cstr");
|
||||
|
||||
rsp_info->tta_time_pres = SD_TRUE; /* set tran to active present */
|
||||
|
||||
_ms_get_mms_evtime (aCtx, &rsp_info->tta_time, repecs_tta_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* repecs_tta_done */
|
||||
/* Decoding report event condition status response: transition to */
|
||||
/* active time has been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID repecs_tta_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("repecs_tta_done");
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = repecs_tta_time_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* repecs_tta_time_cstr_done */
|
||||
/* Decoding report event condition status response: transition to */
|
||||
/* active time cstr done has been encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID repecs_tta_time_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 4, repecs_tti_time_cstr);
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* repecs_tti_time_cstr */
|
||||
/* Decoding report event condition status response: transition to */
|
||||
/* idle time cstr has been encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID repecs_tti_time_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("repecs_tti_time_cstr");
|
||||
|
||||
rsp_info->tti_time_pres = SD_TRUE; /* set tran to active present */
|
||||
|
||||
_ms_get_mms_evtime (aCtx, &rsp_info->tti_time, repecs_tti_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* repecs_tti_done */
|
||||
/* Decoding report event condition status response: transition to */
|
||||
/* idle time has been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID repecs_tti_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("repecs_tti_done");
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_repecs */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE and send the report event condition status */
|
||||
/* request. */
|
||||
/************************************************************************/
|
||||
|
||||
MMSREQ_PEND *mp_repecs (ST_INT chan, REPECS_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_send (MMSOP_REP_EC_STAT,
|
||||
M_CAST_MK_FUN (_ms_mk_repecs_req),
|
||||
chan,(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_repecs */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the report event condition status request. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_repecs (REPECS_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_fin (MMSOP_REP_EC_STAT,
|
||||
M_CAST_MK_FUN (_ms_mk_repecs_req),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_repecs_req */
|
||||
/* construct a report event condition status request */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_repecs_req (ASN1_ENC_CTXT *aCtx, REPECS_REQ_INFO *info)
|
||||
{
|
||||
_ms_wr_mms_objname (aCtx, &info->evcon_name); /* write the object name */
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_REP_EC_STAT,CTX,DEF); /* tag = opcode, ctx constr */
|
||||
}
|
||||
262
mmslib/mmsl/rq_repee.c
Normal file
262
mmslib/mmsl/rq_repee.c
Normal file
@@ -0,0 +1,262 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rq_repees.c */
|
||||
/* PRODUCT(S) : MMSEASE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the requester portion of the report event */
|
||||
/* enrollment status. It decodes the report event enrollment */
|
||||
/* status response (confirm) & encodes the report event enrollment */
|
||||
/* status request. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 07 Remove "thisFileName" */
|
||||
/* 03/31/03 JRB 06 asn1r_get_bitstr: add max_bits arg. */
|
||||
/* 12/20/01 JRB 05 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 04 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 03 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 02 Changes to allow compile under C++ */
|
||||
/* 07/03/97 MDE 01 Op-specific info buffer handling changes */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pevn.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static REPEES_RESP_INFO *rsp_info;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID repees_get_ect_prim (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID repees_get_ect_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID repees_get_ect_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID repees_get_not_lost (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID repees_get_duration (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID repees_get_alarm_ack_rule (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID repees_get_cur_state (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_repees_rsp */
|
||||
/* This function is called from MMSDEC when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_repees_rsp (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("Report Event Enrollment Status Response");
|
||||
|
||||
/* get storage for request information */
|
||||
rsp_info = (REPEES_RESP_INFO *) _m_get_dec_buf (aCtx, sizeof (REPEES_RESP_INFO));
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 0, repees_get_ect_prim);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 0, repees_get_ect_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* repees_get_ect_prim */
|
||||
/* report event enrollment status response is being decoded: event */
|
||||
/* condition transitions primitive was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID repees_get_ect_prim (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("repees_get_ect_prim");
|
||||
if (!asn1r_get_bitstr (aCtx, &rsp_info->ec_transitions, 7))
|
||||
repees_get_ect_done (aCtx); /* set up for the next data element */
|
||||
else
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* repees_get_ect_cstr */
|
||||
/* report event enrollment status response is being decoded: event */
|
||||
/* condition transitions constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID repees_get_ect_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("repees_get_ect_cstr");
|
||||
/* set up bitstring cstr done function */
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = repees_get_ect_done;
|
||||
|
||||
asn1r_get_bitstr_cstr (aCtx, 7,&rsp_info->ec_transitions);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* repees_get_ect_done */
|
||||
/* report event enrollment status response is being decoded: event */
|
||||
/* condition transitions constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID repees_get_ect_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("repees_get_ect_done");
|
||||
/* Check aCtx->asn1r_bitcount for correct # of bits */
|
||||
if (aCtx->asn1r_bitcount != 7) /* should be 7 bits */
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
else /* now get alarm ack rule */
|
||||
{
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 1, repees_get_not_lost);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 2, repees_get_duration);
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* repees_get_not_lost */
|
||||
/* report event enrollment status response is being decoded: */
|
||||
/* notification lost has been encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID repees_get_not_lost (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("repees_get_not_lost");
|
||||
|
||||
if (asn1r_get_bool (aCtx, &(rsp_info->not_lost))) /* get notification lost*/
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 2, repees_get_duration);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* repees_get_duration */
|
||||
/* Decoding report event enrollment status response: duration was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID repees_get_duration (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("repees_get_duration");
|
||||
/* read duration */
|
||||
if (asn1r_get_i16 (aCtx, &(rsp_info->duration)))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
else if ((rsp_info->duration < 0) || (rsp_info->duration > 1))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 3, repees_get_alarm_ack_rule);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 4, repees_get_cur_state);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* repees_get_alarm_ack_rule */
|
||||
/* Decoding report event enrollment status response: alarm ack rule */
|
||||
/* was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID repees_get_alarm_ack_rule (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("repees_get_alarm_ack_rule");
|
||||
|
||||
rsp_info->alarm_ack_rule_pres = SD_TRUE;
|
||||
/* read alarm ack rule */
|
||||
if (asn1r_get_i16 (aCtx, &(rsp_info->alarm_ack_rule)))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
else if ((rsp_info->alarm_ack_rule < 0) || (rsp_info->alarm_ack_rule > 3))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 4, repees_get_cur_state);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* repees_get_cur_state */
|
||||
/* Decoding report event enrollment status response: current state was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID repees_get_cur_state (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("repees_get_cur_state");
|
||||
/* read current state */
|
||||
if (asn1r_get_i16 (aCtx, &(rsp_info->cur_state)))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
else if ((rsp_info->cur_state < 0) || (rsp_info->cur_state > 7))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_repees */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE & send the report event enrollment status request */
|
||||
/************************************************************************/
|
||||
|
||||
MMSREQ_PEND *mp_repees (ST_INT chan, REPEES_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_send (MMSOP_REP_EE_STAT,
|
||||
M_CAST_MK_FUN (_ms_mk_repees_req),
|
||||
chan,(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_repees */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the report event enrollment status request. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_repees (REPEES_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_fin (MMSOP_REP_EE_STAT,
|
||||
M_CAST_MK_FUN (_ms_mk_repees_req),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_repees_req */
|
||||
/* construct a report event enrollment status response */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_repees_req (ASN1_ENC_CTXT *aCtx, REPEES_REQ_INFO *info)
|
||||
{
|
||||
_ms_wr_mms_objname (aCtx, &info->evenroll_name);/* write event enrollment name */
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_REP_EE_STAT,CTX,DEF); /* tag = opcode, ctx */
|
||||
}
|
||||
107
mmslib/mmsl/rq_stat.c
Normal file
107
mmslib/mmsl/rq_stat.c
Normal file
@@ -0,0 +1,107 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rq_stat.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the functions to decode a status response */
|
||||
/* and encode a status request message. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 04 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 03 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* Deleted mms_status proto (see mms_dfun.h) */
|
||||
/* 09/13/99 MDE 02 Added SD_CONST modifiers */
|
||||
/* 06/15/98 MDE 01 Changes to allow compile under C++ */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pvmd.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_status_rsp */
|
||||
/* This function is called from mmsdec to decode a Status response PDU */
|
||||
/* after the PDU type has been determined. It simply calls mms_status */
|
||||
/* in the module mmsstat.c. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_status_rsp (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("decode status response");
|
||||
|
||||
mms_status (aCtx);
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_status */
|
||||
/* This function is called from the user to ENCODE and send the */
|
||||
/* Status request PDU. */
|
||||
/************************************************************************/
|
||||
|
||||
MMSREQ_PEND *mp_status (ST_INT chan, STATUS_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_send (MMSOP_STATUS,
|
||||
M_CAST_MK_FUN (_ms_mk_stat_req),
|
||||
chan,(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_status */
|
||||
/* This function is called by the user to ENCODE the Status request */
|
||||
/* PDU. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_status (STATUS_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_fin (MMSOP_STATUS,
|
||||
M_CAST_MK_FUN (_ms_mk_stat_req),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_stat_req */
|
||||
/* ENCODE an Status REQUEST: */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_stat_req (ASN1_ENC_CTXT *aCtx, STATUS_REQ_INFO *info_ptr)
|
||||
{
|
||||
|
||||
/* Write the ST_BOOLEAN value represented by the "extended" component of */
|
||||
/* the status_req_info structure (0 means false, nonzero means true). */
|
||||
|
||||
if (info_ptr -> extended)
|
||||
asn1r_wr_bool (aCtx, 0x7F);
|
||||
else
|
||||
asn1r_wr_bool (aCtx, 0x00);
|
||||
|
||||
/* Write the context specific explicit tag for this opcode on the */
|
||||
/* ST_BOOLEAN data element just written. */
|
||||
|
||||
asn1r_fin_prim (aCtx, MMSOP_STATUS,CTX); /* tag = opcode, context */
|
||||
}
|
||||
|
||||
|
||||
104
mmslib/mmsl/rq_trige.c
Normal file
104
mmslib/mmsl/rq_trige.c
Normal file
@@ -0,0 +1,104 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rq_trige.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the requester portion of trigger event. */
|
||||
/* It decodes the trigger event response (confirm) & encodes the */
|
||||
/* trigger event request. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 12/20/01 JRB 02 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 06/15/98 MDE 01 Changes to allow compile under C++ */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pevn.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : NONE */
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_trige_rsp */
|
||||
/* NOTE : Since the mms_trige_rsp is a NULL PDU, the decode is */
|
||||
/* continued by '_mms_null_pdu_dec', which simply sets decode done = 1 */
|
||||
/* and sets the decode done function to point to the general decode done*/
|
||||
/* fun. See mmsdec.c for the general functions. */
|
||||
/************************************************************************/
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_trige */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE and send the trigger event request. */
|
||||
/************************************************************************/
|
||||
|
||||
MMSREQ_PEND *mp_trige (ST_INT chan, TRIGE_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_send (MMSOP_TRIGGER_EV,
|
||||
M_CAST_MK_FUN (_ms_mk_trige_req),
|
||||
chan,(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_trige */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the trigger event request. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_trige (TRIGE_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_fin (MMSOP_TRIGGER_EV,
|
||||
M_CAST_MK_FUN (_ms_mk_trige_req),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_trige_req */
|
||||
/* ENCODE a trigger event REQUEST: */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_trige_req (ASN1_ENC_CTXT *aCtx, TRIGE_REQ_INFO *info)
|
||||
{
|
||||
if (info->priority_pres)
|
||||
{
|
||||
asn1r_wr_u8 (aCtx, info->priority); /* write the priority */
|
||||
asn1r_fin_prim (aCtx, 1, CTX); /* ctx tag 1 */
|
||||
}
|
||||
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 0 constructor */
|
||||
_ms_wr_mms_objname (aCtx, &info->evcon_name); /* write event cond mon name */
|
||||
asn1r_fin_constr (aCtx, 0,CTX,DEF); /* context specific tag 0 */
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_TRIGGER_EV,CTX,DEF); /* tag = opcode, ctx constr */
|
||||
}
|
||||
118
mmslib/mmsl/rq_ustat.c
Normal file
118
mmslib/mmsl/rq_ustat.c
Normal file
@@ -0,0 +1,118 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rq_ustat.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the functions to encode an unsolicited */
|
||||
/* status request. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/28/05 JRB 05 Incl suicacse if MMS_LITE not defined. */
|
||||
/* 09/17/04 EJV 04 Use new mms_chk_resource. */
|
||||
/* 12/12/02 JRB 03 Add ASN1_ENC_CTXT arg to mpl_ustatus. */
|
||||
/* 12/20/01 JRB 02 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 06/15/98 MDE 01 Changes to allow compile under C++ */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
#ifndef MMS_LITE
|
||||
#include "mms_pvmd.h"
|
||||
#include "suicacse.h" /* for SE_QUE_FULL only */
|
||||
|
||||
/************************************************************************/
|
||||
/* For debug version, use a static pointer to avoid duplication of */
|
||||
/* __FILE__ strings. */
|
||||
|
||||
#ifdef DEBUG_SISCO
|
||||
SD_CONST static ST_CHAR *SD_CONST thisFileName = __FILE__;
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_ustatus */
|
||||
/* This function is called from the user to ENCODE and send the */
|
||||
/* Unsolicited Status request PDU. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_ustatus (ST_INT chan, USTATUS_REQ_INFO *info_ptr)
|
||||
{
|
||||
ST_RET rc;
|
||||
ST_INT avail;
|
||||
|
||||
/* locking here will assure that _mms_chk_resource will work in */
|
||||
/* multiple threads when mp_* functions are called to send */
|
||||
/* unconfirmed requests */
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
|
||||
avail = _mms_chk_resource (chan);
|
||||
if (avail > 0)
|
||||
rc = _mms_unconf_req_send (MMSOP_USTATUS,
|
||||
M_CAST_MK_FUN (_ms_mk_ustat_req),
|
||||
chan,(ST_CHAR *)info_ptr);
|
||||
else
|
||||
rc = SE_QUE_FULL;
|
||||
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
|
||||
return (rc);
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_ustatus */
|
||||
/* This function is called by the user to ENCODE an Unsolicited Status */
|
||||
/* request PDU. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_ustatus (ASN1_ENC_CTXT *aCtx, USTATUS_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_unconf_req_fin (aCtx, MMSOP_USTATUS,
|
||||
M_CAST_MK_FUN (_ms_mk_ustat_req),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_ustat_req */
|
||||
/* ENCODE an Status RESPONSE: */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_ustat_req (ASN1_ENC_CTXT *aCtx, USTATUS_REQ_INFO *info)
|
||||
{
|
||||
|
||||
if (info->local_detail_pres) /* if present, write the local */
|
||||
{ /* detail parameter */
|
||||
asn1r_wr_bitstr (aCtx, info->local_detail,info->local_detail_len);
|
||||
asn1r_fin_prim (aCtx, 2,CTX);
|
||||
}
|
||||
|
||||
asn1r_wr_i16 (aCtx, info->physical_stat); /* write the physical status */
|
||||
asn1r_fin_prim (aCtx, 1,CTX);
|
||||
|
||||
asn1r_wr_i16 (aCtx, info->logical_stat); /* write the logical status */
|
||||
asn1r_fin_prim (aCtx, 0,CTX);
|
||||
|
||||
/* Write the context-specific tag for this unconfirmed request service. */
|
||||
asn1r_fin_constr (aCtx, 1,CTX,DEF);
|
||||
}
|
||||
|
||||
212
mmslib/mmsl/rq_write.c
Normal file
212
mmslib/mmsl/rq_write.c
Normal file
@@ -0,0 +1,212 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rq_write.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the requester portion of variable write. */
|
||||
/* It decodes the variable write response (confirm) & encodes */
|
||||
/* the variable write request. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 06 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 05 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 04 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 03 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 02 Changes to allow compile under C++ */
|
||||
/* 07/03/97 MDE 01 Op-specific info buffer handling changes */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pvar.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static WRITE_RESP_INFO *rsp_info;
|
||||
|
||||
static WRITE_RESULT *rslt_ptr;
|
||||
static ST_INT max_rslts;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID write_get_failure (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID write_get_success (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID write_all_done (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_write_rsp */
|
||||
/* This function is called from MMSDEC when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_write_rsp (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT rsp_size;
|
||||
|
||||
MLOG_CDEC0 ("Variable Write Response");
|
||||
|
||||
#if defined(FIXED_DECBUF)
|
||||
max_rslts = m_cl_max_write_rslts;
|
||||
rsp_size = mmsl_dec_info_size;
|
||||
#else
|
||||
max_rslts = _mmsdec_msglen / 2; /* find maximum storage required */
|
||||
if (m_cl_max_write_rslts && (max_rslts > m_cl_max_write_rslts))
|
||||
max_rslts = m_cl_max_write_rslts;
|
||||
|
||||
rsp_size = sizeof (WRITE_RESP_INFO) + (sizeof (WRITE_RESULT) * max_rslts);
|
||||
#endif
|
||||
|
||||
/* get storage for request information */
|
||||
rsp_info = (WRITE_RESP_INFO *) _m_get_dec_buf (aCtx, rsp_size);
|
||||
|
||||
rsp_info->num_of_result = 0;
|
||||
rslt_ptr = (WRITE_RESULT *) (rsp_info + 1);
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 0, write_get_failure);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 1, write_get_success);
|
||||
aCtx->asn1r_decode_done_fun = write_all_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* write_get_failure */
|
||||
/* Decoding variable write response: failure was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID write_get_failure (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("write_get_failure");
|
||||
|
||||
if (++rsp_info->num_of_result > max_rslts)
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
rslt_ptr->resp_tag = SD_FALSE; /* set tag to failure */
|
||||
|
||||
if (asn1r_get_i16 (aCtx, &(rslt_ptr->failure))) /* read the failure code */
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
|
||||
rslt_ptr++; /* point at the next element */
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 0, write_get_failure);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 1, write_get_success);
|
||||
_ms_set_cs_check2 (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* write_get_success */
|
||||
/* Decoding variable write response: success was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID write_get_success (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("write_get_success");
|
||||
|
||||
if (++rsp_info->num_of_result > max_rslts)
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
rslt_ptr->resp_tag = SD_TRUE; /* set tag to success */
|
||||
|
||||
if (aCtx->asn1r_elmnt_len != SD_FALSE) /* verify the null */
|
||||
asn1r_set_dec_err (aCtx, RESP_BAD_VALUE);
|
||||
|
||||
rslt_ptr++; /* point at the next element */
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 0, write_get_failure);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 1, write_get_success);
|
||||
_ms_set_cs_check2 (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* write_all_done */
|
||||
/* All of the write response has been obtained, give back unused */
|
||||
/* storage. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID write_all_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT rsp_size;
|
||||
|
||||
/* find actual size for request info */
|
||||
rsp_size = sizeof (WRITE_RESP_INFO)
|
||||
+ (sizeof (WRITE_RESULT) * rsp_info->num_of_result);
|
||||
|
||||
/* give back unused storage */
|
||||
_mms_dec_info = (*m_realloc_os_fun) (_mms_dec_info, rsp_size);
|
||||
rsp_info = (WRITE_RESP_INFO *) _mms_dec_info;
|
||||
|
||||
_mms_dec_done_ok (aCtx);
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_write */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE & send the variable write request. */
|
||||
/************************************************************************/
|
||||
|
||||
MMSREQ_PEND *mp_write (ST_INT chan, WRITE_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_send (MMSOP_WRITE,
|
||||
M_CAST_MK_FUN (_ms_mk_write_req),
|
||||
chan,(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_write */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the variable write request. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_write (WRITE_REQ_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_req_fin (MMSOP_WRITE,
|
||||
M_CAST_MK_FUN (_ms_mk_write_req),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_write_req */
|
||||
/* construct a variable write request. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_write_req (ASN1_ENC_CTXT *aCtx, WRITE_REQ_INFO *info)
|
||||
{
|
||||
ST_INT i;
|
||||
VAR_ACC_DATA *data_ptr;
|
||||
|
||||
asn1r_strt_constr (aCtx); /* start context tag 0 cstr */
|
||||
data_ptr = info->va_data;
|
||||
data_ptr += (info->num_of_data - 1);
|
||||
for (i = 0; i < info->num_of_data; i++)
|
||||
{
|
||||
_ms_wr_va_data (aCtx, data_ptr);
|
||||
data_ptr--;
|
||||
}
|
||||
asn1r_fin_constr (aCtx, 0, CTX, DEF); /* finish context tag 0 cstr */
|
||||
|
||||
_ms_wr_va_spec (aCtx, &info->va_spec);
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_WRITE,CTX,DEF); /* tag = opcode, ctx */
|
||||
}
|
||||
231
mmslib/mmsl/rs_ackev.c
Normal file
231
mmslib/mmsl/rs_ackev.c
Normal file
@@ -0,0 +1,231 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rs_ackevnot.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the responder portion of the acknowledge */
|
||||
/* event notification operation. It decodes the acknowledge event */
|
||||
/* notification request (indication) and encodes the acknowledge */
|
||||
/* event notification response. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 06 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 05 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 04 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 03 Changes to decode buffer allocation scheme */
|
||||
/* 07/03/97 MDE 02 Op-specific info buffer handling changes */
|
||||
/* 06/09/97 MDE 01 Changed op specific buffer allocation */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pevn.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static ACKEVNOT_REQ_INFO *req_info;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID ackevnot_enroll_name_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID ackevnot_enroll_name_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID ackevnot_enroll_name_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID ackevnot_get_state (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID ackevnot_evtime_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID ackevnot_evtime_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID ackevnot_evtime_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID ackevnot_ack_name_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID ackevnot_ack_name_done (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_ackevnot_req */
|
||||
/* This function is called from MMSDEC when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_ackevnot_req (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("Acknowledge Event Notification Request");
|
||||
|
||||
|
||||
/* get storage for request information */
|
||||
req_info = (ACKEVNOT_REQ_INFO *) _m_get_dec_buf (aCtx, sizeof (ACKEVNOT_REQ_INFO));
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 0, ackevnot_enroll_name_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* ackevnot_enroll_name_cstr */
|
||||
/* decoding acknowledge event notification request: event enrollment */
|
||||
/* name constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID ackevnot_enroll_name_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("ackevnot_enroll_name_cstr");
|
||||
|
||||
_ms_get_mms_objname (aCtx, &req_info->evenroll_name, ackevnot_enroll_name_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* ackevnot_enroll_name_done */
|
||||
/* decoding acknowledge event notification request: event enrollment */
|
||||
/* name has been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID ackevnot_enroll_name_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("ackevnot_enroll_name_done");
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = ackevnot_enroll_name_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* ackevnot_enroll_name_cstr_done */
|
||||
/* decoding acknowledge event notification request: event enrollment */
|
||||
/* name constructor done has been encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID ackevnot_enroll_name_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ASN1R_TAG_ADD (aCtx, CTX,2, ackevnot_get_state);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* ackevnot_get_state */
|
||||
/* acknowledge event notification REQUEST is being decoded: acknowledge */
|
||||
/* state was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID ackevnot_get_state (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("ackevnot_get_state");
|
||||
|
||||
if (asn1r_get_i16 (aCtx, &(req_info->ack_state))) /* acknowledge state */
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, REQ_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
else if ((req_info->ack_state < 0) || (req_info->ack_state > 2))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, REQ_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 3, ackevnot_evtime_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* ackevnot_evtime_cstr */
|
||||
/* decoding event notification request: event time constructor was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID ackevnot_evtime_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("ackevnot_evtime_cstr");
|
||||
|
||||
_ms_get_mms_evtime (aCtx, &req_info->evtime, ackevnot_evtime_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* ackevnot_evtime_done */
|
||||
/* decoding acknowledge event notification request: event time has been */
|
||||
/* obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID ackevnot_evtime_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("ackevnot_evtime_done");
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = ackevnot_evtime_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* ackevnot_evtime_cstr_done */
|
||||
/* decoding acknowledge event notification request: event time */
|
||||
/* constructor done has been encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID ackevnot_evtime_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR, 4, ackevnot_ack_name_cstr);
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* ackevnot_ack_name_cstr */
|
||||
/* acknowledge event notification REQUEST is being decoded: */
|
||||
/* acknowledgment event condition constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID ackevnot_ack_name_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("ackevnot_ack_name_cstr");
|
||||
|
||||
req_info->ackec_name_pres = SD_TRUE; /* ack event cond name present */
|
||||
|
||||
_ms_get_mms_objname (aCtx, &req_info->ackec_name, ackevnot_ack_name_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* ackevnot_ack_name_done */
|
||||
/* decoding acknowledge event notification request: acknowledgement */
|
||||
/* event condition name has been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID ackevnot_ack_name_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("ackevnot_ack_name_done");
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_ackevnot_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE & send the acknowledge event notification response.*/
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_ackevnot_resp (MMSREQ_IND *indptr)
|
||||
{
|
||||
return (_mms_send_null_resp (indptr,MMSOP_ACK_EVENT_NOT));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_ackevnot_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the acknowledge event notification response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_ackevnot_resp (ST_UINT32 invoke_id)
|
||||
{
|
||||
return (_mms_fin_null_resp (invoke_id,MMSOP_ACK_EVENT_NOT));
|
||||
}
|
||||
#endif
|
||||
147
mmslib/mmsl/rs_cancl.c
Normal file
147
mmslib/mmsl/rs_cancl.c
Normal file
@@ -0,0 +1,147 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2007, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rs_cancl.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the responder portion of the cancel */
|
||||
/* operation. It decodes the cancel request (indication) and */
|
||||
/* encodes the cancel response. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 11/01/07 EJV 06 Rem obsolete LLC30... code. */
|
||||
/* 03/09/05 EJV 05 Fixed thisFileName for MMS-EASE */
|
||||
/* 03/11/04 GLB 04 Cleaned up "thisFileName" */
|
||||
/* 12/20/01 JRB 03 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 02 Added SD_CONST modifiers */
|
||||
/* 05/07/98 MDE 01 Fixed logging */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
#include "glbsem.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pcon.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* For debug version, use a static pointer to avoid duplication of */
|
||||
/* __FILE__ strings. */
|
||||
|
||||
#if defined(DEBUG_SISCO) && (defined(S_MT_SUPPORT) || !defined(MMS_LITE))
|
||||
SD_CONST static ST_CHAR *SD_CONST thisFileName = __FILE__;
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
|
||||
/* variables global to the DECODE portion : NONE */
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_cancel_req */
|
||||
/* This function is called from mmsdec when a request is received and */
|
||||
/* the opcode for this operation is decoded. Set up state machine */
|
||||
/* function pointers to end the parse, since the parse is complete. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_cancel_req (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("Cancel Request");
|
||||
|
||||
_mmsdec_rslt->data_pres = SD_FALSE; /* cancel just has invoke id */
|
||||
aCtx->asn1r_decode_done = SD_TRUE;
|
||||
asn1r_set_all_cstr_done (aCtx);
|
||||
aCtx->asn1r_decode_done_fun = NULL;
|
||||
}
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_cancel_resp */
|
||||
/* Format a Cancel response PDU. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_cancel_resp (MMSREQ_IND *indptr)
|
||||
{
|
||||
ST_UCHAR *msg_ptr;
|
||||
ST_INT msg_len;
|
||||
ST_RET ret;
|
||||
ASN1_ENC_CTXT localEncCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_ENC_CTXT *aCtx = &localEncCtx;
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
if (!(ret = _ms_check_ind_actv (indptr)))
|
||||
{
|
||||
if (indptr -> cancl_state != CANCEL_REQUESTED)
|
||||
{
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (MVE_CANCEL_STATE);
|
||||
}
|
||||
msg_ptr = _ms_mk_cancel (aCtx, SD_FALSE,m_build_buf,mms_max_msgsize,indptr->id);
|
||||
msg_len = M_BUILD_BUF_END - msg_ptr;
|
||||
|
||||
if (aCtx->asn1r_encode_overrun) /* Check for encode overrun */
|
||||
ret = ME_ASN1_ENCODE_OVERRUN;
|
||||
else
|
||||
ret = _mms_send_data (indptr->chan, msg_len, msg_ptr,
|
||||
indptr->context, indptr->add_addr_info);
|
||||
|
||||
|
||||
MLOG_ALWAYS0 ("ISSUING MMS CANCEL RESPONSE");
|
||||
MLOG_CALWAYS1 ("Channel = %d",indptr->chan);
|
||||
MLOG_CALWAYS1 ("Context = %02x",indptr->context);
|
||||
MLOG_CALWAYS1 ("Original Invoke ID = %lu",indptr->id);
|
||||
|
||||
}
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ret);
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_cancel_resp */
|
||||
/* Create a Cancel response PDU. */
|
||||
/************************************************************************/
|
||||
ST_RET mpl_cancel_resp (ST_VOID)
|
||||
{
|
||||
ST_RET ret;
|
||||
ASN1_ENC_CTXT localEncCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_ENC_CTXT *aCtx = &localEncCtx;
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
mmsl_msg_start = _ms_mk_cancel (aCtx, SD_FALSE, mmsl_enc_buf, mmsl_enc_buf_size,
|
||||
mmsl_invoke_id);
|
||||
mmsl_msg_len = (mmsl_enc_buf + mmsl_enc_buf_size) - mmsl_msg_start;
|
||||
|
||||
if (!aCtx->asn1r_encode_overrun) /* Check for encode overrun */
|
||||
ret = SD_SUCCESS;
|
||||
else
|
||||
ret = ME_ASN1_ENCODE_OVERRUN;
|
||||
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* _ms_mk_cancel */
|
||||
/* Note that there is only one _ms_mk_cancel function, and it is listed in */
|
||||
/* the mmscancl.c module. */
|
||||
/************************************************************************/
|
||||
136
mmslib/mmsl/rs_concl.c
Normal file
136
mmslib/mmsl/rs_concl.c
Normal file
@@ -0,0 +1,136 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2007, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rs_conclude.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the responder portion of the conclude */
|
||||
/* operation. It decodes the conclude request (indication) and */
|
||||
/* encodes the conclude response. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 11/01/07 EJV 04 Rem obsolete LLC30... code. */
|
||||
/* 03/11/04 GLB 03 Cleaned up "thisFileName" */
|
||||
/* 12/20/01 JRB 02 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 01 Added SD_CONST modifiers */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
#include "glbsem.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pcon.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* For debug version, use a static pointer to avoid duplication of */
|
||||
/* __FILE__ strings. */
|
||||
|
||||
#if defined(DEBUG_SISCO) && defined(S_MT_SUPPORT)
|
||||
SD_CONST static ST_CHAR *SD_CONST thisFileName = __FILE__;
|
||||
#endif
|
||||
|
||||
/* External conclude functions (see mmsconcl) : */
|
||||
/* ST_CHAR *_ms_mk_conclude (buf_ptr,buf_len,pdutype) */
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_conclude_req */
|
||||
/* NOTE : Since a MMSOP_CONCLUDE is a NULL PDU, the decode is continued */
|
||||
/* by '_mms_null_pdu_dec', which simply sets decode done = 1 and sets */
|
||||
/* the decode done function to point to the general decode done fun */
|
||||
/* See mmsdec.c for the general functions. */
|
||||
/************************************************************************/
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_concl_resp */
|
||||
/* create and send a conclude response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_conclude_resp (MMSREQ_IND *indptr)
|
||||
{
|
||||
ST_UCHAR *msg_ptr;
|
||||
ST_INT msg_len;
|
||||
ST_RET ret;
|
||||
ASN1_ENC_CTXT localEncCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_ENC_CTXT *aCtx = &localEncCtx;
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
if (!(ret = _ms_check_ind_actv (indptr)))
|
||||
{
|
||||
msg_ptr = _ms_mk_conclude (aCtx, m_build_buf,mms_max_msgsize,MMSCNCLRESP);
|
||||
msg_len = M_BUILD_BUF_END - msg_ptr;
|
||||
|
||||
if (aCtx->asn1r_encode_overrun) /* Check for encode overrun */
|
||||
{
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ME_ASN1_ENCODE_OVERRUN);
|
||||
}
|
||||
else
|
||||
ret = _mms_send_data (indptr->chan, msg_len, msg_ptr,
|
||||
indptr->context, indptr->add_addr_info);
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
mms_chan_info[indptr->chan].ctxt.chan_state |= M_REL_IND_WAIT;
|
||||
|
||||
/* If a response logging function is installed, call it */
|
||||
if (m_log_resp_info_fun && (mms_debug_sel & MMS_LOG_RESP))
|
||||
(*m_log_resp_info_fun) (indptr, NULL);
|
||||
}
|
||||
|
||||
_ms_ind_serve_done (indptr);
|
||||
}
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ret);
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_concl_resp */
|
||||
/* create a conclude response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_conclude_resp (ST_VOID)
|
||||
{
|
||||
ST_RET ret;
|
||||
ASN1_ENC_CTXT localEncCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_ENC_CTXT *aCtx = &localEncCtx;
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
mmsl_msg_start = _ms_mk_conclude (aCtx, mmsl_enc_buf, mmsl_enc_buf_size, MMSCNCLRESP);
|
||||
mmsl_msg_len = (mmsl_enc_buf + mmsl_enc_buf_size) - mmsl_msg_start;
|
||||
|
||||
if (!aCtx->asn1r_encode_overrun) /* Check for encode overrun */
|
||||
ret = SD_SUCCESS;
|
||||
else
|
||||
ret = ME_ASN1_ENCODE_OVERRUN;
|
||||
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/* _ms_mk_conclude */
|
||||
/* Note that there is only one _ms_mk_conclude function, and it is listed */
|
||||
/* in the mmsconcl.c module. */
|
||||
/************************************************************************/
|
||||
|
||||
387
mmslib/mmsl/rs_defee.c
Normal file
387
mmslib/mmsl/rs_defee.c
Normal file
@@ -0,0 +1,387 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rs_defee.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the responder portion of define event */
|
||||
/* enrollment. It decodes the define event enrollment request */
|
||||
/* (indication) & encodes the define event enrollment response. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 06 Remove "thisFileName" */
|
||||
/* 03/31/03 JRB 05 asn1r_get_bitstr: add max_bits arg. */
|
||||
/* 12/20/01 JRB 04 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 03 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 02 Changes to decode buffer allocation scheme */
|
||||
/* 07/03/97 MDE 01 Op-specific info buffer handling changes */
|
||||
/* 06/09/97 MDE 01 Changed op specific buffer allocation */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pevn.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static DEFEE_REQ_INFO *req_info;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID defee_eename_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID defee_eename_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID defee_eename_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID defee_ecname_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID defee_ecname_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID defee_ecname_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID defee_get_ect_prim (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID defee_get_ect_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID defee_get_ect_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID defee_get_alarm_ack_rule (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID defee_eaname_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID defee_eaname_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID defee_eaname_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID defee_client_app_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID defee_app_ref_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID defee_client_app_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID defee_aecname_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID defee_aecname_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID defee_aecname_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_defee_req */
|
||||
/* This function is called from MMSDEC when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_defee_req (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("Define Event Enrollment Request");
|
||||
|
||||
|
||||
/* get storage for request information */
|
||||
req_info = (DEFEE_REQ_INFO *) _m_get_dec_buf (aCtx, sizeof (DEFEE_REQ_INFO));
|
||||
|
||||
/* req_info->evact_name_pres = SD_FALSE; */
|
||||
/* req_info->client_app_pres = SD_FALSE; */
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 0, defee_eename_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* defee_eename_cstr */
|
||||
/* define event enrollment request is being decoded: event enrollment */
|
||||
/* name constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID defee_eename_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("defee_eename_cstr");
|
||||
|
||||
_ms_get_mms_objname (aCtx, &req_info->evenroll_name, defee_eename_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* defee_eename_done */
|
||||
/* define event enrollment request is being decoded: event enrollment */
|
||||
/* name has been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID defee_eename_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("defee_eename_done");
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = defee_eename_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* defee_eename_cstr_done */
|
||||
/* define event enrollment request is being decoded: event enrollment */
|
||||
/* name constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID defee_eename_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 1, defee_ecname_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* defee_ecname_cstr */
|
||||
/* define event enrollment request is being decoded: event condition */
|
||||
/* name constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID defee_ecname_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("defee_ecname_cstr");
|
||||
|
||||
_ms_get_mms_objname (aCtx, &req_info->evcon_name, defee_ecname_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* defee_ecname_done */
|
||||
/* define event enrollment request is being decoded: event condition */
|
||||
/* name has been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID defee_ecname_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("defee_ecname_done");
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = defee_ecname_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* defee_ecname_cstr_done */
|
||||
/* define event enrollment request is being decoded: event condition */
|
||||
/* name constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID defee_ecname_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 2, defee_get_ect_prim);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 2, defee_get_ect_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* defee_get_ect_prim */
|
||||
/* define event enrollment request is being decoded: event condition */
|
||||
/* transitions primitive was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID defee_get_ect_prim (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("defee_get_ect_prim");
|
||||
/* check length before moving bitstring */
|
||||
if (!asn1r_get_bitstr (aCtx, &req_info->ec_transitions, 7))
|
||||
defee_get_ect_done (aCtx); /* set up for the next data element */
|
||||
else
|
||||
asn1r_set_dec_err (aCtx, REQ_BAD_VALUE);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* defee_get_ect_cstr */
|
||||
/* define event enrollment request is being decoded: event condition */
|
||||
/* transitions constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID defee_get_ect_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("defee_get_ect_cstr");
|
||||
/* set up bitstring cstr done function */
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = defee_get_ect_done;
|
||||
|
||||
asn1r_get_bitstr_cstr (aCtx, 7,&req_info->ec_transitions);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* defee_get_ect_done */
|
||||
/* define event enrollment request is being decoded: event condition */
|
||||
/* transitions constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID defee_get_ect_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("defee_get_ect_done");
|
||||
/* Check aCtx->asn1r_bitcount for correct # of bits */
|
||||
if (aCtx->asn1r_bitcount != 7) /* should be 7 bits */
|
||||
asn1r_set_dec_err (aCtx, REQ_BAD_VALUE);
|
||||
else /* now get alarm ack rule */
|
||||
ASN1R_TAG_ADD (aCtx, CTX,3,defee_get_alarm_ack_rule);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* defee_get_alarm_ack_rule */
|
||||
/* Decoding define event enrollment request: alarm acknowledgment rule */
|
||||
/* was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID defee_get_alarm_ack_rule (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("defee_get_alarm_ack_rule");
|
||||
/* read alarm ack rule */
|
||||
if (asn1r_get_i16 (aCtx, &(req_info->alarm_ack_rule)))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, REQ_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
else if ((req_info->alarm_ack_rule < 0) || (req_info->alarm_ack_rule > 3))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, REQ_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 4, defee_eaname_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 5, defee_client_app_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 6, defee_aecname_cstr);
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* defee_eaname_cstr */
|
||||
/* define event enrollment request is being decoded: event action */
|
||||
/* name constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID defee_eaname_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("defee_eaname_cstr");
|
||||
|
||||
req_info->evact_name_pres = SD_TRUE;
|
||||
|
||||
_ms_get_mms_objname (aCtx, &req_info->evact_name, defee_eaname_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* defee_eaname_done */
|
||||
/* define event enrollment request is being decoded: event action */
|
||||
/* name has been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID defee_eaname_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("defee_eaname_done");
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = defee_eaname_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* defee_eaname_cstr_done */
|
||||
/* define event enrollment request is being decoded: event action */
|
||||
/* name constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID defee_eaname_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 5, defee_client_app_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 6, defee_aecname_cstr);
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* defee_client_app_cstr */
|
||||
/* Decoding define event enrollment request: client application cstr */
|
||||
/* was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID defee_client_app_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("defee_client_app_cstr");
|
||||
|
||||
req_info->client_app_pres = SD_TRUE;
|
||||
|
||||
_ms_get_mms_app_ref (aCtx, &req_info->client_app,&req_info->client_app_len,
|
||||
defee_app_ref_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* defee_app_ref_done */
|
||||
/* Decoding define event enrollment request: client application has */
|
||||
/* been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID defee_app_ref_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = defee_client_app_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* defee_client_app_cstr_done */
|
||||
/* Decoding define event enrollment request: client application cstr */
|
||||
/* done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID defee_client_app_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 6, defee_aecname_cstr);
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* defee_aecname_cstr */
|
||||
/* define event enrollment request is being decoded: acknowledgement */
|
||||
/* event condition name constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID defee_aecname_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("defee_aecname_cstr");
|
||||
|
||||
req_info->ackec_name_pres = SD_TRUE;
|
||||
|
||||
_ms_get_mms_objname (aCtx, &req_info->ackec_name, defee_aecname_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* defee_aecname_done */
|
||||
/* define event enrollment request is being decoded: event action */
|
||||
/* name has been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID defee_aecname_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("defee_aecname_done");
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = defee_aecname_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* defee_aecname_cstr_done */
|
||||
/* define event enrollment request is being decoded: event action */
|
||||
/* name constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID defee_aecname_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_defee_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE and send the define event enrollment response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_defee_resp (MMSREQ_IND *indptr)
|
||||
{
|
||||
return (_mms_send_null_resp (indptr,MMSOP_DEF_EE));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_defee_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the define event enrollment response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_defee_resp (ST_UINT32 invoke_id)
|
||||
{
|
||||
return (_mms_fin_null_resp (invoke_id,MMSOP_DEF_EE));
|
||||
}
|
||||
#endif
|
||||
479
mmslib/mmsl/rs_evnot.c
Normal file
479
mmslib/mmsl/rs_evnot.c
Normal file
@@ -0,0 +1,479 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rs_evnot.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the responder portion of event */
|
||||
/* notification. It decodes the event notification request */
|
||||
/* (indication). There is no response. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* ST_VOID mms_evnot_req () */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 08 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 07 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 04/28/00 JRB 06 More Lint */
|
||||
/* 04/27/00 MDE 05 Lint cleanup */
|
||||
/* 09/13/99 MDE 04 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 03 Changes to decode buffer allocation scheme */
|
||||
/* 07/03/97 MDE 02 Op-specific info buffer handling changes */
|
||||
/* 06/09/97 MDE 01 Changed op specific buffer allocation */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pevn.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static EVNOT_REQ_INFO *req_info;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID evnot_enrol_name_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID evnot_enrol_name_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID evnot_enrol_name_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID evnot_cond_name_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID evnot_cond_name_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID evnot_cond_name_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID evnot_get_severity (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID evnot_get_state (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID evnot_evtime_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID evnot_evtime_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID evnot_evtime_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID evnot_get_not_lost (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID evnot_get_alarm_ack_rule (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID evnot_action_result_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID evnot_ar_ean_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID evnot_ar_get_success (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID evnot_ars_csr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID evnot_ar_get_failure (ASN1_DEC_CTXT *aCtx);
|
||||
#ifdef MOD_SUPPORT
|
||||
static ST_VOID evnot_arf_get_mod_pos (ASN1_DEC_CTXT *aCtx);
|
||||
#endif
|
||||
static ST_VOID evnot_arf_get_serv_err (ASN1_DEC_CTXT *aCtx);
|
||||
#ifdef CS_SUPPORT
|
||||
static ST_VOID evnot_ars_cs_rdet_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID evnot_ars_cs_rdet_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID evnot_ars_cs_rdet_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID evnot_action_result_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_evnot_req */
|
||||
/* This function is called from MMSDEC when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_evnot_req (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("Event Notification Request");
|
||||
|
||||
/* get storage for request information */
|
||||
req_info = (EVNOT_REQ_INFO *) _m_get_dec_buf (aCtx, sizeof (EVNOT_REQ_INFO) + sizeof (ERR_INFO));
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 0, evnot_enrol_name_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* evnot_enrol_name_cstr */
|
||||
/* decoding event notification request: event enrollment name cstr */
|
||||
/* was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID evnot_enrol_name_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("evnot_enrol_name_cstr");
|
||||
|
||||
_ms_get_mms_objname (aCtx, &req_info->evenroll_name, evnot_enrol_name_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* evnot_enrol_name_done */
|
||||
/* decoding event notification request: event enrollment name has been */
|
||||
/* obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID evnot_enrol_name_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("evnot_enrol_name_done");
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = evnot_enrol_name_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* evnot_enrol_name_cstr_done */
|
||||
/* decoding event notification request: event enrollment name cstr */
|
||||
/* has been decoded OK. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID evnot_enrol_name_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("evnot_enrol_name_cstr_done");
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR, 1, evnot_cond_name_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* evnot_cond_name_cstr */
|
||||
/* decoding event notification request: event condition name cstr */
|
||||
/* was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID evnot_cond_name_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("evnot_cond_name_cstr");
|
||||
|
||||
_ms_get_mms_objname (aCtx, &req_info->evcon_name, evnot_cond_name_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* evnot_cond_name_done */
|
||||
/* decoding event notification request: event condition name has been */
|
||||
/* obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID evnot_cond_name_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("evnot_cond_name_done");
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = evnot_cond_name_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* evnot_cond_name_cstr_done */
|
||||
/* decoding event notification request: event condition name cstr */
|
||||
/* has been encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID evnot_cond_name_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("evnot_cond_name_cstr_done");
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 2, evnot_get_severity);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* evnot_get_severity */
|
||||
/* event notification REQUEST is being decoded: severity was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID evnot_get_severity (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("evnot_get_severity");
|
||||
|
||||
if (asn1r_get_u8 (aCtx, &(req_info->severity))) /* get severity */
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, REQ_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 3, evnot_get_state);
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR, 4, evnot_evtime_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* evnot_get_state */
|
||||
/* event notification REQUEST is being decoded: state was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID evnot_get_state (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("evnot_get_state");
|
||||
|
||||
if (asn1r_get_i16 (aCtx, &(req_info->cur_state)) || /* get current state */
|
||||
(req_info->cur_state < 0) ||
|
||||
(req_info->cur_state > 2))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, REQ_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
req_info->cur_state_pres = SD_TRUE; /* set present flag */
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 4, evnot_evtime_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* evnot_evtime_cstr */
|
||||
/* decoding event notification request: event time constructor was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID evnot_evtime_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("evnot_evtime_cstr");
|
||||
|
||||
_ms_get_mms_evtime (aCtx, &req_info->trans_time, evnot_evtime_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* evnot_evtime_done */
|
||||
/* decoding event notification request: event time has been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID evnot_evtime_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("evnot_evtime_done");
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = evnot_evtime_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* evnot_evtime_cstr_done */
|
||||
/* decoding event notification request: event time constructor done */
|
||||
/* has been encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID evnot_evtime_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 6, evnot_get_not_lost);
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 7, evnot_get_alarm_ack_rule);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 8, evnot_action_result_cstr);
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* evnot_get_not_lost */
|
||||
/* decoding event notification request: notification lost has been */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID evnot_get_not_lost (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("evnot_get_not_lost");
|
||||
|
||||
if (asn1r_get_bool (aCtx, &(req_info->not_lost))) /* notification lost */
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, REQ_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 7, evnot_get_alarm_ack_rule);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 8, evnot_action_result_cstr);
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* evnot_get_alarm_ack_rule */
|
||||
/* decoding event notification request: alarm ack rule has been */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID evnot_get_alarm_ack_rule (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("evnot_get_alarm_ack_rule");
|
||||
|
||||
req_info->alarm_ack_rule_pres = SD_TRUE; /* set alarm ack rult present */
|
||||
|
||||
if (asn1r_get_i16 (aCtx, &(req_info->alarm_ack_rule))) /* get alarm ack rule */
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, REQ_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
else if ((req_info->alarm_ack_rule < 0) || (req_info->alarm_ack_rule > 3))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, REQ_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 8, evnot_action_result_cstr);
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* evnot_action_result_cstr */
|
||||
/* decoding event notification request: action result constructor */
|
||||
/* was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID evnot_action_result_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("evnot_action_result_cstr");
|
||||
|
||||
req_info->evact_result_pres = SD_TRUE; /* set action result present */
|
||||
|
||||
_ms_get_mms_objname (aCtx, &req_info->evact_name, evnot_ar_ean_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* evnot_ar_ean_done */
|
||||
/* decoding event notification request: action result event action name */
|
||||
/* has been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID evnot_ar_ean_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("evnot_ar_ean_done");
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 0, evnot_ar_get_success);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 1, evnot_ar_get_failure);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* evnot_ar_get_success */
|
||||
/* decoding event notification request: action result success has */
|
||||
/* been encountered, get the confirmed service response. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID evnot_ar_get_success (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("evnot_ar_get_success");
|
||||
|
||||
req_info->evact_result_tag = 0; /* set success action result */
|
||||
|
||||
/* leave confirmed service response in place; just parse it. */
|
||||
req_info->conf_serv_resp = aCtx->asn1r_field_ptr;
|
||||
asn1r_parse_next (aCtx, evnot_ars_csr_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* evnot_ars_csr_done */
|
||||
/* event notification request is being decoded: action result success: */
|
||||
/* confirmed service response has been parsed. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID evnot_ars_csr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
req_info->conf_serv_resp_len = aCtx->asn1r_octetcount; /* save length */
|
||||
#ifdef CS_SUPPORT /* check for Companion Standard response detail */
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 79, evnot_ars_cs_rdet_cstr);
|
||||
#endif
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
#ifdef CS_SUPPORT
|
||||
/************************************************************************/
|
||||
/* evnot_ars_cs_rdet_cstr */
|
||||
/* decoding event notification request: action result success: */
|
||||
/* companion standard response detail constructor has been encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID evnot_ars_cs_rdet_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("evnot_ars_cs_rdet_cstr");
|
||||
|
||||
req_info->cs_rdetail_pres = SD_TRUE; /* set the present flag */
|
||||
|
||||
/* leave CS response detail in place; just parse it. */
|
||||
req_info->cs_rdetail = aCtx->asn1r_field_ptr;
|
||||
asn1r_parse_next (aCtx, evnot_ars_cs_rdet_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* evnot_ars_cs_rdet_done */
|
||||
/* event notification request is being decoded: action result success: */
|
||||
/* companion standard response detail has been parsed. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID evnot_ars_cs_rdet_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
req_info->cs_rdetail_len = aCtx->asn1r_octetcount; /* save length */
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = evnot_ars_cs_rdet_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* evnot_ars_cs_rdet_cstr_done */
|
||||
/* event notification request is being decoded: action result success: */
|
||||
/* confirmed service response cstr done has been encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID evnot_ars_cs_rdet_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = evnot_action_result_cstr_done;
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/* evnot_ar_get_failure */
|
||||
/* decoding event notification request: action result failure has */
|
||||
/* been encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID evnot_ar_get_failure (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
MLOG_CDEC0 ("evnot_ar_get_failure");
|
||||
|
||||
req_info->evact_result_tag = 1; /* get failure action result */
|
||||
|
||||
#ifdef MOD_SUPPORT /* IS, could have modifier position */
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 0, evnot_arf_get_mod_pos);
|
||||
#endif
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR, 1, evnot_arf_get_serv_err);
|
||||
}
|
||||
|
||||
#ifdef MOD_SUPPORT
|
||||
/************************************************************************/
|
||||
/* evnot_arf_get_mod_pos */
|
||||
/* decoding event notification request: action result failure: modifier */
|
||||
/* position has been encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID evnot_arf_get_mod_pos (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("evnot_arf_get_mod_pos");
|
||||
|
||||
req_info->mod_pos_pres = SD_TRUE; /* set modifier pos present */
|
||||
|
||||
if (asn1r_get_u32 (aCtx, &(req_info->mod_pos))) /* get modifier position */
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, REQ_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR, 1, evnot_arf_get_serv_err);
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/* evnot_arf_get_serv_err */
|
||||
/* event notification request is being decoded: action result failure: */
|
||||
/* service error constructor has been encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID evnot_arf_get_serv_err (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
MLOG_CDEC0 ("evnot_arf_get_serv_err");
|
||||
|
||||
/* set up pointer (already allocated) */
|
||||
req_info->serv_err = (ERR_INFO *) (req_info+1);
|
||||
/* decode service error contents */
|
||||
_mms_get_service_err (aCtx, req_info->serv_err);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* evnot_action_result_cstr_done */
|
||||
/* decoding event notification request: action_result_cstr_done has */
|
||||
/* been encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
#ifdef CS_SUPPORT
|
||||
|
||||
static ST_VOID evnot_action_result_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
#endif
|
||||
158
mmslib/mmsl/rs_getcl.c
Normal file
158
mmslib/mmsl/rs_getcl.c
Normal file
@@ -0,0 +1,158 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rs_getcl.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the responder portion of get capability */
|
||||
/* list. It decodes the get capability list request (indication) */
|
||||
/* & encodes the get capability list response. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 07 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 06 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 05 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 04 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 03 Changes to allow compile under C++ */
|
||||
/* 07/03/97 MDE 02 Op-specific info buffer handling changes */
|
||||
/* 06/09/97 MDE 01 Changed op specific buffer allocation */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pvmd.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static GETCL_REQ_INFO *req_info;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID getcl_get_cont_after (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_getcl_req */
|
||||
/* This function is called from MMSDEC when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_getcl_req (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("Get Capability List Request");
|
||||
|
||||
|
||||
/* get storage for request information */
|
||||
req_info = (GETCL_REQ_INFO *) _m_get_dec_buf (aCtx, sizeof (GETCL_REQ_INFO));
|
||||
req_info->cont_after_pres = SD_FALSE;
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, UNI, VISTR_CODE, getcl_get_cont_after);
|
||||
asn1r_set_all_cstr_done (aCtx); /* clear cstr done functions */
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getcl_get_cont_after */
|
||||
/* get capability list REQUEST (indication) is being decoded: */
|
||||
/* continue after was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getcl_get_cont_after (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("getcl_get_cont_after");
|
||||
|
||||
req_info->cont_after_pres = SD_TRUE;
|
||||
|
||||
/* copy continue after back onto itself, shifted by one character */
|
||||
req_info->continue_after = (ST_CHAR *) aCtx->asn1r_field_ptr - 1;
|
||||
if (asn1r_get_vstr (aCtx, req_info->continue_after))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, REQ_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_getcl_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE and send the get capability list response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_getcl_resp (MMSREQ_IND *indptr, GETCL_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_send (MMSOP_GET_CAP_LIST,indptr,
|
||||
M_CAST_MK_FUN (_ms_mk_getcl_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_getcl_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the get capability list response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_getcl_resp (ST_UINT32 invoke_id, GETCL_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_fin (MMSOP_GET_CAP_LIST,invoke_id,
|
||||
M_CAST_MK_FUN (_ms_mk_getcl_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_getcl_resp */
|
||||
/* ENCODE a get capability list RESPONSE: */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_getcl_resp (ASN1_ENC_CTXT *aCtx, GETCL_RESP_INFO *info)
|
||||
{
|
||||
ST_INT i;
|
||||
ST_CHAR **cap_ptr;
|
||||
|
||||
if (!info->more_follows) /* not the default of SD_TRUE */
|
||||
{ /* write more follows not pres */
|
||||
asn1r_wr_bool (aCtx, info->more_follows);
|
||||
asn1r_fin_prim (aCtx, 1,CTX);
|
||||
}
|
||||
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 1 constructor */
|
||||
|
||||
cap_ptr = (ST_CHAR **) (info + 1);
|
||||
cap_ptr += (info->num_of_capab - 1); /* point to last capability */
|
||||
for (i = 0; i < info->num_of_capab; i++)
|
||||
{
|
||||
asn1r_wr_vstr (aCtx, *cap_ptr);
|
||||
asn1r_fin_prim (aCtx, VISTR_CODE, UNI);
|
||||
cap_ptr--;
|
||||
}
|
||||
asn1r_fin_constr (aCtx, 0,CTX,DEF); /* ctx tag 1 constructor */
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_GET_CAP_LIST,CTX,DEF); /* tag = opcode, ctx constr */
|
||||
}
|
||||
151
mmslib/mmsl/rs_getdo.c
Normal file
151
mmslib/mmsl/rs_getdo.c
Normal file
@@ -0,0 +1,151 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rs_getdom.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the responder portion of get domain */
|
||||
/* attribute. It decodes the get domain attribute request */
|
||||
/* (indication) & encodes the get domain attribute response. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 07 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 06 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 05 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 04 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 03 Changes to allow compile under C++ */
|
||||
/* 07/03/97 MDE 02 Op-specific info buffer handling changes */
|
||||
/* 06/09/97 MDE 01 Changed op specific buffer allocation */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pdom.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static GETDOM_REQ_INFO *req_info;
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_get_dom_attr_req */
|
||||
/* This function is called from MMSDEC when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_get_dom_attr_req (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("Get Domain Attribute Request");
|
||||
|
||||
|
||||
/* get storage for request information */
|
||||
req_info = (GETDOM_REQ_INFO *) _m_get_dec_buf (aCtx, sizeof (GETDOM_REQ_INFO));
|
||||
if (asn1r_get_identifier (aCtx, req_info->dname)) /* read the domain name */
|
||||
asn1r_set_dec_err (aCtx, REQ_BAD_VALUE);
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_getdom_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE and send the get domain attribute response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_getdom_resp (MMSREQ_IND *indptr, GETDOM_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_send (MMSOP_GET_DOM_ATTR,indptr,
|
||||
M_CAST_MK_FUN (_ms_mk_getdom_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_getdom_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the get domain attribute response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_getdom_resp (ST_UINT32 invoke_id, GETDOM_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_fin (MMSOP_GET_DOM_ATTR,invoke_id,
|
||||
M_CAST_MK_FUN (_ms_mk_getdom_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_getdom_resp */
|
||||
/* ENCODE a get domain attribute RESPONSE: */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_getdom_resp (ASN1_ENC_CTXT *aCtx, GETDOM_RESP_INFO *info)
|
||||
{
|
||||
ST_INT i;
|
||||
ST_CHAR **cap_ptr;
|
||||
ST_CHAR **pin_ptr;
|
||||
|
||||
asn1r_wr_i8 (aCtx, info->upload_in_progress); /* write upload in progress */
|
||||
asn1r_fin_prim (aCtx, 5,CTX); /* ctx tag 5 */
|
||||
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 4 constructor */
|
||||
cap_ptr = (ST_CHAR **) (info + 1);
|
||||
cap_ptr += (info->num_of_capab - 1); /* point to last capability */
|
||||
pin_ptr = cap_ptr + 1;
|
||||
pin_ptr += (info->num_of_pinames-1); /* point to last pi name */
|
||||
for (i = 0; i < info->num_of_pinames; i++)
|
||||
{
|
||||
asn1r_wr_vstr (aCtx, *pin_ptr);
|
||||
asn1r_fin_prim (aCtx, VISTR_CODE, UNI);
|
||||
pin_ptr--;
|
||||
}
|
||||
asn1r_fin_constr (aCtx, 4,CTX,DEF); /* ctx tag 4 constructor */
|
||||
|
||||
asn1r_wr_bool (aCtx, info->sharable); /* write sharable */
|
||||
asn1r_fin_prim (aCtx, 3,CTX); /* ctx tag 3 */
|
||||
|
||||
asn1r_wr_bool (aCtx, info->mms_deletable); /* write mms deletable */
|
||||
asn1r_fin_prim (aCtx, 2,CTX); /* ctx tag 2 */
|
||||
|
||||
asn1r_wr_i16 (aCtx, info->state); /* write state */
|
||||
asn1r_fin_prim (aCtx, 1,CTX); /* ctx tag 1 */
|
||||
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 0 constructor */
|
||||
for (i = 0; i < info->num_of_capab; i++)
|
||||
{
|
||||
asn1r_wr_vstr (aCtx, *cap_ptr);
|
||||
asn1r_fin_prim (aCtx, VISTR_CODE, UNI);
|
||||
cap_ptr--;
|
||||
}
|
||||
asn1r_fin_constr (aCtx, 0,CTX,DEF); /* ctx tag 0 constructor */
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_GET_DOM_ATTR,CTX,DEF); /* tag = opcode, ctx constr */
|
||||
}
|
||||
154
mmslib/mmsl/rs_getea.c
Normal file
154
mmslib/mmsl/rs_getea.c
Normal file
@@ -0,0 +1,154 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rs_geteaa.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the responder portion of the get event */
|
||||
/* action attributes. It decodes the get event action attributes */
|
||||
/* request (indication) and encodes the get event action */
|
||||
/* attributes response. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 07 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 06 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 05 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 04 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 03 Changes to allow compile under C++ */
|
||||
/* 07/03/97 MDE 02 Op-specific info buffer handling changes */
|
||||
/* 06/09/97 MDE 01 Changed op specific buffer allocation */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pevn.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static GETEAA_REQ_INFO *req_info;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID geteaa_objname_done (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_geteaa_req */
|
||||
/* This function is called from mmsdec when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_geteaa_req (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("Get Event Action Attributes Request");
|
||||
|
||||
/* get storage for request information */
|
||||
req_info = (GETEAA_REQ_INFO *) _m_get_dec_buf (aCtx, sizeof (GETEAA_REQ_INFO));
|
||||
_ms_get_mms_objname (aCtx, &req_info->evact_name, geteaa_objname_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteaa_objname_done */
|
||||
/* Decoding get event action attributes request: event action name */
|
||||
/* has been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteaa_objname_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_geteaa_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE and send the get event action attributes response */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_geteaa_resp (MMSREQ_IND *indptr, GETEAA_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_send (MMSOP_GET_EA_ATTR,indptr,
|
||||
M_CAST_MK_FUN (_ms_mk_geteaa_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_geteaa_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the get event action attributes response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_geteaa_resp (ST_UINT32 invoke_id, GETEAA_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_fin (MMSOP_GET_EA_ATTR,invoke_id,
|
||||
M_CAST_MK_FUN (_ms_mk_geteaa_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_geteaa_resp */
|
||||
/* Construct a get event action attributes response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_geteaa_resp (ASN1_ENC_CTXT *aCtx, GETEAA_RESP_INFO *info)
|
||||
{
|
||||
#ifdef MOD_SUPPORT
|
||||
MODIFIER *mod_ptr;
|
||||
|
||||
mod_ptr = (MODIFIER *) (info + 1);
|
||||
#endif
|
||||
|
||||
#ifdef CS_SUPPORT /* if companion standards are supported */
|
||||
if (info->cs_rdetail_pres) /* check for CS request detail */
|
||||
{
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 79 constructor */
|
||||
asn1r_wr_delmnt (aCtx, info->cs_rdetail, info->cs_rdetail_len);
|
||||
asn1r_fin_constr (aCtx, 79, CTX, DEF); /* CS is cstr 79 */
|
||||
}
|
||||
#endif
|
||||
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 2 constructor */
|
||||
asn1r_wr_delmnt (aCtx, info->conf_serv_req,info->conf_serv_req_len);
|
||||
asn1r_fin_constr (aCtx, 2,CTX,DEF); /* finish ctx tag 2 constructor */
|
||||
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 1 constructor */
|
||||
#ifdef MOD_SUPPORT /* don't write if not supported */
|
||||
_ms_wr_mms_modlist (aCtx, mod_ptr, info->num_of_modifiers);
|
||||
#endif
|
||||
asn1r_fin_constr (aCtx, 1,CTX,DEF); /* finish ctx tag 1 constructor */
|
||||
|
||||
if (info->mms_deletable)
|
||||
{ /* not the default */
|
||||
asn1r_wr_u8 (aCtx, info->mms_deletable); /* write mms deletable indicator*/
|
||||
asn1r_fin_prim (aCtx, 0, CTX); /* ctx tag 0 */
|
||||
}
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_GET_EA_ATTR,CTX,DEF); /* tag = opcode, ctx */
|
||||
}
|
||||
170
mmslib/mmsl/rs_getec.c
Normal file
170
mmslib/mmsl/rs_getec.c
Normal file
@@ -0,0 +1,170 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rs_geteca.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the responder portion of the get event */
|
||||
/* condition attributes. It decodes the get event condition */
|
||||
/* attributes request (indication) and encodes the get event */
|
||||
/* condition attributes response. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 07 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 06 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 05 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 04 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 03 Changes to allow compile under C++ */
|
||||
/* 07/03/97 MDE 02 Op-specific info buffer handling changes */
|
||||
/* 06/09/97 MDE 01 Changed op specific buffer allocation */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pevn.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static GETECA_REQ_INFO *req_info;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID geteca_objname_done (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_geteca_req */
|
||||
/* This function is called from mmsdec when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_geteca_req (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("Get Event Condition Attributes Request");
|
||||
/* get storage for request information */
|
||||
req_info = (GETECA_REQ_INFO *) _m_get_dec_buf (aCtx, sizeof (GETECA_REQ_INFO));
|
||||
_ms_get_mms_objname (aCtx, &req_info->evcon_name, geteca_objname_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteca_objname_done */
|
||||
/* Decoding get event condition attributes request: event condition */
|
||||
/* name has been obtained */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteca_objname_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_geteca_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE and send the get event condition attributes */
|
||||
/* response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_geteca_resp (MMSREQ_IND *indptr, GETECA_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_send (MMSOP_GET_EC_ATTR,indptr,
|
||||
M_CAST_MK_FUN (_ms_mk_geteca_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_geteca_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the get event condition attributes response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_geteca_resp (ST_UINT32 invoke_id, GETECA_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_fin (MMSOP_GET_EC_ATTR,invoke_id,
|
||||
M_CAST_MK_FUN (_ms_mk_geteca_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_geteca_resp */
|
||||
/* Construct a get event condition attributes response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_geteca_resp (ASN1_ENC_CTXT *aCtx, GETECA_RESP_INFO *info)
|
||||
{
|
||||
if (info->eval_int_pres)
|
||||
{
|
||||
asn1r_wr_u32 (aCtx, info->eval_interval); /* write evaluation interval */
|
||||
asn1r_fin_prim (aCtx, 7, CTX); /* ctx tag 7 */
|
||||
}
|
||||
|
||||
if (info->mon_var_pres)
|
||||
{
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 6 constructor */
|
||||
if (info->mon_var_tag == SD_TRUE) /* write undefined (NULL) */
|
||||
asn1r_fin_prim (aCtx, 1, CTX); /* ctx tag 1 */
|
||||
else
|
||||
{ /* write variable reference */
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 0 constructor */
|
||||
_ms_wr_va_var_spec (aCtx, &info->var_ref);
|
||||
asn1r_fin_constr (aCtx, 0, CTX, DEF); /* finish ctx tag 0 */
|
||||
}
|
||||
asn1r_fin_constr (aCtx, 6, CTX, DEF); /* finish ctx tag 6 */
|
||||
}
|
||||
|
||||
if (info->as_reports)
|
||||
{ /* not the default */
|
||||
asn1r_wr_u8 (aCtx, info->as_reports); /* write alarm summary reports */
|
||||
asn1r_fin_prim (aCtx, 4, CTX); /* ctx tag 4 */
|
||||
}
|
||||
|
||||
if (info->severity != MMS_NORM_SEVERITY)
|
||||
{ /* not the default */
|
||||
asn1r_wr_u8 (aCtx, info->severity);
|
||||
asn1r_fin_prim (aCtx, 3, CTX);
|
||||
}
|
||||
|
||||
if (info->priority != MMS_NORM_PRIORITY)
|
||||
{ /* not the default */
|
||||
asn1r_wr_u8 (aCtx, info->priority);
|
||||
asn1r_fin_prim (aCtx, 2, CTX);
|
||||
}
|
||||
|
||||
asn1r_wr_i16 (aCtx, info->eclass);
|
||||
asn1r_fin_prim (aCtx, 1, CTX);
|
||||
|
||||
if (info->mms_deletable)
|
||||
{ /* not the default */
|
||||
asn1r_wr_u8 (aCtx, info->mms_deletable); /* write mms deletable indicator*/
|
||||
asn1r_fin_prim (aCtx, 0, CTX); /* ctx tag 0 */
|
||||
}
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_GET_EC_ATTR,CTX,DEF); /* tag = opcode, ctx */
|
||||
}
|
||||
527
mmslib/mmsl/rs_getee.c
Normal file
527
mmslib/mmsl/rs_getee.c
Normal file
@@ -0,0 +1,527 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rs_geteea.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the responder portion of the get event */
|
||||
/* enrollment attributes. It decodes the get event enrollment */
|
||||
/* attributes request (indication) and encodes the get event */
|
||||
/* enrollment attributes response. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 06 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 05 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 04 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 03 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 02 Changes to allow compile under C++ */
|
||||
/* 06/09/97 MDE 01 Changed op specific buffer allocation */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pevn.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static GETEEA_REQ_INFO *req_info;
|
||||
|
||||
static OBJECT_NAME *obj_ptr;
|
||||
static ST_INT max_obj_name;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID geteea_get_scope (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteea_eelist_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteea_objname_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteea_eelist_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteea_client_app_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteea_client_app_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteea_client_app_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteea_ecname_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteea_ecname_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteea_ecname_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteea_eaname_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteea_eaname_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteea_eaname_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteea_caname_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteea_caname_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteea_caname_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID geteea_dec_done (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_geteea_req */
|
||||
/* This function is called from mmsdec when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_geteea_req (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT req_size;
|
||||
|
||||
MLOG_CDEC0 ("Get Event Enrollment Attributes Request");
|
||||
|
||||
#if defined(FIXED_DECBUF)
|
||||
max_obj_name = m_sv_max_obj_name;
|
||||
req_size = mmsl_dec_info_size;
|
||||
#else
|
||||
max_obj_name = _mmsdec_msglen / 2; /* find maximum size */
|
||||
if (m_sv_max_obj_name && (max_obj_name > m_sv_max_obj_name))
|
||||
max_obj_name = m_sv_max_obj_name;
|
||||
req_size = sizeof (GETEEA_REQ_INFO) + (sizeof (OBJECT_NAME) * max_obj_name);
|
||||
#endif
|
||||
|
||||
/* get storage for request information */
|
||||
req_info = (GETEEA_REQ_INFO *) _m_get_dec_buf (aCtx, req_size);
|
||||
|
||||
req_info->scope_of_req = 1; /* default is client */
|
||||
/* req_info->eenames_pres = SD_FALSE; default not present */
|
||||
/* req_info->client_app_pres = SD_FALSE; default not present */
|
||||
/* req_info->evcon_pres = SD_FALSE; default not present */
|
||||
/* req_info->evact_pres = SD_FALSE; default not present */
|
||||
/* req_info->ca_name_pres = SD_FALSE; default not present */
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 0, geteea_get_scope);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 1, geteea_eelist_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 2, geteea_client_app_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 3, geteea_ecname_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 4, geteea_eaname_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 5, geteea_caname_cstr);
|
||||
|
||||
aCtx->asn1r_decode_done_fun = geteea_dec_done; /* ok to be done */
|
||||
_ms_set_cs_check2 (aCtx); /* check for CS info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteea_get_scope */
|
||||
/* Decoding get event enrollment attributes request: scope was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteea_get_scope (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("geteea_get_scope");
|
||||
/* read the scope */
|
||||
if (asn1r_get_i16 (aCtx, &(req_info->scope_of_req)))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, REQ_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
else if ((req_info->scope_of_req < 0) || (req_info->scope_of_req > 3))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, REQ_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 1, geteea_eelist_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 2, geteea_client_app_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 3, geteea_ecname_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 4, geteea_eaname_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 5, geteea_caname_cstr);
|
||||
_ms_set_cs_check2 (aCtx); /* check for CS info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteea_eelist_cstr */
|
||||
/* decoding get event enrollment attributes request: event enrollment */
|
||||
/* name list constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteea_eelist_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("geteea_eelist_cstr");
|
||||
|
||||
req_info->eenames_pres = SD_TRUE; /* set list of names present */
|
||||
obj_ptr = (OBJECT_NAME *) (req_info + 1);
|
||||
|
||||
_ms_get_mms_objname (aCtx, obj_ptr, geteea_objname_done);
|
||||
|
||||
/* set the cstr done function */
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = geteea_eelist_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteea_objname_done */
|
||||
/* decoding get event enrollment attributes request: object name has */
|
||||
/* been decoded. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteea_objname_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("geteea_objname_done");
|
||||
|
||||
req_info->num_of_eenames++; /* inc # of event enroll names */
|
||||
if (req_info->num_of_eenames > max_obj_name)
|
||||
asn1r_set_dec_err (aCtx, REQ_BAD_VALUE);
|
||||
else
|
||||
{
|
||||
obj_ptr++; /* point to where next will go */
|
||||
_ms_get_mms_objname (aCtx, obj_ptr, geteea_objname_done);
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteea_eelist_cstr_done */
|
||||
/* decoding get event enrollment attributes request: event enrollment */
|
||||
/* name list constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteea_eelist_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 2, geteea_client_app_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 3, geteea_ecname_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 4, geteea_eaname_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 5, geteea_caname_cstr);
|
||||
_ms_set_cs_check2 (aCtx); /* check for CS info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteea_client_app_cstr */
|
||||
/* Decoding get event enrollment attributes request: client application */
|
||||
/* constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteea_client_app_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("geteea_client_app_cstr");
|
||||
|
||||
req_info->client_app_pres = SD_TRUE; /* set client app present */
|
||||
|
||||
_ms_get_mms_app_ref (aCtx, &req_info->client_app,&req_info->client_app_len,
|
||||
geteea_client_app_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteea_client_app_done */
|
||||
/* Decoding get event enrollment attributes request: client application */
|
||||
/* has been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteea_client_app_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = geteea_client_app_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteea_client_app_cstr_done */
|
||||
/* Decoding get event enrollment attributes request: client application */
|
||||
/* constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteea_client_app_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 3, geteea_ecname_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 4, geteea_eaname_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 5, geteea_caname_cstr);
|
||||
_ms_set_cs_check2 (aCtx); /* check for CS info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteea_ecname_cstr */
|
||||
/* decoding get event enrollment attributes request: event condition */
|
||||
/* name constructor was encountered */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteea_ecname_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("geteea_ecname_cstr");
|
||||
|
||||
req_info->evcon_name_pres = SD_TRUE; /* event condition name present */
|
||||
|
||||
_ms_get_mms_objname (aCtx, &req_info->evcon_name, geteea_ecname_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteea_ecname_done */
|
||||
/* decoding get event enrollment attributes request: event condition */
|
||||
/* name has been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteea_ecname_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("geteea_ecname_done");
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = geteea_ecname_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteea_ecname_cstr_done */
|
||||
/* decoding get event enrollment attributes request: event condition */
|
||||
/* name constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteea_ecname_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 4, geteea_eaname_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 5, geteea_caname_cstr);
|
||||
_ms_set_cs_check2 (aCtx); /* check for CS info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteea_eaname_cstr */
|
||||
/* decoding get event enrollment attributes request: event action */
|
||||
/* name constructor was encountered */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteea_eaname_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("geteea_eaname_cstr");
|
||||
|
||||
req_info->evact_name_pres = SD_TRUE; /* event action name present */
|
||||
|
||||
_ms_get_mms_objname (aCtx, &req_info->evact_name, geteea_eaname_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteea_eaname_done */
|
||||
/* decoding get event enrollment attributes request: event action */
|
||||
/* name has been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteea_eaname_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("geteea_eaname_done");
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = geteea_eaname_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteea_eaname_cstr_done */
|
||||
/* decoding get event enrollment attributes request: event condition */
|
||||
/* name constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteea_eaname_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 5, geteea_caname_cstr);
|
||||
_ms_set_cs_check2 (aCtx); /* check for CS info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteea_caname_cstr */
|
||||
/* decoding get event enrollment attributes request: continue after */
|
||||
/* name constructor was encountered */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteea_caname_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("geteea_caname_cstr");
|
||||
|
||||
req_info->ca_name_pres = SD_TRUE; /* continue after name present */
|
||||
|
||||
_ms_get_mms_objname (aCtx, &req_info->ca_name, geteea_caname_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteea_caname_done */
|
||||
/* decoding get event enrollment attributes request: continue after */
|
||||
/* name has been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteea_caname_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("geteea_caname_done");
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = geteea_caname_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteea_caname_cstr_done */
|
||||
/* decoding get event enrollment attributes request: continue after */
|
||||
/* name constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteea_caname_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
_ms_set_cs_check2 (aCtx); /* check for CS info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* geteea_dec_done */
|
||||
/* decode done, realloc the structure to desired size */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID geteea_dec_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT req_size;
|
||||
/* find actual size for request info */
|
||||
req_size = sizeof (GETEEA_REQ_INFO)
|
||||
+ (sizeof (OBJECT_NAME) * req_info->num_of_eenames);
|
||||
|
||||
/* give back unused storage */
|
||||
_mms_dec_info = (*m_realloc_os_fun) (_mms_dec_info,req_size);
|
||||
req_info = (GETEEA_REQ_INFO *) _mms_dec_info;
|
||||
|
||||
_mms_dec_done_ok (aCtx);
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_geteea_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE and send the get event enrollment attributes */
|
||||
/* response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_geteea_resp (MMSREQ_IND *indptr, GETEEA_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_send (MMSOP_GET_EE_ATTR,indptr,
|
||||
M_CAST_MK_FUN (_ms_mk_geteea_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_geteea_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the get event enrollment attributes response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_geteea_resp (ST_UINT32 invoke_id, GETEEA_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_fin (MMSOP_GET_EE_ATTR,invoke_id,
|
||||
M_CAST_MK_FUN (_ms_mk_geteea_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_geteea_resp */
|
||||
/* Construct a get event enrollment attributes attributes response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_geteea_resp (ASN1_ENC_CTXT *aCtx, GETEEA_RESP_INFO *info)
|
||||
{
|
||||
ST_INT i;
|
||||
EVENT_ENROLLMENT *ee_ptr;
|
||||
|
||||
if (info->more_follows)
|
||||
{ /* not the default */
|
||||
asn1r_wr_u8 (aCtx, info->more_follows); /* write more follows indicator */
|
||||
asn1r_fin_prim (aCtx, 1, CTX); /* ctx tag 1 */
|
||||
}
|
||||
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 0 constructor */
|
||||
ee_ptr = (EVENT_ENROLLMENT *) (info + 1);
|
||||
ee_ptr +=info->num_of_evenroll-1; /* point to last event enroll */
|
||||
for (i = 0; i < info->num_of_evenroll; i++)
|
||||
{
|
||||
asn1r_strt_constr (aCtx); /* start uni seq constructor */
|
||||
if (ee_ptr->ackec_name_pres)
|
||||
{
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 10 constructor */
|
||||
if (ee_ptr->ackec_name_tag == 1)
|
||||
asn1r_fin_prim (aCtx, 1, CTX); /* event action name undefined */
|
||||
else
|
||||
{ /* write event action name */
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 0 constructor */
|
||||
_ms_wr_mms_objname (aCtx, &ee_ptr->ackec_name);
|
||||
asn1r_fin_constr (aCtx, 0,CTX,DEF); /* finish ctx tag 0 constructor */
|
||||
}
|
||||
asn1r_fin_constr (aCtx, 10,CTX,DEF); /* finish ctx tag 10 constructor */
|
||||
}
|
||||
|
||||
#ifdef CS_SUPPORT
|
||||
if (ee_ptr->addl_detail_pres)
|
||||
{
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 9 constructor */
|
||||
asn1r_wr_delmnt (aCtx, ee_ptr->addl_detail,ee_ptr->addl_detail_len);
|
||||
asn1r_fin_constr (aCtx, 9,CTX,DEF); /* finish ctx tag 9 constructor */
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ee_ptr->rem_acc_delay_pres)
|
||||
{
|
||||
asn1r_wr_u32 (aCtx, ee_ptr->rem_acc_delay); /* write remaining acc delay */
|
||||
asn1r_fin_prim (aCtx, 8, CTX); /* ctx tag 8 */
|
||||
}
|
||||
|
||||
if (ee_ptr->invoke_id_pres)
|
||||
{
|
||||
asn1r_wr_u32 (aCtx, ee_ptr->invoke_id); /* write the invoke id */
|
||||
asn1r_fin_prim (aCtx, 7, CTX); /* ctx tag 7 */
|
||||
}
|
||||
|
||||
if (ee_ptr->duration != 0)
|
||||
{ /* not the default of current */
|
||||
asn1r_wr_i16 (aCtx, ee_ptr->duration); /* write the duration */
|
||||
asn1r_fin_prim (aCtx, 6, CTX); /* ctx tag 6 */
|
||||
}
|
||||
|
||||
asn1r_wr_i16 (aCtx, ee_ptr->ee_class); /* write event enrollment class */
|
||||
asn1r_fin_prim (aCtx, 5, CTX); /* ctx tag 5 */
|
||||
|
||||
if (ee_ptr->mms_deletable)
|
||||
{ /* not the default of SD_FALSE */
|
||||
asn1r_wr_bool (aCtx, ee_ptr->mms_deletable); /* write mms deletable */
|
||||
asn1r_fin_prim (aCtx, 4, CTX); /* ctx tag 4 */
|
||||
}
|
||||
|
||||
if (ee_ptr->client_app_pres)
|
||||
{
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 3 constructor */
|
||||
asn1r_wr_delmnt (aCtx, ee_ptr->client_app,ee_ptr->client_app_len);
|
||||
asn1r_fin_constr (aCtx, 3,CTX,DEF); /* finish ctx tag 3 constructor */
|
||||
}
|
||||
|
||||
if (ee_ptr->evact_name_pres)
|
||||
{
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 2 constructor */
|
||||
if (ee_ptr->evact_name_tag == 1)
|
||||
asn1r_fin_prim (aCtx, 1, CTX); /* event action name undefined */
|
||||
else
|
||||
{ /* write event action name */
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 0 constructor */
|
||||
_ms_wr_mms_objname (aCtx, &ee_ptr->evact_name);
|
||||
asn1r_fin_constr (aCtx, 0,CTX,DEF); /* finish ctx tag 0 constructor */
|
||||
}
|
||||
asn1r_fin_constr (aCtx, 2,CTX,DEF); /* finish ctx tag 2 constructor */
|
||||
}
|
||||
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 1 constructor */
|
||||
if (ee_ptr->evcon_name_tag == 1)
|
||||
asn1r_fin_prim (aCtx, 1, CTX); /* event condition name undef */
|
||||
else
|
||||
{ /* write event condition name */
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 0 constructor */
|
||||
_ms_wr_mms_objname (aCtx, &ee_ptr->evcon_name);
|
||||
asn1r_fin_constr (aCtx, 0,CTX,DEF); /* finish ctx tag 0 constructor */
|
||||
}
|
||||
asn1r_fin_constr (aCtx, 1,CTX,DEF); /* finish ctx tag 1 constructor */
|
||||
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 0 constructor */
|
||||
_ms_wr_mms_objname (aCtx, &ee_ptr->evenroll_name);
|
||||
asn1r_fin_constr (aCtx, 0,CTX,DEF); /* finish ctx tag 0 constructor */
|
||||
|
||||
asn1r_fin_constr (aCtx, SEQ_CODE,UNI,DEF); /* finish uni seq constructor */
|
||||
ee_ptr--;
|
||||
}
|
||||
asn1r_fin_constr (aCtx, 0,CTX,DEF); /* finish ctx tag 0 constructor */
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_GET_EE_ATTR,CTX,DEF); /* tag = opcode, ctx */
|
||||
}
|
||||
148
mmslib/mmsl/rs_getpi.c
Normal file
148
mmslib/mmsl/rs_getpi.c
Normal file
@@ -0,0 +1,148 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rs_getpi.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the responder portion of get program */
|
||||
/* invocation attribute. It decodes the get program invocation */
|
||||
/* attribute request (indication) & encodes the get program */
|
||||
/* invocation attribute response. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 07 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 06 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 05 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 04 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 03 Changes to allow compile under C++ */
|
||||
/* 07/03/97 MDE 02 Op-specific info buffer handling changes */
|
||||
/* 06/09/97 MDE 01 Changed op specific buffer allocation */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pprg.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static GETPI_REQ_INFO *req_info;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_get_pi_req */
|
||||
/* This function is called from MMSDEC when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_get_pi_req (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("Get Program Invocation Attribute Request");
|
||||
|
||||
|
||||
/* get storage for request information */
|
||||
req_info = (GETPI_REQ_INFO *) _m_get_dec_buf (aCtx, sizeof (GETPI_REQ_INFO));
|
||||
if (asn1r_get_identifier (aCtx, req_info->piname))/* read program invocation name */
|
||||
asn1r_set_dec_err (aCtx, REQ_BAD_VALUE);
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_getpi_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE and send the get program invocation attribute */
|
||||
/* response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_getpi_resp (MMSREQ_IND *indptr, GETPI_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_send (MMSOP_GET_PI_ATTR,indptr,
|
||||
M_CAST_MK_FUN (_ms_mk_getpi_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_getpi_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the get program invocation attribute response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_getpi_resp (ST_UINT32 invoke_id, GETPI_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_fin (MMSOP_GET_PI_ATTR,invoke_id,
|
||||
M_CAST_MK_FUN (_ms_mk_getpi_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_getpi_resp */
|
||||
/* ENCODE a get program invocation attribute RESPONSE: */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_getpi_resp (ASN1_ENC_CTXT *aCtx, GETPI_RESP_INFO *info)
|
||||
{
|
||||
ST_INT i;
|
||||
ST_CHAR **dom_ptr;
|
||||
|
||||
if (info->start_arg_type == ARG_TYPE_SIMPLE)
|
||||
{
|
||||
asn1r_wr_vstr (aCtx, (ST_CHAR *)info->start_arg); /* write the start argument */
|
||||
asn1r_fin_prim (aCtx, 5,CTX); /* ctx tag 5 */
|
||||
}
|
||||
else /* ENCODED data, write as complete ASN.1 EXTERNAL */
|
||||
asn1r_wr_delmnt (aCtx, info->start_arg,info->start_arg_len);
|
||||
|
||||
asn1r_wr_bool (aCtx, info->monitor); /* write the monitor flag */
|
||||
asn1r_fin_prim (aCtx, 4,CTX); /* ctx tag 4 */
|
||||
|
||||
asn1r_wr_bool (aCtx, info->reusable); /* write the reusable flag */
|
||||
asn1r_fin_prim (aCtx, 3,CTX); /* ctx tag 3 */
|
||||
|
||||
asn1r_wr_bool (aCtx, info->mms_deletable); /* write mms deletable flag */
|
||||
asn1r_fin_prim (aCtx, 2,CTX); /* ctx tag 2 */
|
||||
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 2 constructor */
|
||||
dom_ptr = (ST_CHAR **) (info + 1);
|
||||
dom_ptr += (info->num_of_dnames - 1); /* point to last domain name */
|
||||
for (i = 0; i < info->num_of_dnames; i++)
|
||||
{
|
||||
asn1r_wr_vstr (aCtx, *dom_ptr);
|
||||
asn1r_fin_prim (aCtx, VISTR_CODE, UNI);
|
||||
dom_ptr--;
|
||||
}
|
||||
asn1r_fin_constr (aCtx, 1,CTX,DEF); /* ctx tag 1 constructor */
|
||||
|
||||
asn1r_wr_i16 (aCtx, info->state); /* write the state */
|
||||
asn1r_fin_prim (aCtx, 0,CTX); /* ctx tag 0 */
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_GET_PI_ATTR,CTX,DEF); /* tag = opcode, ctx constr */
|
||||
}
|
||||
126
mmslib/mmsl/rs_getty.c
Normal file
126
mmslib/mmsl/rs_getty.c
Normal file
@@ -0,0 +1,126 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rs_gettype.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the responder portion of get named type */
|
||||
/* attributes. It decodes the get named type attributes request */
|
||||
/* (indication) & encodes the get named type attributes response. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 07 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 06 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 05 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 04 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 03 Changes to allow compile under C++ */
|
||||
/* 07/03/97 MDE 02 Op-specific info buffer handling changes */
|
||||
/* 06/09/97 MDE 01 Changed op specific buffer allocation */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pvar.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static GETTYPE_REQ_INFO *req_info;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID gettype_type_name_done (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_get_type_req */
|
||||
/* This function is called from MMSDEC when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_get_type_req (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("Get Named Type Attributes Request");
|
||||
|
||||
/* get storage for request information */
|
||||
req_info = (GETTYPE_REQ_INFO *) _m_get_dec_buf (aCtx, sizeof (GETTYPE_REQ_INFO));
|
||||
_ms_get_mms_objname (aCtx, &req_info->type_name, gettype_type_name_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* gettype_type_name_done */
|
||||
/* decoding get named type attributes request: type name has been */
|
||||
/* obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID gettype_type_name_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_gettype_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE and send the get named type attributes response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_gettype_resp (MMSREQ_IND *indptr, GETTYPE_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_send (MMSOP_GET_TYPE,indptr,
|
||||
M_CAST_MK_FUN (_ms_mk_gettype_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_gettype_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the get named type attributes response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_gettype_resp (ST_UINT32 invoke_id, GETTYPE_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_fin (MMSOP_GET_TYPE,invoke_id,
|
||||
M_CAST_MK_FUN (_ms_mk_gettype_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_gettype_resp */
|
||||
/* Construct a get named type attributes response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_gettype_resp (ASN1_ENC_CTXT *aCtx, GETTYPE_RESP_INFO *info)
|
||||
{
|
||||
_ms_wr_va_type_spec (aCtx, &info->type_spec); /* write the type specification */
|
||||
|
||||
asn1r_wr_bool (aCtx , info->mms_deletable); /* write mms deletable flag */
|
||||
asn1r_fin_prim (aCtx , 0,CTX); /* context tag 1 */
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx , MMSOP_GET_TYPE,CTX,DEF); /* tag = opcode, ctx constr */
|
||||
}
|
||||
170
mmslib/mmsl/rs_getva.c
Normal file
170
mmslib/mmsl/rs_getva.c
Normal file
@@ -0,0 +1,170 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rs_getvar.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the responder portion of get variable */
|
||||
/* access attributes. It decodes the get variable access */
|
||||
/* attributes request (indication) & encodes the get variable */
|
||||
/* access attributes response. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 07 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 06 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 05 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 04 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 03 Changes to allow compile under C++ */
|
||||
/* 07/03/97 MDE 02 Op-specific info buffer handling changes */
|
||||
/* 06/09/97 MDE 01 Changed op specific buffer allocation */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pvar.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static GETVAR_REQ_INFO *req_info;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID getvar_na_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getvar_name_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID getvar_addr_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_get_var_req */
|
||||
/* This function is called from MMSDEC when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_get_var_req (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("Get Variable Access Attributes Request");
|
||||
|
||||
/* get storage for request information */
|
||||
/* get storage for request information */
|
||||
req_info = (GETVAR_REQ_INFO *) _m_get_dec_buf (aCtx, sizeof (GETVAR_REQ_INFO));
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 0, getvar_name_cstr);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 1, getvar_addr_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getvar_name_cstr */
|
||||
/* decoding get variable access attributes request: name constructor */
|
||||
/* was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getvar_name_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("getvar_name_cstr");
|
||||
|
||||
req_info->req_tag = SD_SUCCESS; /* set tag to name */
|
||||
|
||||
_ms_get_mms_objname (aCtx, &req_info->name, getvar_na_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getvar_addr_cstr */
|
||||
/* decoding get variable access attributes request: address constructor */
|
||||
/* was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getvar_addr_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("getvar_addr_cstr");
|
||||
|
||||
req_info->req_tag = SD_TRUE; /* set tag to address */
|
||||
|
||||
_ms_get_va_address (aCtx, &req_info->address, getvar_na_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getvar_na_done */
|
||||
/* decoding get variable access attributes request: name or address has */
|
||||
/* been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getvar_na_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_getvar_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE & send the get variable access attributes response */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_getvar_resp (MMSREQ_IND *indptr, GETVAR_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_send (MMSOP_GET_VAR,indptr,
|
||||
M_CAST_MK_FUN (_ms_mk_getvar_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_getvar_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the get variable access attributes response */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_getvar_resp (ST_UINT32 invoke_id, GETVAR_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_fin (MMSOP_GET_VAR,invoke_id,
|
||||
M_CAST_MK_FUN (_ms_mk_getvar_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_getvar_resp */
|
||||
/* Construct a get variable access attributes response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_getvar_resp (ASN1_ENC_CTXT *aCtx, GETVAR_RESP_INFO *info)
|
||||
{
|
||||
asn1r_strt_constr (aCtx); /* start context tag 2 cstr */
|
||||
_ms_wr_va_type_spec (aCtx, &info->type_spec); /* write the type specification */
|
||||
asn1r_fin_constr (aCtx, 2, CTX, DEF); /* finish context tag 2 cstr */
|
||||
|
||||
if (info->address_pres)
|
||||
{
|
||||
asn1r_strt_constr (aCtx); /* start context tag 1 cstr */
|
||||
_ms_wr_va_address (aCtx, &info->address); /* write the address */
|
||||
asn1r_fin_constr (aCtx, 1, CTX, DEF); /* finish context tag 1 cstr */
|
||||
}
|
||||
|
||||
asn1r_wr_bool (aCtx, info->mms_deletable); /* write mms deletable flag */
|
||||
asn1r_fin_prim (aCtx, 0,CTX); /* context tag 1 */
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_GET_VAR,CTX,DEF); /* tag = opcode, ctx constr */
|
||||
}
|
||||
139
mmslib/mmsl/rs_getvl.c
Normal file
139
mmslib/mmsl/rs_getvl.c
Normal file
@@ -0,0 +1,139 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rs_getvlist.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the responder portion of get scattered */
|
||||
/* access attributes. It decodes the get named variable list */
|
||||
/* attributes request (indication) & encodes the get scattered */
|
||||
/* access attributes response. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 07 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 06 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 05 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 04 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 03 Changes to allow compile under C++ */
|
||||
/* 07/03/97 MDE 02 Op-specific info buffer handling changes */
|
||||
/* 06/09/97 MDE 01 Changed op specific buffer allocation */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pvar.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static GETVLIST_REQ_INFO *req_info;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID getvlist_name_done (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_get_vlist_req */
|
||||
/* This function is called from MMSDEC when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_get_vlist_req (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("Get Named Variable List Attributes Request");
|
||||
|
||||
/* get storage for request information */
|
||||
/* get storage for request information */
|
||||
req_info = (GETVLIST_REQ_INFO *) _m_get_dec_buf (aCtx, sizeof (GETVLIST_REQ_INFO));
|
||||
_ms_get_mms_objname (aCtx, &req_info->vl_name, getvlist_name_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* getvlist_name_done */
|
||||
/* decoding get named variable list attributes request: variable list */
|
||||
/* name has been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID getvlist_name_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
asn1r_set_all_cstr_done (aCtx); /* clear cstr done functions */
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_getvlist_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE & send the get named variable list attributes */
|
||||
/* response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_getvlist_resp (MMSREQ_IND *indptr, GETVLIST_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_send (MMSOP_GET_VLIST,indptr,
|
||||
M_CAST_MK_FUN (_ms_mk_getvlist_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_getvlist_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the get named variable list attributes response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_getvlist_resp (ST_UINT32 invoke_id,
|
||||
GETVLIST_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_fin (MMSOP_GET_VLIST,invoke_id,
|
||||
M_CAST_MK_FUN (_ms_mk_getvlist_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_getvlist_resp */
|
||||
/* Construct a get named variable list attributes response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_getvlist_resp (ASN1_ENC_CTXT *aCtx, GETVLIST_RESP_INFO *info)
|
||||
{
|
||||
VARIABLE_LIST *vl_ptr;
|
||||
|
||||
/* get ptr to list of variables */
|
||||
vl_ptr = (VARIABLE_LIST *) (info + 1);
|
||||
|
||||
asn1r_strt_constr (aCtx); /* start context tag 1 cstr */
|
||||
_ms_wr_va_var_list (aCtx, vl_ptr, info->num_of_variables);
|
||||
asn1r_fin_constr (aCtx, 1, CTX, DEF); /* finish context tag 1 cstr */
|
||||
|
||||
asn1r_wr_bool (aCtx, info->mms_deletable); /* write mms deletable flag */
|
||||
asn1r_fin_prim (aCtx, 0,CTX); /* context tag 0 */
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_GET_VLIST,CTX,DEF); /* tag = opcode, ctx constr */
|
||||
}
|
||||
122
mmslib/mmsl/rs_ident.c
Normal file
122
mmslib/mmsl/rs_ident.c
Normal file
@@ -0,0 +1,122 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rs_ident.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the responder portion of the Identify */
|
||||
/* service. It decodes the Identify request (indication) and */
|
||||
/* encodes the Identify response. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 12/20/01 JRB 02 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 06/15/98 MDE 01 Changes to allow compile under C++ */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pvmd.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : NONE */
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : */
|
||||
/* IDENT_RESP_INFO mmse_ident_info; */
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_identify_req */
|
||||
/* NOTE : Since the identify req is a NULL PDU, the decode is continued */
|
||||
/* by '_mms_null_pdu_dec', which simply sets decode done = 1 and sets */
|
||||
/* the decode done function to point to the general decode done fun */
|
||||
/* See mmsdec.c for the general functions. */
|
||||
/************************************************************************/
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_ident_resp */
|
||||
/* This function is called from the user to ENCODE and send the */
|
||||
/* Identify response PDU. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_ident_resp (MMSREQ_IND *indptr, IDENT_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_send (MMSOP_IDENTIFY,indptr,
|
||||
M_CAST_MK_FUN (_ms_mk_ident_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_ident_resp */
|
||||
/* This function is called from the user to ENCODE the Identify */
|
||||
/* response PDU. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_ident_resp (ST_UINT32 invoke_id, IDENT_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_fin (MMSOP_IDENTIFY,invoke_id,
|
||||
M_CAST_MK_FUN (_ms_mk_ident_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_ident_resp */
|
||||
/* ENCODE an Identify RESPONSE: */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_ident_resp (ASN1_ENC_CTXT *aCtx, IDENT_RESP_INFO *info)
|
||||
{
|
||||
ST_INT i;
|
||||
struct mms_obj_id *obj;
|
||||
|
||||
asn1r_strt_constr (aCtx);
|
||||
|
||||
if (info->num_as) /* if user wants to send AS */
|
||||
{
|
||||
asn1r_strt_constr (aCtx); /* sequence */
|
||||
obj = (struct mms_obj_id *) (info +1); /* point to first AS */
|
||||
|
||||
for (i = 0; i < info->num_as; ++i, ++obj)
|
||||
{
|
||||
asn1r_wr_objid (aCtx, obj->comps, obj->num_comps);
|
||||
asn1r_fin_prim (aCtx, OBJ_ID_CODE,UNI);
|
||||
}
|
||||
asn1r_fin_constr (aCtx, 3,CTX,DEF); /* finish sequence of AS */
|
||||
}
|
||||
|
||||
asn1r_wr_vstr (aCtx, info->rev); /* write the revision name */
|
||||
asn1r_fin_prim (aCtx, 2,CTX);
|
||||
|
||||
asn1r_wr_vstr (aCtx, info->model); /* write the model name */
|
||||
asn1r_fin_prim (aCtx, 1,CTX);
|
||||
|
||||
asn1r_wr_vstr (aCtx, info->vend); /* write the vendor name */
|
||||
asn1r_fin_prim (aCtx, 0,CTX);
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_IDENTIFY,CTX,DEF); /* tag = opcode, context */
|
||||
}
|
||||
184
mmslib/mmsl/rs_info.c
Normal file
184
mmslib/mmsl/rs_info.c
Normal file
@@ -0,0 +1,184 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rs_info.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the responder portion of information */
|
||||
/* report. It decodes the information report request (indication). */
|
||||
/* There is no response. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 05 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 04 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 03 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 02 Changes to decode buffer allocation scheme */
|
||||
/* 07/03/97 MDE 01 Op-specific info buffer handling changes */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pvar.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static INFO_REQ_INFO *req_info;
|
||||
|
||||
|
||||
static ACCESS_RESULT *ar_ptr;
|
||||
static ST_INT max_vars;
|
||||
static ST_INT max_acc_rslt;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID info_acc_rslt_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID info_acc_rslt_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID info_acc_rslt_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID info_va_spec_done (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_info_rpt_req */
|
||||
/* This function is called from mmsdec when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_info_rpt_req (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT size1;
|
||||
ST_INT size2;
|
||||
ST_INT req_size;
|
||||
|
||||
MLOG_CDEC0 ("Information Report Request");
|
||||
|
||||
#if defined(FIXED_DECBUF)
|
||||
max_acc_rslt = m_cl_max_info_acc_rslt;
|
||||
max_vars = m_cl_max_info_var_spec;
|
||||
req_size = mmsl_dec_info_size;
|
||||
#else
|
||||
|
||||
/* First assume a list of variables (each var has a data) */
|
||||
max_vars = _mmsdec_msglen / 7;
|
||||
if (m_cl_max_info_var_spec && (max_vars > m_cl_max_info_var_spec))
|
||||
max_vars = m_cl_max_info_var_spec;
|
||||
|
||||
size1 = sizeof(INFO_REQ_INFO) +
|
||||
(max_vars * (sizeof(VARIABLE_LIST) + sizeof(ACCESS_RESULT)));
|
||||
|
||||
/* Now assume a named variable list name */
|
||||
max_acc_rslt = _mmsdec_msglen / 3;
|
||||
if (m_cl_max_info_acc_rslt && (max_acc_rslt > m_cl_max_info_acc_rslt))
|
||||
max_acc_rslt = m_cl_max_info_acc_rslt;
|
||||
size2 = sizeof(INFO_REQ_INFO) + (sizeof(ACCESS_RESULT) * max_acc_rslt);
|
||||
|
||||
req_size = max(size1, size2);
|
||||
#endif
|
||||
|
||||
/* get storage for request information */
|
||||
req_info = (INFO_REQ_INFO *) _m_get_dec_buf (aCtx, req_size);
|
||||
_ms_get_va_spec (aCtx, &req_info->va_spec, max_vars, info_va_spec_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* info_va_spec_done */
|
||||
/* decoding information report request: variable access specification */
|
||||
/* has been decoded. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID info_va_spec_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
VARIABLE_LIST *temp;
|
||||
|
||||
MLOG_CDEC0 ("info_va_spec_done");
|
||||
|
||||
temp = (VARIABLE_LIST *) (req_info + 1);
|
||||
temp += req_info->va_spec.num_of_variables;
|
||||
|
||||
req_info->acc_rslt_list = (ACCESS_RESULT *) temp;
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 0, info_acc_rslt_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* info_acc_rslt_cstr */
|
||||
/* decoding information report request: access result constructor was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID info_acc_rslt_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("info_acc_rslt_cstr");
|
||||
|
||||
ar_ptr = req_info->acc_rslt_list;
|
||||
|
||||
_ms_get_va_access_rslt (aCtx, ar_ptr, info_acc_rslt_done);
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = info_acc_rslt_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* info_acc_rslt_done */
|
||||
/* decoding information report request: access result has been decoded. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID info_acc_rslt_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("info_acc_rslt_done");
|
||||
|
||||
req_info->num_of_acc_result++;
|
||||
if ((req_info->num_of_acc_result + 1) <= max_acc_rslt)
|
||||
{
|
||||
ar_ptr++;
|
||||
_ms_get_va_access_rslt (aCtx, ar_ptr, info_acc_rslt_done);
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* info_acc_rslt_cstr_done */
|
||||
/* decoding information report request: access result constructor done */
|
||||
/* was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID info_acc_rslt_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT req_size;
|
||||
VARIABLE_LIST *temp;
|
||||
|
||||
MLOG_CDEC0 ("info_acc_rslt_cstr_done");
|
||||
/* find actual size for request info */
|
||||
req_size = sizeof (INFO_REQ_INFO)
|
||||
+ (sizeof (VARIABLE_LIST)*req_info->va_spec.num_of_variables)
|
||||
+ (sizeof (ACCESS_RESULT)*req_info->num_of_acc_result);
|
||||
|
||||
/* give back unused storage */
|
||||
_mms_dec_info = (*m_realloc_os_fun) (_mms_dec_info,req_size);
|
||||
req_info = (INFO_REQ_INFO *) _mms_dec_info;
|
||||
|
||||
/* some C run time library mem mgmt. functions will always give back a */
|
||||
/* new pointer when reallocating smaller. In the case of info_req_info */
|
||||
/* we have to update the acc_rslt_list ptr to point to this new mem loc */
|
||||
|
||||
temp = (VARIABLE_LIST *) (req_info + 1);
|
||||
temp += req_info->va_spec.num_of_variables;
|
||||
req_info->acc_rslt_list = (ACCESS_RESULT *) temp;
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
266
mmslib/mmsl/rs_init.c
Normal file
266
mmslib/mmsl/rs_init.c
Normal file
@@ -0,0 +1,266 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2007, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rs_init.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the responder portion of the initiate */
|
||||
/* operation. It decodes the initiate request (indication) and */
|
||||
/* encodes the initiate response. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 11/01/07 EJV 09 Rem obsolete LLC30... code. */
|
||||
/* 03/09/05 EJV 08 Fixed thisFileName for MMS-EASE */
|
||||
/* 03/11/04 GLB 07 Cleaned up "thisFileName" */
|
||||
/* 12/20/01 JRB 06 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/08/00 RKR 05 Log error response for negative initiate resp*/
|
||||
/* instead of calling m_log_resp_info_fun. */
|
||||
/* 09/13/99 MDE 04 Added SD_CONST modifiers */
|
||||
/* 04/07/98 MDE 01 Minor restructure to eliminate warnings */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
#include "glbsem.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pcon.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* For debug version, use a static pointer to avoid duplication of */
|
||||
/* __FILE__ strings. */
|
||||
|
||||
#if defined(DEBUG_SISCO) && (defined(S_MT_SUPPORT) || !defined(MMS_LITE))
|
||||
SD_CONST static ST_CHAR *SD_CONST thisFileName = __FILE__;
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_init_req */
|
||||
/* Function called to decode an Initiate request PDU after the PDU type */
|
||||
/* has been determined. Sets up the parse of the next data element and */
|
||||
/* returns, letting the ASN.1 tools take over. */
|
||||
/* */
|
||||
/* NOTE : This functionality has been moved to mmsinit.c, because the */
|
||||
/* request and response are identical. The call to mms_init_req was */
|
||||
/* put back to better support MMSEASE-LITE. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_init_req (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("decode initiate request");
|
||||
_mms_init_dec (aCtx, SD_TRUE);
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_init_resp */
|
||||
/* create and send an initiate response */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_init_resp (MMSREQ_IND *indptr, INIT_INFO *info)
|
||||
{
|
||||
ST_UCHAR *msg_ptr;
|
||||
ST_RET ret;
|
||||
ST_INT i;
|
||||
ST_INT num_ui;
|
||||
INIT_UI *ui;
|
||||
INIT_UI *ui_ptr;
|
||||
ST_INT cs_count;
|
||||
CS_INIT_INFO *cs_info_ptr;
|
||||
ST_UCHAR *cs_build_bufs[MAX_INIT_CONTEXTS];
|
||||
ST_UCHAR *buf;
|
||||
ST_BOOLEAN context_accepted;
|
||||
ST_RET result;
|
||||
ST_INT16 reason;
|
||||
ST_INT16 eclass;
|
||||
ST_INT16 code;
|
||||
ASN1_ENC_CTXT localEncCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_ENC_CTXT *aCtx = &localEncCtx;
|
||||
|
||||
if (info->num_cs_init > MAX_INIT_CONTEXTS)
|
||||
return (ME_TOO_MANY_CONTEXTS);
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
context_accepted = SD_FALSE; /* clear flag */
|
||||
|
||||
if (!(ret = _ms_check_ind_actv (indptr)))
|
||||
{
|
||||
num_ui = info->num_cs_init;
|
||||
if (info->mms_p_context_pres)
|
||||
num_ui++;
|
||||
|
||||
if (num_ui)
|
||||
ui = ui_ptr = (INIT_UI *) chk_calloc (num_ui, sizeof (INIT_UI));
|
||||
else
|
||||
ui = NULL;
|
||||
|
||||
cs_count = 0;
|
||||
cs_info_ptr = (CS_INIT_INFO *) (info + 1);
|
||||
for (i = 0; i < num_ui; ++i, ++ui_ptr)
|
||||
{
|
||||
/* build the core initiate, if used and position reached or if no */
|
||||
/* companion standard initiates are to be sent */
|
||||
|
||||
if ((info->mms_p_context_pres && i == info->core_position) ||
|
||||
!info->num_cs_init)
|
||||
{
|
||||
if (info->rslt.accept_context)
|
||||
{
|
||||
context_accepted = SD_TRUE; /* set flag */
|
||||
msg_ptr = _ms_mk_init (aCtx, m_build_buf,mms_max_msgsize,info,MMSINITRESP,SD_FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg_ptr = _ms_mk_err_resp (aCtx, m_build_buf,mms_max_msgsize,indptr->op,indptr->id,
|
||||
info->rslt.err.eclass,info->rslt.err.code);
|
||||
eclass = info->rslt.err.eclass;
|
||||
code = info->rslt.err.code;
|
||||
}
|
||||
ui_ptr->context = MMS_PCI;
|
||||
if (info->rslt.accept_context)
|
||||
ui_ptr->reject = SD_FALSE;
|
||||
else
|
||||
ui_ptr->reject = SD_TRUE;
|
||||
ui_ptr->ui_len = M_BUILD_BUF_END - msg_ptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
buf = cs_build_bufs[cs_count++] = (ST_UCHAR *)
|
||||
chk_calloc (1,M_INIT_BUILD_LEN);
|
||||
if (cs_info_ptr->rslt.accept_context)
|
||||
{
|
||||
context_accepted = SD_TRUE; /* set flag */
|
||||
msg_ptr = _ms_mk_init (aCtx, buf,M_INIT_BUILD_LEN,
|
||||
(INIT_INFO *) cs_info_ptr,MMSINITRESP,SD_TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg_ptr = _ms_mk_err_resp (aCtx, buf,M_INIT_BUILD_LEN,indptr->op,indptr->id,
|
||||
cs_info_ptr->rslt.err.eclass,cs_info_ptr->rslt.err.code);
|
||||
eclass = cs_info_ptr->rslt.err.eclass;
|
||||
code = cs_info_ptr->rslt.err.code;
|
||||
}
|
||||
|
||||
ui_ptr->context = cs_info_ptr->p_context;
|
||||
if (cs_info_ptr->rslt.accept_context)
|
||||
ui_ptr->reject = SD_FALSE;
|
||||
else
|
||||
ui_ptr->reject = SD_TRUE;
|
||||
ui_ptr->ui_len = (buf + M_INIT_BUILD_LEN) - msg_ptr;
|
||||
}
|
||||
ui_ptr->ui_ptr = msg_ptr;
|
||||
}
|
||||
|
||||
/* Now set up the ACSE result & reason parameteds */
|
||||
if (context_accepted) /* if any context accepted */
|
||||
{
|
||||
result = 0;
|
||||
reason = 0;
|
||||
}
|
||||
else /* no context was accepted */
|
||||
{
|
||||
result = 1;
|
||||
reason = 1;
|
||||
}
|
||||
|
||||
/* If a response logging function is installed, call it */
|
||||
|
||||
if (result==0)
|
||||
{
|
||||
if (m_log_resp_info_fun && (mms_debug_sel & MMS_LOG_RESP))
|
||||
(*m_log_resp_info_fun) (indptr, info);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_log_error_resp_fun && (mms_debug_sel & MMS_LOG_RESP))
|
||||
(*m_log_error_resp_fun) (indptr, eclass, code);
|
||||
}
|
||||
|
||||
ret = _mllp_init_resp (indptr->chan,result,reason,
|
||||
num_ui, ui,indptr->add_addr_info);
|
||||
|
||||
_ms_ind_serve_done (indptr);
|
||||
|
||||
if (ui)
|
||||
chk_free (ui);
|
||||
|
||||
for (i = 0; i < info->num_cs_init; ++i) /* free CS build buffers */
|
||||
chk_free (cs_build_bufs[i]);
|
||||
}
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ret);
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_init_resp */
|
||||
/* create an initiate response */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_init_resp (INIT_INFO *info_ptr)
|
||||
{
|
||||
ST_RET ret;
|
||||
ASN1_ENC_CTXT localEncCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_ENC_CTXT *aCtx = &localEncCtx;
|
||||
|
||||
S_LOCK_COMMON_RESOURCES ();
|
||||
|
||||
mmsl_msg_start = _ms_mk_init (aCtx, mmsl_enc_buf, mmsl_enc_buf_size,
|
||||
info_ptr,MMSINITRESP,SD_FALSE);
|
||||
mmsl_msg_len = (mmsl_enc_buf + mmsl_enc_buf_size) - mmsl_msg_start;
|
||||
|
||||
if (!aCtx->asn1r_encode_overrun) /* Check for encode overrun */
|
||||
ret = SD_SUCCESS;
|
||||
else
|
||||
ret = ME_ASN1_ENCODE_OVERRUN;
|
||||
|
||||
S_UNLOCK_COMMON_RESOURCES ();
|
||||
return (ret);
|
||||
}
|
||||
|
||||
#ifdef CS_SUPPORT
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_cs_init_resp */
|
||||
/* create a companion standard initiate response */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_cs_init_resp (CS_INIT_INFO *info_ptr)
|
||||
{
|
||||
ASN1_ENC_CTXT localEncCtx; /* For readability, use "aCtx" to access this.*/
|
||||
ASN1_ENC_CTXT *aCtx = &localEncCtx;
|
||||
|
||||
mmsl_msg_start = _ms_mk_init (aCtx, mmsl_enc_buf, mmsl_enc_buf_size,
|
||||
(INIT_INFO *) info_ptr,MMSINITRESP,SD_TRUE);
|
||||
mmsl_msg_len = (mmsl_enc_buf + mmsl_enc_buf_size) - mmsl_msg_start;
|
||||
|
||||
if (aCtx->asn1r_encode_overrun) /* Check for encode overrun */
|
||||
return (ME_ASN1_ENCODE_OVERRUN);
|
||||
return (SD_SUCCESS);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/* mk_initiate */
|
||||
/* Note that there is only one mk_initiate function, and it is listed */
|
||||
/* in the mmsinit.c module. */
|
||||
/************************************************************************/
|
||||
341
mmslib/mmsl/rs_namel.c
Normal file
341
mmslib/mmsl/rs_namel.c
Normal file
@@ -0,0 +1,341 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2002, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rs_namel.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the responder portion of the GetNameList */
|
||||
/* service. It decodes the GetNameList request (indication) and */
|
||||
/* encodes the GetNameList response. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 10 Remove "thisFileName" */
|
||||
/* 07/01/02 EJV 09 NLV: support namelist for dom specific jou. */
|
||||
/* 12/20/01 JRB 08 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 05/05/00 JRB 07 Lint cleanup */
|
||||
/* 04/07/00 RKR 06 Added code to check for illegal scope & class*/
|
||||
/* 09/13/99 MDE 05 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 04 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 03 Changes to allow compile under C++ */
|
||||
/* 07/03/97 MDE 02 Op-specific info buffer handling changes */
|
||||
/* 06/09/97 MDE 01 Changed op specific buffer allocation */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pvmd.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static NAMELIST_REQ_INFO *info;
|
||||
|
||||
/* static functions */
|
||||
static ST_VOID namelist_get_extobjclass (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID namelist_get_objclass (ASN1_DEC_CTXT *aCtx);
|
||||
#ifdef CS_SUPPORT
|
||||
static ST_VOID namelist_get_cs_objclass (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID namelist_cs_objclass_done (ASN1_DEC_CTXT *aCtx);
|
||||
#endif
|
||||
static ST_VOID namelist_extobj_class_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID namelist_get_objscope (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID namelist_get_vmdscope (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID namelist_get_domscope (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID namelist_get_aascope (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID namelist_objscope_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID namelist_get_continue_after (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_namelist_req */
|
||||
/* This function is called from MMSDEC when the opcode of a request */
|
||||
/* PDU for this operation is decoded. Setup state machine function */
|
||||
/* pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_namelist_req (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("GetNameList Request");
|
||||
|
||||
|
||||
/* get storage for request information */
|
||||
info = (NAMELIST_REQ_INFO *) _m_get_dec_buf (aCtx, sizeof (NAMELIST_REQ_INFO));
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,0,namelist_get_extobjclass);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* namelist_get_extobjclass */
|
||||
/* GetNameList response is being decoded: object class parameter has */
|
||||
/* been encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID namelist_get_extobjclass (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("namelist_get_extobjclass");
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX,0,namelist_get_objclass);
|
||||
#ifdef CS_SUPPORT
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,1,namelist_get_cs_objclass);
|
||||
#endif
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* namelist_get_objclass */
|
||||
/* GetNameList response is being decoded: object class parameter has */
|
||||
/* been encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID namelist_get_objclass (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("namelist_get_objclass");
|
||||
/* read the object class */
|
||||
if (asn1r_get_i16 (aCtx, &info->obj.mms_class) ||
|
||||
info->obj.mms_class < 0 ||
|
||||
info->obj.mms_class > 11)
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, REQ_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = namelist_extobj_class_done;
|
||||
}
|
||||
|
||||
#ifdef CS_SUPPORT
|
||||
/************************************************************************/
|
||||
/* namelist_get_cs_objclass */
|
||||
/* GetNameList response is being decoded: CS object class parameter has */
|
||||
/* been encountered. The contents here are a ANY, defined by CS. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID namelist_get_cs_objclass (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("namelist_get_cs_objclass");
|
||||
|
||||
info->cs_objclass_pres = SD_TRUE; /* set flag for CS object */
|
||||
info->obj.cs.len = aCtx->asn1r_elmnt_len; /* save pointer and len */
|
||||
info->obj.cs.cs_class = aCtx->asn1r_field_ptr;
|
||||
|
||||
asn1r_parse_next (aCtx, namelist_cs_objclass_done); /* ensure valid ASN.1 CS data */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* namelist_cs_objclass_done */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID namelist_cs_objclass_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("namelist_cs_objclass_done");
|
||||
/* OK for extended object class to be done */
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = namelist_extobj_class_done;
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/* namelist_extobj_class_done */
|
||||
/* extendedObjectClass constructor done function. Set up to get Scope */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID namelist_extobj_class_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("namelist_extobj_class_done");
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX|CONSTR,1,namelist_get_objscope); /* get Object Scope */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* namelist_get_objscope */
|
||||
/* GetNameList response is being decoded: object scope constructor has */
|
||||
/* been encountered, set up to get scope */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID namelist_get_objscope (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("namelist_get_objscope");
|
||||
|
||||
/* This constructor contains one of three data elements, where the tag */
|
||||
/* is the scope identifier. */
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX,0,namelist_get_vmdscope);
|
||||
ASN1R_TAG_ADD (aCtx, CTX,1,namelist_get_domscope);
|
||||
ASN1R_TAG_ADD (aCtx, CTX,2,namelist_get_aascope);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* namelist_get_vmdscope */
|
||||
/* VMD scope, must be null */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID namelist_get_vmdscope (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("namelist_get_vmdscope");
|
||||
|
||||
if (aCtx->asn1r_elmnt_len) /* if not NULL */
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, REQ_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
info->objscope = VMD_SPEC; /* set scope */
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = namelist_objscope_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* namelist_get_domscope */
|
||||
/* VMD scope, must be null */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID namelist_get_domscope (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("namelist_get_domscope");
|
||||
|
||||
if ((asn1r_get_identifier (aCtx, info->dname)) || /* read the domain name */
|
||||
(info->obj.mms_class == MMS_CLASS_DOM) ||
|
||||
(info->obj.mms_class == MMS_CLASS_PI) ||
|
||||
(info->obj.mms_class == MMS_CLASS_OPER_STA))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, REQ_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
info->objscope = DOM_SPEC; /* set scope */
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = namelist_objscope_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* namelist_get_aascope */
|
||||
/* VMD scope, must be null */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID namelist_get_aascope (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("namelist_get_aascope");
|
||||
|
||||
if ((aCtx->asn1r_elmnt_len) || /* if not NULL */
|
||||
(info->obj.mms_class == MMS_CLASS_DOM) ||
|
||||
(info->obj.mms_class == MMS_CLASS_PI) ||
|
||||
(info->obj.mms_class == MMS_CLASS_OPER_STA) ||
|
||||
(info->obj.mms_class == MMS_CLASS_SEM))
|
||||
{
|
||||
asn1r_set_dec_err (aCtx, REQ_BAD_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
info->objscope = AA_SPEC; /* set scope */
|
||||
aCtx->asn1r_c_done_fun[aCtx->asn1r_msg_level] = namelist_objscope_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* namelist_objscope_done */
|
||||
/* object scope constructor complete, now the message could be done. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID namelist_objscope_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("namelist_objscope_done");
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
ASN1R_TAG_ADD (aCtx, CTX,2,namelist_get_continue_after);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* namelist_get_continue_after */
|
||||
/* GetNameList response is being decoded: continue after parameter was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID namelist_get_continue_after (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("namelist_get_continue_after");
|
||||
|
||||
info->cont_after_pres = SD_TRUE; /* read the continue */
|
||||
if (asn1r_get_identifier (aCtx, info->continue_after)) /* after parameter */
|
||||
asn1r_set_dec_err (aCtx, REQ_BAD_VALUE);
|
||||
|
||||
/* There are no other data elements in the message. Indicate that the */
|
||||
/* end of the message should have been reached, and that all construc- */
|
||||
/* tors should have ended at this point. */
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_namelist_resp */
|
||||
/* This function is called from the user to ENCODE and send the */
|
||||
/* GetNameList response PDU. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_namelist_resp (MMSREQ_IND *indptr, NAMELIST_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_send (MMSOP_GET_NAMLIST,indptr,
|
||||
M_CAST_MK_FUN (_ms_mk_namel_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_namelist_resp */
|
||||
/* This function is called by the user to ENCODE a GetNameList response */
|
||||
/* PDU. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_namelist_resp (ST_UINT32 invoke_id, NAMELIST_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_fin (MMSOP_GET_NAMLIST,invoke_id,
|
||||
M_CAST_MK_FUN (_ms_mk_namel_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_namel_resp */
|
||||
/* Construct a GetNameList RESPONSE: */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_namel_resp (ASN1_ENC_CTXT *aCtx, NAMELIST_RESP_INFO *info_ptr)
|
||||
{
|
||||
ST_CHAR **nptr; /* Ptr to array of name ptrs */
|
||||
ST_INT i;
|
||||
|
||||
if (!info_ptr -> more_follows) /* if not default value (SD_TRUE) */
|
||||
{
|
||||
asn1r_wr_bool (aCtx, info_ptr -> more_follows); /* write end of list boolean */
|
||||
asn1r_fin_prim (aCtx, 1,CTX);
|
||||
}
|
||||
|
||||
asn1r_strt_constr (aCtx); /* start the 'seqof' names cstr */
|
||||
|
||||
/* Calculate the address of the first name pointer. */
|
||||
|
||||
nptr = (ST_CHAR **)(info_ptr + 1);
|
||||
nptr += (info_ptr->num_names - 1); /* point to last name */
|
||||
|
||||
for (i=0;i < info_ptr -> num_names;i++)
|
||||
{
|
||||
asn1r_wr_vstr (aCtx, *nptr); /* write the list of names */
|
||||
asn1r_fin_prim (aCtx, VISTR_CODE,UNI);
|
||||
nptr--;
|
||||
}
|
||||
|
||||
asn1r_fin_constr (aCtx, 0,CTX,DEF); /* complete sequence of names */
|
||||
asn1r_fin_constr (aCtx, MMSOP_GET_NAMLIST,CTX,DEF); /* complete GetNameList resp */
|
||||
}
|
||||
209
mmslib/mmsl/rs_read.c
Normal file
209
mmslib/mmsl/rs_read.c
Normal file
@@ -0,0 +1,209 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rs_read.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the responder portion of variable read. */
|
||||
/* It decodes the variable read request (indication) & encodes */
|
||||
/* the variable read response. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 06 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 05 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 04 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 03 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 02 Changes to allow compile under C++ */
|
||||
/* 06/09/97 MDE 01 Changed op specific buffer allocation */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pvar.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static READ_REQ_INFO *req_info;
|
||||
static ST_INT max_vars;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID read_va_spec_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID read_va_spec_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID read_va_spec_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID read_get_spec_in_rslt (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_read_req */
|
||||
/* This function is called from MMSDEC when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_read_req (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT req_size;
|
||||
|
||||
MLOG_CDEC0 ("Variable Read Request");
|
||||
|
||||
#if defined(FIXED_DECBUF)
|
||||
max_vars = m_sv_max_read_var_spec;
|
||||
req_size = mmsl_dec_info_size;
|
||||
#else
|
||||
max_vars = _mmsdec_msglen / 4; /* find maximum storage required */
|
||||
if (m_sv_max_read_var_spec && (max_vars > m_sv_max_read_var_spec))
|
||||
max_vars = m_sv_max_read_var_spec;
|
||||
req_size = sizeof (READ_REQ_INFO) + (sizeof (VARIABLE_LIST) * max_vars);
|
||||
#endif
|
||||
|
||||
/* get storage for request information */
|
||||
req_info = (READ_REQ_INFO *) _m_get_dec_buf (aCtx, req_size);
|
||||
req_info->spec_in_result = SD_FALSE; /* set default value */
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 0, read_get_spec_in_rslt);
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 1, read_va_spec_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* read_get_spec_in_rslt */
|
||||
/* decoding variable read request: specification in result was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID read_get_spec_in_rslt (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("read_get_spec_in_rslt");
|
||||
|
||||
req_info->spec_in_result = SD_TRUE; /* specification in rslt pres */
|
||||
if (asn1r_get_bool (aCtx, &req_info->spec_in_result))
|
||||
asn1r_set_dec_err (aCtx, REQ_BAD_VALUE);
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 1, read_va_spec_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* read_va_spec_cstr */
|
||||
/* decoding variable read request: variable access specification */
|
||||
/* constructor was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID read_va_spec_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("read_va_spec_cstr");
|
||||
|
||||
_ms_get_va_spec (aCtx, &req_info->va_spec, max_vars, read_va_spec_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* read_va_spec_done */
|
||||
/* decoding variable read request: variable access specification */
|
||||
/* has been decoded. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID read_va_spec_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("read_va_spec_done");
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = read_va_spec_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* read_va_spec_cstr_done */
|
||||
/* decoding variable read request: variable access specification */
|
||||
/* constructor done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID read_va_spec_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT req_size;
|
||||
|
||||
/* find actual size for request info */
|
||||
req_size = sizeof (READ_REQ_INFO)
|
||||
+ (sizeof (VARIABLE_LIST)*req_info->va_spec.num_of_variables);
|
||||
|
||||
/* give back unused storage */
|
||||
_mms_dec_info = (*m_realloc_os_fun) (_mms_dec_info,req_size);
|
||||
req_info = (READ_REQ_INFO *) _mms_dec_info;
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_read_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE & send the variable read response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_read_resp (MMSREQ_IND *indptr, READ_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_send (MMSOP_READ,indptr,
|
||||
M_CAST_MK_FUN (_ms_mk_read_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_read_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the variable read response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_read_resp (ST_UINT32 invoke_id, READ_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_fin (MMSOP_READ,invoke_id,
|
||||
M_CAST_MK_FUN (_ms_mk_read_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_read_resp */
|
||||
/* Construct a variable read response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_read_resp (ASN1_ENC_CTXT *aCtx, READ_RESP_INFO *info)
|
||||
{
|
||||
ST_INT i;
|
||||
ACCESS_RESULT *ar_ptr;
|
||||
|
||||
asn1r_strt_constr (aCtx); /* start context tag 1 cstr */
|
||||
ar_ptr = info->acc_rslt_list;
|
||||
ar_ptr += info->num_of_acc_result - 1;
|
||||
for (i = 0; i < info->num_of_acc_result; i++)
|
||||
{
|
||||
_ms_wr_va_access_rslt (aCtx, ar_ptr);
|
||||
ar_ptr--;
|
||||
}
|
||||
asn1r_fin_constr (aCtx, 1,CTX, DEF); /* finish context tag 1 cstr */
|
||||
|
||||
if (info->va_spec_pres)
|
||||
{
|
||||
asn1r_strt_constr (aCtx); /* start context tag 0 cstr */
|
||||
_ms_wr_va_spec (aCtx, &info->va_spec);
|
||||
asn1r_fin_constr (aCtx, 0, CTX, DEF); /* finish context tag 0 cstr */
|
||||
}
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_READ,CTX,DEF); /* tag = opcode, ctx constr */
|
||||
}
|
||||
126
mmslib/mmsl/rs_repea.c
Normal file
126
mmslib/mmsl/rs_repea.c
Normal file
@@ -0,0 +1,126 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rs_repeas.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the responder portion of the report event */
|
||||
/* action status. It decodes the report event action status */
|
||||
/* request (indication) and encodes the report event action */
|
||||
/* status response. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 07 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 06 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 05 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 04 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 03 Changes to allow compile under C++ */
|
||||
/* 07/03/97 MDE 02 Op-specific info buffer handling changes */
|
||||
/* 06/09/97 MDE 01 Changed op specific buffer allocation */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pevn.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static REPEAS_REQ_INFO *req_info;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID repeas_objname_done (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_repeas_req */
|
||||
/* This function is called from mmsdec when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_repeas_req (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("Report Event Action Status Request");
|
||||
|
||||
/* get storage for request information */
|
||||
req_info = (REPEAS_REQ_INFO *) _m_get_dec_buf (aCtx, sizeof (REPEAS_REQ_INFO));
|
||||
aCtx->asn1r_err_fun = _mms_dec_buf_free;
|
||||
_ms_get_mms_objname (aCtx, &req_info->evact_name, repeas_objname_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* repeas_objname_done */
|
||||
/* Decoding get event action attributes request: event action name */
|
||||
/* has been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID repeas_objname_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_repeas_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE and send the report event action status response */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_repeas_resp (MMSREQ_IND *indptr, REPEAS_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_send (MMSOP_REP_EA_STAT,indptr,
|
||||
M_CAST_MK_FUN (_ms_mk_repeas_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_repeas_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the report event action status response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_repeas_resp (ST_UINT32 invoke_id, REPEAS_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_fin (MMSOP_REP_EA_STAT,invoke_id,
|
||||
M_CAST_MK_FUN (_ms_mk_repeas_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_repeas_resp */
|
||||
/* Construct a get event action attributes response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_repeas_resp (ASN1_ENC_CTXT *aCtx, REPEAS_RESP_INFO *info)
|
||||
{
|
||||
asn1r_wr_u32 (aCtx, info->num_of_ev_enroll); /* write # of event enrollments */
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_prim (aCtx, MMSOP_REP_EA_STAT,CTX); /* tag = opcode, ctx */
|
||||
}
|
||||
148
mmslib/mmsl/rs_repec.c
Normal file
148
mmslib/mmsl/rs_repec.c
Normal file
@@ -0,0 +1,148 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rs_repec.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the responder portion of the report event */
|
||||
/* condition status. It decodes the report event condition status */
|
||||
/* request (indication) and encodes the report event condition */
|
||||
/* status response. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 07 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 06 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 05 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 04 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 03 Changes to allow compile under C++ */
|
||||
/* 07/03/97 MDE 02 Op-specific info buffer handling changes */
|
||||
/* 06/09/97 MDE 01 Changed op specific buffer allocation */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pevn.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static REPECS_REQ_INFO *req_info;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID repecs_objname_done (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_repecs_req */
|
||||
/* This function is called from mmsdec when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_repecs_req (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("Report Event Condition Status Request");
|
||||
/* get storage for request information */
|
||||
req_info = (REPECS_REQ_INFO *) _m_get_dec_buf (aCtx, sizeof (REPECS_REQ_INFO));
|
||||
_ms_get_mms_objname (aCtx, &req_info->evcon_name, repecs_objname_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* repecs_objname_done */
|
||||
/* Decoding report event condition status request: event condition */
|
||||
/* name has been obtained */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID repecs_objname_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_repecs_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE and send the report event condition status */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_repecs_resp (MMSREQ_IND *indptr, REPECS_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_send (MMSOP_REP_EC_STAT,indptr,
|
||||
M_CAST_MK_FUN (_ms_mk_repecs_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_repecs_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the report event condition status. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_repecs_resp (ST_UINT32 invoke_id, REPECS_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_fin (MMSOP_REP_EC_STAT,invoke_id,
|
||||
M_CAST_MK_FUN (_ms_mk_repecs_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_repecs_resp */
|
||||
/* Construct a report event condition status response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_repecs_resp (ASN1_ENC_CTXT *aCtx, REPECS_RESP_INFO *info)
|
||||
{
|
||||
if (info->tti_time_pres)
|
||||
{ /* write tran to idle time */
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 4 constructor */
|
||||
_ms_wr_mms_evtime (aCtx, &info->tti_time);
|
||||
asn1r_fin_constr (aCtx, 4,CTX,DEF); /* finish ctx tag 4 constructor */
|
||||
}
|
||||
|
||||
if (info->tta_time_pres)
|
||||
{ /* write tran to active time */
|
||||
asn1r_strt_constr (aCtx); /* start ctx tag 3 constructor */
|
||||
_ms_wr_mms_evtime (aCtx, &info->tta_time);
|
||||
asn1r_fin_constr (aCtx, 3,CTX,DEF); /* finish ctx tag 3 constructor */
|
||||
}
|
||||
|
||||
if (info->enabled_pres)
|
||||
{ /* write enabled indicator */
|
||||
asn1r_wr_bool (aCtx, info->enabled);
|
||||
asn1r_fin_prim (aCtx, 2,CTX); /* finish ctx tag 2 */
|
||||
}
|
||||
|
||||
asn1r_wr_u32 (aCtx, info->num_of_ev_enroll); /* write # of event enrollments */
|
||||
asn1r_fin_prim (aCtx, 1, CTX); /* ctx tag 1 */
|
||||
|
||||
asn1r_wr_i16 (aCtx, info->cur_state);
|
||||
asn1r_fin_prim (aCtx, 0, CTX);
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_REP_EC_STAT,CTX,DEF); /* tag = opcode, ctx */
|
||||
}
|
||||
142
mmslib/mmsl/rs_repee.c
Normal file
142
mmslib/mmsl/rs_repee.c
Normal file
@@ -0,0 +1,142 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rs_repees.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the responder portion of the report event */
|
||||
/* enrollment status. It decodes the report event enrollment */
|
||||
/* status request (indication) and encodes the report event */
|
||||
/* enrollment status response. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 07 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 06 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 05 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 04 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 03 Changes to allow compile under C++ */
|
||||
/* 07/03/97 MDE 02 Op-specific info buffer handling changes */
|
||||
/* 06/09/97 MDE 01 Changed op specific buffer allocation */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pevn.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static REPEES_REQ_INFO *req_info;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID repees_objname_done (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_repees_req */
|
||||
/* This function is called from mmsdec when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_repees_req (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("Report Event Enrollment Status Request");
|
||||
req_info = (REPEES_REQ_INFO *) _m_get_dec_buf (aCtx, sizeof (REPEES_REQ_INFO));
|
||||
_ms_get_mms_objname (aCtx, &req_info->evenroll_name, repees_objname_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* repees_objname_done */
|
||||
/* Decoding report event enrollment status request: event enrollment */
|
||||
/* name has been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID repees_objname_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_repees_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE & send the report event enrollment status response */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_repees_resp (MMSREQ_IND *indptr, REPEES_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_send (MMSOP_REP_EE_STAT,indptr,
|
||||
M_CAST_MK_FUN (_ms_mk_repees_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_repees_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the report event enrollment status response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_repees_resp (ST_UINT32 invoke_id, REPEES_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_fin (MMSOP_REP_EE_STAT,invoke_id,
|
||||
M_CAST_MK_FUN (_ms_mk_repees_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_repees_resp */
|
||||
/* Construct a report event enrollment status response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_repees_resp (ASN1_ENC_CTXT *aCtx, REPEES_RESP_INFO *info)
|
||||
{
|
||||
asn1r_wr_i16 (aCtx, info->cur_state); /* write current state */
|
||||
asn1r_fin_prim (aCtx, 4, CTX); /* ctx tag 4 */
|
||||
|
||||
if (info->alarm_ack_rule_pres)
|
||||
{
|
||||
asn1r_wr_i16 (aCtx, info->alarm_ack_rule); /* write alarm ack rule */
|
||||
asn1r_fin_prim (aCtx, 3, CTX); /* ctx tag 3 */
|
||||
}
|
||||
|
||||
asn1r_wr_i16 (aCtx, info->duration); /* write the duration */
|
||||
asn1r_fin_prim (aCtx, 2, CTX); /* ctx tag 2 */
|
||||
|
||||
if (info->not_lost)
|
||||
{ /* not the default */
|
||||
asn1r_wr_u8 (aCtx, info->not_lost); /* write notification lost */
|
||||
asn1r_fin_prim (aCtx, 1, CTX); /* ctx tag 1 */
|
||||
}
|
||||
|
||||
asn1r_wr_bitstr (aCtx, &info->ec_transitions, 7);
|
||||
asn1r_fin_prim (aCtx, 0, CTX);
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_REP_EE_STAT,CTX,DEF); /* tag = opcode, ctx */
|
||||
}
|
||||
120
mmslib/mmsl/rs_stat.c
Normal file
120
mmslib/mmsl/rs_stat.c
Normal file
@@ -0,0 +1,120 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rs_stat.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the functions to decode a status request */
|
||||
/* and encode a status response message. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 07 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 06 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 05 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 04 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 03 Changes to allow compile under C++ */
|
||||
/* 07/03/97 MDE 02 Op-specific info buffer handling changes */
|
||||
/* 06/09/97 MDE 01 Changed op specific buffer allocation */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pvmd.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
static STATUS_REQ_INFO *info;
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_status_req */
|
||||
/* This function is called from mmsdec to decode a Status request PDU */
|
||||
/* after the PDU type has been determined. It sets up the parse of */
|
||||
/* the next data element and returns, letting the ASN.1 tools take over.*/
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_status_req (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("decode status request");
|
||||
|
||||
info = (STATUS_REQ_INFO *) _m_get_dec_buf (aCtx, sizeof (STATUS_REQ_INFO));
|
||||
if (asn1r_get_bool (aCtx, &info -> extended)) /* Read extended flag. */
|
||||
{ /* If error reading boolean, */
|
||||
asn1r_set_dec_err (aCtx, REQ_BAD_VALUE); /* stop parse, report error */
|
||||
return; /* and return. */
|
||||
}
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_status_resp */
|
||||
/* This function is called from the user to ENCODE and send the */
|
||||
/* Status response PDU. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_status_resp (MMSREQ_IND *indptr, STATUS_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_send (MMSOP_STATUS,indptr,
|
||||
M_CAST_MK_FUN (_ms_mk_stat_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_status_resp */
|
||||
/* This function is called by the user to ENCODE the Status response */
|
||||
/* PDU. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_status_resp (ST_UINT32 invoke_id, STATUS_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_fin (MMSOP_STATUS,invoke_id,
|
||||
M_CAST_MK_FUN (_ms_mk_stat_resp),
|
||||
(ST_CHAR *)info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_stat_req */
|
||||
/* ENCODE a Status RESPONSE: */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_stat_resp (ASN1_ENC_CTXT *aCtx, STATUS_RESP_INFO *info_ptr)
|
||||
{
|
||||
if (info_ptr->local_detail_pres) /* if present, write the local */
|
||||
{ /* detail parameter */
|
||||
asn1r_wr_bitstr (aCtx, info_ptr->local_detail,info_ptr->local_detail_len);
|
||||
asn1r_fin_prim (aCtx, 2,CTX);
|
||||
}
|
||||
|
||||
asn1r_wr_i16 (aCtx, info_ptr->physical_stat); /* write the physical status */
|
||||
asn1r_fin_prim (aCtx, 1,CTX);
|
||||
|
||||
asn1r_wr_i16 (aCtx, info_ptr->logical_stat); /* write the logical status */
|
||||
asn1r_fin_prim (aCtx, 0,CTX);
|
||||
|
||||
/* Write the context-specific tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_STATUS,CTX,DEF);
|
||||
}
|
||||
151
mmslib/mmsl/rs_trige.c
Normal file
151
mmslib/mmsl/rs_trige.c
Normal file
@@ -0,0 +1,151 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rs_trige.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the responder portion of trigger event. */
|
||||
/* It decodes the trigger event request (indication) & encodes */
|
||||
/* the trigger event response. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 05 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 04 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 03 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 02 Changes to decode buffer allocation scheme */
|
||||
/* 07/03/97 MDE 01 Op-specific info buffer handling changes */
|
||||
/* 06/09/97 MDE 01 Changed op specific buffer allocation */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pevn.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static TRIGE_REQ_INFO *req_info;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID trige_get_priority (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID trige_name_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID trige_name_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID trige_name_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_trige_req */
|
||||
/* This function is called from MMSDEC when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_trige_req (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("Trigger Event Request");
|
||||
req_info = (TRIGE_REQ_INFO *) _m_get_dec_buf (aCtx, sizeof (TRIGE_REQ_INFO));
|
||||
|
||||
/* req_info->priority_pres = SD_FALSE; set default values */
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 0, trige_name_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* trige_name_cstr */
|
||||
/* trigger event request is being decoded: event condition name constr */
|
||||
/* was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID trige_name_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("trige_name_cstr");
|
||||
|
||||
_ms_get_mms_objname (aCtx, &req_info->evcon_name, trige_name_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* trige_name_done */
|
||||
/* trigger event request is being decoded: event condition name has */
|
||||
/* been obtained. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID trige_name_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = trige_name_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* trige_name_cstr_done */
|
||||
/* trigger event request is being decoded: event condition name constr */
|
||||
/* done was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID trige_name_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("trige_name_done");
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX, 1, trige_get_priority);
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* trige_get_priority */
|
||||
/* Decoding trigger event request: priority was encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID trige_get_priority (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("trige_get_priority");
|
||||
|
||||
req_info->priority_pres = SD_TRUE;
|
||||
|
||||
if (asn1r_get_u8 (aCtx, &(req_info->priority))) /* read priority */
|
||||
asn1r_set_dec_err (aCtx, REQ_BAD_VALUE);
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_trige_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE and send the trigger event response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_trige_resp (MMSREQ_IND *indptr)
|
||||
{
|
||||
return (_mms_send_null_resp (indptr,MMSOP_TRIGGER_EV));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_trige_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE the trigger event response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_trige_resp (ST_UINT32 invoke_id)
|
||||
{
|
||||
return (_mms_fin_null_resp (invoke_id,MMSOP_TRIGGER_EV));
|
||||
}
|
||||
#endif
|
||||
47
mmslib/mmsl/rs_ustat.c
Normal file
47
mmslib/mmsl/rs_ustat.c
Normal file
@@ -0,0 +1,47 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rs_ustat.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the functions to decode an Unsolicited */
|
||||
/* status request. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 03 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 02 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* Deleted mms_status proto (see mms_dfun.h) */
|
||||
/* 09/13/99 MDE 01 Added SD_CONST modifiers */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_ustatus_req */
|
||||
/* This function is called from mmsdec to decode an UnsolicitedStatus */
|
||||
/* request PDU after the PDU type has been determined. It simply calls */
|
||||
/* mms_status in the module mmsstat.c. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_ustatus_req (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("decode unsolicited status reques");
|
||||
mms_status (aCtx);
|
||||
}
|
||||
248
mmslib/mmsl/rs_write.c
Normal file
248
mmslib/mmsl/rs_write.c
Normal file
@@ -0,0 +1,248 @@
|
||||
/************************************************************************/
|
||||
/* SISCO SOFTWARE MODULE HEADER *****************************************/
|
||||
/************************************************************************/
|
||||
/* (c) Copyright Systems Integration Specialists Company, Inc., */
|
||||
/* 1986 - 2001, All Rights Reserved. */
|
||||
/* */
|
||||
/* PROPRIETARY AND CONFIDENTIAL */
|
||||
/* */
|
||||
/* MODULE NAME : rs_write.c */
|
||||
/* PRODUCT(S) : MMSEASE, MMSEASE-LITE */
|
||||
/* */
|
||||
/* MODULE DESCRIPTION : */
|
||||
/* This module contains the responder portion of variable write. */
|
||||
/* It decodes the variable write request (indication) & encodes */
|
||||
/* the variable write response. */
|
||||
/* */
|
||||
/* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : */
|
||||
/* */
|
||||
/* MODIFICATION LOG : */
|
||||
/* Date Who Rev Comments */
|
||||
/* -------- --- ------ ------------------------------------------- */
|
||||
/* 03/11/04 GLB 06 Remove "thisFileName" */
|
||||
/* 12/20/01 JRB 05 Converted to use ASN1R (re-entrant ASN1) */
|
||||
/* 09/13/99 MDE 04 Added SD_CONST modifiers */
|
||||
/* 03/23/99 MDE 03 Changes to decode buffer allocation scheme */
|
||||
/* 06/15/98 MDE 02 Changes to allow compile under C++ */
|
||||
/* 07/03/97 MDE 01 Op-specific info buffer handling changes */
|
||||
/* 04/02/97 DTL 7.00 MMSEASE 7.0 release. See MODL70.DOC for */
|
||||
/* history. */
|
||||
/************************************************************************/
|
||||
|
||||
#include "glbtypes.h"
|
||||
#include "sysincs.h"
|
||||
|
||||
#include "mmsdefs.h"
|
||||
#include "mms_pvar.h"
|
||||
#include "asn1defs.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the DECODE portion : */
|
||||
|
||||
static WRITE_REQ_INFO *req_info;
|
||||
|
||||
static VAR_ACC_DATA *data_ptr;
|
||||
static ST_INT max_vars;
|
||||
static ST_INT max_data_count;
|
||||
|
||||
/************************************************************************/
|
||||
/* variables global to the ENCODE portion : NONE */
|
||||
|
||||
static ST_VOID write_data_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID write_data_cstr_done (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID write_data_cstr (ASN1_DEC_CTXT *aCtx);
|
||||
static ST_VOID write_va_spec_done (ASN1_DEC_CTXT *aCtx);
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mms_write_req */
|
||||
/* This function is called from MMSDEC when the opcode for this */
|
||||
/* operation is decoded. Setup state machine function pointers, etc. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID mms_write_req (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT req_size;
|
||||
ST_INT req_size1;
|
||||
ST_INT req_size2;
|
||||
|
||||
MLOG_CDEC0 ("Variable Write Request");
|
||||
|
||||
#if defined(FIXED_DECBUF)
|
||||
max_vars = m_sv_max_write_var_spec;
|
||||
max_data_count = m_sv_max_write_data;
|
||||
req_size = mmsl_dec_info_size;
|
||||
#else
|
||||
max_vars = _mmsdec_msglen / 7;
|
||||
max_data_count = _mmsdec_msglen / 3;
|
||||
|
||||
if (m_sv_max_write_var_spec && (max_vars > m_sv_max_write_var_spec))
|
||||
max_vars = m_sv_max_write_var_spec;
|
||||
|
||||
if (m_sv_max_write_data && (max_data_count > m_sv_max_write_data))
|
||||
max_data_count = m_sv_max_write_data;
|
||||
|
||||
/* Case of list of variables */
|
||||
req_size1 = (sizeof(VARIABLE_LIST) + sizeof(VAR_ACC_DATA)) * max_vars;
|
||||
|
||||
/* Case of named variable list */
|
||||
req_size2 = sizeof (VAR_ACC_DATA) * max_data_count;
|
||||
|
||||
/* Choose the largest */
|
||||
req_size = sizeof (WRITE_REQ_INFO) + max (req_size1, req_size2);
|
||||
#endif
|
||||
|
||||
/* get storage for request information */
|
||||
req_info = (WRITE_REQ_INFO *) _m_get_dec_buf (aCtx, req_size);
|
||||
_ms_get_va_spec (aCtx, &req_info->va_spec, max_vars, write_va_spec_done);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* write_va_spec_done */
|
||||
/* decoding variable write request: variable access specification */
|
||||
/* has been decoded. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID write_va_spec_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
VARIABLE_LIST *temp;
|
||||
|
||||
MLOG_CDEC0 ("write_va_spec_done");
|
||||
|
||||
temp = (VARIABLE_LIST *) (req_info + 1);
|
||||
temp += req_info->va_spec.num_of_variables;
|
||||
|
||||
req_info->va_data = (VAR_ACC_DATA *) temp;
|
||||
|
||||
ASN1R_TAG_ADD (aCtx, CTX | CONSTR, 0, write_data_cstr);
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* write_data_cstr */
|
||||
/* decoding variable write request: write data constructor was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID write_data_cstr (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("write_data_cstr");
|
||||
|
||||
data_ptr = req_info->va_data;
|
||||
|
||||
_ms_get_va_data (aCtx, data_ptr, write_data_done);
|
||||
aCtx->asn1r_c_done_fun [aCtx->asn1r_msg_level] = write_data_cstr_done;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* write_data_done */
|
||||
/* decoding variable write request: write data has been decoded. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID write_data_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
MLOG_CDEC0 ("write_data_done");
|
||||
|
||||
req_info->num_of_data++;
|
||||
if ((req_info->num_of_data + 1) <= max_data_count)
|
||||
{
|
||||
data_ptr++;
|
||||
_ms_get_va_data (aCtx, data_ptr, write_data_done);
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* write_data_cstr_done */
|
||||
/* decoding variable write request: write data constructor done was */
|
||||
/* encountered. */
|
||||
/************************************************************************/
|
||||
|
||||
static ST_VOID write_data_cstr_done (ASN1_DEC_CTXT *aCtx)
|
||||
{
|
||||
ST_INT req_size;
|
||||
VARIABLE_LIST *temp;
|
||||
|
||||
MLOG_CDEC0 ("write_data_cstr_done");
|
||||
/* find actual size for request info */
|
||||
req_size = sizeof (WRITE_REQ_INFO)
|
||||
+ (sizeof (VARIABLE_LIST)*req_info->va_spec.num_of_variables)
|
||||
+ (sizeof (VAR_ACC_DATA) *req_info->num_of_data);
|
||||
|
||||
/* give back unused storage */
|
||||
_mms_dec_info = (*m_realloc_os_fun) (_mms_dec_info,req_size);
|
||||
req_info = (WRITE_REQ_INFO *) _mms_dec_info;
|
||||
|
||||
/* some C run time library mem mgmt. functions will always give back a */
|
||||
/* new pointer when reallocating smaller. In the case of write_req_info */
|
||||
/* we have to update the va_data to point to this new mem loc */
|
||||
temp = (VARIABLE_LIST *) (req_info + 1);
|
||||
temp += req_info->va_spec.num_of_variables;
|
||||
|
||||
req_info->va_data = (VAR_ACC_DATA *) temp;
|
||||
|
||||
_ms_set_cs_check (aCtx); /* check for Companion Standard info */
|
||||
}
|
||||
|
||||
|
||||
#ifndef MMS_LITE
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mp_write_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE & send the variable write response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mp_write_resp (MMSREQ_IND *indptr, WRITE_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_send (MMSOP_WRITE,indptr,
|
||||
M_CAST_MK_FUN (_ms_mk_write_resp),
|
||||
(ST_CHAR *) info_ptr));
|
||||
}
|
||||
|
||||
#else
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* mpl_write_resp */
|
||||
/* This function is called from either the application or the virtual */
|
||||
/* machine to ENCODE & send the variable write response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_RET mpl_write_resp (ST_UINT32 invoke_id, WRITE_RESP_INFO *info_ptr)
|
||||
{
|
||||
return (_mms_resp_fin (MMSOP_WRITE,invoke_id,
|
||||
M_CAST_MK_FUN (_ms_mk_write_resp),
|
||||
(ST_CHAR *) info_ptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/* _ms_mk_write_resp */
|
||||
/* Construct a variable write response. */
|
||||
/************************************************************************/
|
||||
|
||||
ST_VOID _ms_mk_write_resp (ASN1_ENC_CTXT *aCtx, WRITE_RESP_INFO *info)
|
||||
{
|
||||
ST_INT i;
|
||||
WRITE_RESULT *temp; /* index into array of structs */
|
||||
|
||||
temp = (WRITE_RESULT *) (info + 1);
|
||||
temp += (info->num_of_result - 1);
|
||||
for (i = info->num_of_result; i ; --i)
|
||||
{
|
||||
if (temp->resp_tag == SD_TRUE)
|
||||
{ /* success, null response */
|
||||
asn1r_fin_prim (aCtx, 1, CTX); /* finish context tag 1 prim */
|
||||
}
|
||||
else
|
||||
{ /* failure, write failure code */
|
||||
asn1r_wr_i16 (aCtx, temp->failure);
|
||||
asn1r_fin_prim (aCtx, 0, CTX); /* finish context tag 0 prim */
|
||||
}
|
||||
temp--;
|
||||
}
|
||||
|
||||
/* write the context specific explicit tag for this opcode. */
|
||||
asn1r_fin_constr (aCtx, MMSOP_WRITE,CTX,DEF); /* tag = opcode, ctx constr */
|
||||
}
|
||||
Reference in New Issue
Block a user