📄 caix.c
字号:
#ifdef FEATURE_MSG_PACK_UNIT_TEST
int_ptr->tc_ord.ordq.ordq_incl = 0;
#endif
/* -----------------------------------------------------------------
** Length is OK --> convert message from external to internal format
** starting with the first field after message_type
** ----------------------------------------------------------------- */
xlate_ext_tc_hdr( buf_ptr, &int_ptr->tc_ord.gen.hdr );
#ifdef FEATURE_IS2000_REL_A
#error code not present
#endif /* FEATURE_IS2000_REL_A */
int_ptr->tc_ord.gen.use_time = b_unpackb( PARAMS( gen.use_time ));
int_ptr->tc_ord.gen.action_time = b_unpackb( PARAMS( gen.action_time ));
int_ptr->tc_ord.gen.order = b_unpackb( PARAMS( gen.order ));
add_record_len = b_unpackb( PARAMS( gen.add_record_len ));
if (add_record_len == 0) {
if ((int_ptr->tc_ord.gen.order == CAI_BS_CHAL_CONF_ORD) ||
(int_ptr->tc_ord.gen.order == CAI_LOCK_OR_MAINT_ORD) ||
(int_ptr->tc_ord.gen.order == CAI_SO_REQ_ORD) ||
(int_ptr->tc_ord.gen.order == CAI_SO_RESP_ORD) ||
(int_ptr->tc_ord.gen.order == CAI_DTMF_ORD) ||
(int_ptr->tc_ord.gen.order == CAI_STATUS_ORD))
{
/* --------------------------------
** Message needs additional records
** -------------------------------- */
status = CAIX_INV_LEN_S;
}
else {
/* --------------------------------------------
** No order qualifier implicitly means ordq = 0
** (see PN-3118 Section 7.7.4)
** -------------------------------------------- */
int_ptr->tc_ord.ordq.ordq = 0;
status = CAIX_DONE_S;
}
}
else {
#ifdef FEATURE_MSG_PACK_UNIT_TEST
int_ptr->tc_ord.ordq.ordq_incl = 1;
#endif
/* --------------------------------------------------------------
** Additional record length is at least 1 so parse out ordq field
** -------------------------------------------------------------- */
int_ptr->tc_ord.ordq.ordq = b_unpackb( PARAMS( ordq.ordq ));
/* -----------------------------------
** Parse out longer orders as required
** ----------------------------------- */
switch (int_ptr->tc_ord.gen.order) {
case CAI_BS_CHAL_CONF_ORD:
/* -----------------------------------------
** Base Station Challenge Confirmation Order
** ----------------------------------------- */
if (add_record_len >= 4) {
int_ptr->tc_ord.chal.authbs = b_unpackd( PARAMS( chal.authbs ));
status = CAIX_DONE_S;
}
else {
status = CAIX_INV_LEN_S;
}
break;
case CAI_SO_REQ_ORD:
/* ----------------------------
** Service Option Request Order
** ---------------------------- */
if (add_record_len >= 3) {
int_ptr->tc_ord.so_req.service_option =
b_unpackw( PARAMS( so_req.service_option ));
status = CAIX_DONE_S;
}
else {
status = CAIX_INV_LEN_S;
}
break;
case CAI_SO_RESP_ORD:
/* -----------------------------
** Service Option Response Order
** ----------------------------- */
if (add_record_len >= 3) {
int_ptr->tc_ord.so_res.service_option =
b_unpackw( PARAMS( so_res.service_option ));
status = CAIX_DONE_S;
}
else {
status = CAIX_INV_LEN_S;
}
break;
case CAI_PILOT_MEASURE_ORD:
/* ----------------------------------------
** Periodic Pilot Measurement Request Order
** Must be correct length and have correct ORDQ
** ---------------------------------------- */
if ( (add_record_len >= 3)
#ifndef FEATURE_MSG_PACK_UNIT_TEST
&& (int_ptr->tc_ord.ordq.ordq >= CAI_VAL_RPT_PER)
#endif
)
{
int_ptr->tc_ord.ppm.min_pilot_pwr_thresh =
b_unpackw( PARAMS( ppm.min_pilot_pwr_thresh ));
int_ptr->tc_ord.ppm.min_pilot_ec_io_thresh =
b_unpackw( PARAMS( ppm.min_pilot_ec_io_thresh ));
status = CAIX_DONE_S;
}
else
{
status = CAIX_INV_LEN_S;
}
break;
/* Removing FEATURE_IS2000_REV0_PREADDENDUM */
case CAI_RETRY_ORD:
int_ptr->tc_ord.retry.retry_type =
b_unpackb( PARAMS( retry.retry_type ));
if (int_ptr->tc_ord.retry.retry_type)
{
int_ptr->tc_ord.retry.retry_delay =
b_unpackb( PARAMS( retry.retry_delay ));
}
status = CAIX_DONE_S;
break;
default:
/* -------------------------------------------------------
** Must be an order which only requires an order qualifier
** ------------------------------------------------------- */
status = CAIX_DONE_S;
} /* end switch (int_ptr->tc_ord.gen.order) */
} /* else */
#ifdef FEATURE_IS2000_REL_A
#error code not present
#endif /* FEATURE_IS2000_REL_A */
} /* else length is ok */
#undef MTYPE
return (status);
} /* xlate_ext_tc_ord */
/* <EJECT> */
/*===========================================================================
FUNCTION XLATE_EXT_AUTH_CH
DESCRIPTION
This function translates a Traffic Channel Authentication Challenge
Message from external to internal format.
DEPENDENCIES
Assumes that the internal message type received as an input to the
procedure already includes the Authentication Challenge message type.
RETURN VALUE
Errors that were encountered while translating the message.
SIDE EFFECTS
None
===========================================================================*/
word xlate_ext_auth_ch
(
word len,
/* Length of message in bits */
byte *buf_ptr,
/* Pointer to received message to be translated */
caii_rx_msg_type *int_ptr
/* Pointer to place where translated message should be placed */
)
{
word status = CAIX_DONE_S;
/* Status returned to calling procedure */
#ifdef FEATURE_IS2000_REL_A
#error code not present
#endif /* FEATURE_IS2000_REL_A */
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/* -----------------------------------
** Define type for use in PARAMS macro
** ----------------------------------- */
#define MTYPE cai_auth_ch_type
/* --------------------------------------------
** Determine if message is of sufficient length
** -------------------------------------------- */
if (len < sizeof( cai_auth_ch_type )) {
status = CAIX_INV_LEN_S;
}
else {
/* -----------------------------------------------------------------
** Length is OK --> convert message from external to internal format
** starting with the first field after message_type
** ----------------------------------------------------------------- */
xlate_ext_tc_hdr( buf_ptr, &int_ptr->auth_ch.hdr );
#ifdef FEATURE_IS2000_REL_A
#error code not present
#else
int_ptr->auth_ch.randu = b_unpackd( PARAMS( randu ));
#endif /* FEATURE_IS2000_REL_A */
#ifdef FEATURE_IS2000_REL_A
#error code not present
#endif /* FEATURE_IS2000_REL_A */
}
#undef MTYPE
return (status);
} /* xlate_ext_auth_ch */
/*===========================================================================
INFORMATION RECORD PARSING FUNCTIONS
DESCRIPTION
The functions that follow consolidate code used to parse information
records created by IS-95B that appear on the Paging and Forward Traffic
Channel, specifically in the Feature Notification Message and the
Alert With Information and Flash With Information messages.
===========================================================================*/
/* <EJECT> */
/*===========================================================================
FUNCTION XLATE_EXT_SUB_REC
DESCRIPTION
This function translates the Called Party Subaddress/Calling Party
Subaddress/Redirect Subaddress/Connected Subaddress information records
appended to the Feature Notification Message on the Paging Channel, or
the Alert with Information or Flash with Information Messages on the
Forward Traffic Channels.
DEPENDENCIES
Assumes that the buffer pointer received as an input to the
procedure points to the first bit of the subaddress record and the
internal message pointer points to the record.
RETURN VALUE
Errors that were encountered while translating the message.
SIDE EFFECTS
None
===========================================================================*/
word xlate_ext_sub_rec
(
word rec_len,
/* Length in bits of the information record to be parsed */
byte *buf_ptr,
/* Pointer to received message to be translated */
byte *msg_ptr,
/* Pointer to position inside the internal message type */
word *msg_pos_ptr
/* Pointer to position of record inside message */
)
{
word i;
/* Index for looping through neighbors */
word status;
/* Status to be returned to calling procedure */
word msg_pos;
/* Position of record inside the message */
msg_pos = *msg_pos_ptr;
/* --------------------------------------------------------
** Calling Party Subaddress or Called Party Subaddress
** or Redirecting Subaddress or Connected Subaddress info record
** -------------------------------------------------------- */
((caii_subaddr_rec_type *) msg_ptr)->fix.extension_bit =
b_unpackb( buf_ptr, msg_pos,
FSIZ( cai_subaddr_fix_type, extension_bit ));
msg_pos += FSIZ( cai_subaddr_fix_type, extension_bit );
((caii_subaddr_rec_type *) msg_ptr)->fix.subadd_type =
b_unpackb( buf_ptr, msg_pos,
FSIZ( cai_subaddr_fix_type, subadd_type ));
msg_pos += FSIZ( cai_subaddr_fix_type, subadd_type );
((caii_subaddr_rec_type *) msg_ptr)->fix.odd_even_ind =
b_unpackb( buf_ptr, msg_pos,
FSIZ( cai_subaddr_fix_type, odd_even_ind ));
msg_pos += FSIZ( cai_subaddr_fix_type, odd_even_ind );
msg_pos += FSIZ( cai_subaddr_fix_type, reserved );
/* End Unpacking of Fixed Type */
/* Begin packing Variable Type */
((caii_subaddr_rec_type *) msg_ptr)->fix.num_char =
(byte) (((rec_len - sizeof( cai_subaddr_fix_type ))
/ sizeof( cai_subaddr_var_type )));
for (i=0;
i < ((caii_subaddr_rec_type *) msg_ptr)->fix.num_char; i++)
{
(( caii_subaddr_rec_type*) msg_ptr)->var[i] =
b_unpackb( buf_ptr, msg_pos,
FSIZ( cai_subaddr_var_type, chari ));
msg_pos += FSIZ( cai_subaddr_var_type, chari );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -