⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 caix.c

📁 brew代码里面的一个文件
💻 C
📖 第 1 页 / 共 5 页
字号:
===========================================================================*/

#include "comdef.h"
#include "qw.h"
#include "cai.h"
#include "caii.h"
#include "caix.h"
#include "bit.h"
#include "msg.h"
#include "target.h"
#include "customer.h"
#ifdef FEATURE_AUTH
#include "auth.h"
#endif /* FEATURE_AUTH */
#ifdef FEATURE_TMSI
#include "tmsi.h"
#endif /* FEATURE_TMSI */
#ifndef FEATURE_MSG_PACK_UNIT_TEST
#include "mc.h"
#ifdef FEATURE_IS2000_REL_A_CC
#error code not present
#endif /* FEATURE_IS2000_REL_A_CC */
#endif
#include "err.h"

/* <EJECT> */
/*===========================================================================

                DEFINITIONS AND DECLARATIONS FOR MODULE

This section contains definitions for constants, macros, types, variables
and other items needed by this module.

===========================================================================*/

byte caix_p_rev_in_use;

void caix_set_p_rev_in_use(byte p_rev_in_use)
{
  caix_p_rev_in_use = p_rev_in_use;
}

#define AC_L2_LENGTH_NUM_BITS 5
word ac_l2_length_pos = 0;
word ac_l2_start_pos = 0;
word ac_l2_num_bits = 0;
word ac_l2_num_bytes = 0;
word ac_l2_num_reserved = 0;
word ac_plt_rpt_len = 0;

word xlate_int_plt_rpt
(
  word *len_ptr,
    /* Length of message in bits */
  byte *buf_ptr,
    /* Pointer to where translated message should be placed */
  word buffer_offset,
    /* offset into buffer to start placing the message */
  caii_plt_rpt_type *int_ptr
    /* Pointer to internal message to be transmitted */
);

word global_buf_pos = 0;

/* Structure to hold all IS95 timeout values that may be changed for
 * debug purposes.
 */

cai_tmo_type cai_tmo =
{
  CAI_T1M,

  CAI_T2M,

  CAI_T3M,
  CAI_T4M,
  CAI_T5M,
  CAI_T20M,
  CAI_T21M,
  CAI_T30M,
  CAI_T31M,
  CAI_T40M,
  CAI_T41M,
  CAI_T42M,
  CAI_T50M,
  CAI_T51M,
  CAI_T52M,
  CAI_T53M,
  CAI_T55M,
  CAI_T57M,
  CAI_T69M,
  CAI_T72M,
  CAI_N1M,
  CAI_N2M,
  CAI_N3M,
  CAI_N5M,
  CAI_N6M,
  CAI_N7M,
  CAI_N8M,
  CAI_N9M,
  CAI_N10M,
  CAI_N11M
 ,CAI_N13M
};


/*-   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -*/
/*                       MACROS                                            */
/*-   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -*/
/* Suppress the following lint messages:
   e413: Likely use of null pointer in left argument to operator '->',
         which is heavily used in FPOS and FSIZ macros.
   e734:
   e713: Loss of precision (assignment).
   e737: Loss of sign in promotion from int to unsigned int.
   e534: Ignoring the return value of a function.
   e550: Variable not accessed
   e715: Not referenced
   e573: Signed-unsigned mix with divide
   e574:
   e740: Unusual pointer cast (incompatible indirect types)
  */

/*lint -e413 -e734 -e713 -e737 -e534 -e550 -e715 -e573 -e574 -e740*/

/* Macro to determine the number of variable parts in a message given
   the message length */
#define NUM_VAR(len,x ) \
  ((len - sizeof( x##_fix_type )) / sizeof( x##_var_type ))

/* Macro to build parameters for use in b_unpack and b_pack routines while
   packing and unpacking messages other than Paging Channel orders */
#define PARAMS( field ) \
  buf_ptr, FPOS( MTYPE, field ), FSIZ( MTYPE, field )

/* Macro to compute the offset, in bytes, of the end of a specified field
   of a specified structure type */
#define FENDPOS( type, field ) \
  (FPOS( type, field ) + FSIZ( type, field ))

/* Macro to build parameters for packing and unpacking
   information record headers. */
#define  REC_P( field ) \
  buf_ptr, buf_pos + FPOS( cai_rec_hdr_type, field ), \
  FSIZ( cai_rec_hdr_type, field )

/* Macro to build parameters for packing and unpacking
   service configuration header records. */
#define  HDR_P( field ) \
  buf_ptr, buf_pos + FPOS( cai_srv_cfg_hdr_type, field ), \
  FSIZ( cai_srv_cfg_hdr_type, field )

/* Macro to build parameters for packing and unpacking
   service configuration connection records. */
#define  CON_P( field ) \
  buf_ptr, buf_pos + FPOS( cai_srv_cfg_con_type, field ), \
  FSIZ( cai_srv_cfg_con_type, field )

/* Macro to unpack a byte and advance the
   page position */
#define UNPACKB_PG(ext, type, field)                                \
  int_ptr->ext = b_unpackb(buf_ptr, ext_msg_pos, FSIZ(type, field));   \
  ext_msg_pos += FSIZ(type, field)

/* Macro to unpack a word and advance the
   page position */
#define UNPACKW_PG(ext, type, field)                                \
  int_ptr->ext = b_unpackw(buf_ptr, ext_msg_pos, FSIZ(type, field));   \
  ext_msg_pos += FSIZ(type, field)


/* Macro to unpack a dword and advance to
   page position */
#define UNPACKD_PG(ext, type, field)                                \
  int_ptr->ext = b_unpackd(buf_ptr, ext_msg_pos, FSIZ(type, field));   \
  ext_msg_pos += FSIZ(type, field)

/* Macro to unpack a byte to a destination
   and advance buffer position */
#define UNPACKB_BP(dest, type, field)                               \
  dest = b_unpackb(buf_ptr,buf_pos, FSIZ(type,field));              \
  buf_pos += FSIZ(type, field);

/* Macro to unpack a word to a destination
   and advance buffer position */
#define UNPACKW_BP(dest, type, field)                               \
  dest = b_unpackw(buf_ptr,buf_pos, FSIZ(type,field));              \
  buf_pos += FSIZ(type, field);

#define UNPACK_MSG_TYPE(dest, msg_type)                             \
  dest = msg_type & 0x3F;

#define UNPACK_PD(dest, msg_type)                                         \
  dest = ( (msg_type & 0xC0) >> 6 ) & 0x03;


/* Macro to unpack a byte and advance the dereferenced
   page position pointer */
#define UNPACKB_PG_DRF(ext, type, field)                            \
  int_ptr->ext = b_unpackb(buf_ptr, *ext_msg_pos, FSIZ(type, field));  \
  *ext_msg_pos += FSIZ(type, field)

/* Macro to unpack a word and advance the dereferenced
   page position pointer */
#define UNPACKW_PG_DRF(ext, type, field)                            \
  int_ptr->ext = b_unpackw(buf_ptr, *ext_msg_pos, FSIZ(type, field));  \
  *ext_msg_pos += FSIZ(type, field)

word xlate_int_non_neg_srv_cfg
(
  byte *buf_ptr,
    /* Pointer to message buffer which is to contain translated
       service configuration record. */

  word *buf_pos,
    /* Offset in message buffer at which to start non-neg service
       configuration record. */

  caii_non_neg_srv_cfg_type *i_ptr
    /* Pointer to internal non_neg service configuration record to be
       translated */
);

#ifdef FEATURE_IS2000_REL_A
#error code not present
#endif /* FEATURE_IS2000_REL_A  */


/* <EJECT> */
/*===========================================================================

FUNCTION XLATE_EXT_TC_HDR

DESCRIPTION
  This function translates a Traffic Channel Message header from external to
  internal format.

DEPENDENCIES
  None

RETURN VALUE
  None

SIDE EFFECTS
  None

===========================================================================*/

void xlate_ext_tc_hdr
(
  byte *buf_ptr,
    /* Pointer to received message to be translated */
  caii_tc_hdr_type *int_ptr
    /* Pointer to place where translated message should be placed */
)
{
    int_ptr->ack_seq = b_unpackb( buf_ptr,
                                  (word)FPOS( cai_gen_tc_type, hdr.ack_seq ),
                                  FSIZ( cai_gen_tc_type, hdr.ack_seq ));
    int_ptr->msg_seq = b_unpackb( buf_ptr,
                                  (word)FPOS( cai_gen_tc_type, hdr.msg_seq ),
                                  FSIZ( cai_gen_tc_type, hdr.msg_seq ));
    int_ptr->ack_req = b_unpackb( buf_ptr,
                                  (word)FPOS( cai_gen_tc_type, hdr.ack_req ),
                                  FSIZ( cai_gen_tc_type, hdr.ack_req ));
    int_ptr->encryption = b_unpackb( buf_ptr,
                                (word)FPOS( cai_gen_tc_type, hdr.encryption ),
                                     FSIZ( cai_gen_tc_type, hdr.encryption ));
} /* xlate_ext_tc_hdr() */

/* <EJECT> */
/*===========================================================================

FUNCTION XLATE_EXT_TC_ORD

DESCRIPTION
  This function translates a Traffic Channel Order Message from external to
  internal format.

DEPENDENCIES
  Assumes that the internal message type received as an input to the
  procedure already includes the Order message type.

RETURN VALUE
  Errors that were encountered while translating the message.

SIDE EFFECTS
  None

===========================================================================*/

word xlate_ext_tc_ord
(
  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;
    /* Status returned to calling procedure */
  word add_record_len;
    /* Used to store additional record length */
#ifdef FEATURE_IS2000_REL_A
#error code not present
#endif /* FEATURE_IS2000_REL_A */

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

  status = CAIX_DONE_S;
  /* -----------------------------------
  ** Define type for use in PARAMS macro
  ** ----------------------------------- */
  #define MTYPE cai_ftc_ord_type

  /* --------------------------------------------
  ** Determine if message is of sufficient length
  ** -------------------------------------------- */
  if (len < sizeof( cai_ftc_gen_ord_type )
#ifdef FEATURE_IS2000_REL_A
#error code not present
#endif
     )
  {
    status = CAIX_INV_LEN_S;
  }

  else {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -