OpenSS7 SS7 for the Common Man |
© Copyright 1997-2004,OpenSS7 Corporation, All Rights Reserved. |
||||||||||||||||||||||||||
Home | Overview | Status | News | Documentation | Resources | About | |||||||||||||||||||||
File /code/strss7/drivers/sscop/sscop_n_user.c#ident "@(#) $RCSfile: sscop_n_user.c,v $ $Name: $($Revision: 0.8.2.1 $) $Date: 2002/10/18 02:37:53 $" static char const ident[] = "$RCSfile: sscop_n_user.c,v $ $Name: $($Revision: 0.8.2.1 $) $Date: 2002/10/18 02:37:53 $"; /* * ========================================================================= * * SSCOP T-Provider --> N-Provider (IP) Primitives (M_CTL, M_PROTO, M_PCPROTO) * * ========================================================================= * * These functions package up the necessary primitive format given the * input parameters necessary to create them. They are all inlined and * return NULL if a message block could not be allocated. */ /* * N_INFO_REQ * ------------------------------------------------------------------------- */ static inline mblk_t *n_info_req(void) { mblk_t *mp; N_info_req_t *p; if ((mp = allocb(sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PCPROTO; p = (N_info_req_t *) mp->b_wptr; p->PRIM_type = N_INFO_REQ; mp->b_wptr += sizeof(*p); } return (mp); } /* * N_OPTMGMT_REQ * ------------------------------------------------------------------------- * There isn't much point in this for IP except to set the TOS bits in the IP * header and to indicate whether to set the DF bit to frag or not. Also, * default IP options could be set here. */ static inline mblk_t *n_optmgmt_req(caddr_t qos_ptr, size_t qos_len, uint flags) { mblk_t *mp; N_optmgmt_req_t *p; if ((mp = allocb(sizeof(*p) + qos_len, BPRI_MED))) { mp->b_datap->db_type = M_PCPROTO; p = (N_optmgmt_req_t *) mp->b_wptr; p->PRIM_type = N_OPTMGMT_REQ; p->QOS_length = qos_len; p->QOS_offset = qos_len ? sizeof(*p) : 0; p->OPTMGMT_flags = flags; mp->b_wptr += sizeof(*p); bcopy(qos_ptr, mp->b_wptr, qos_len); mp->b_wptr += qos_len; } return (mp); } /* * N_BIND_REQ * ------------------------------------------------------------------------- * For IP for SSCOP we use this to bind the stream to the Protocol ID which is * to be used for SSCOP (132). The network layer will then pass messages up * to the SSCOP. */ static inline mblk_t *n_bind_req(void) static inline mblk_t *n_bind_req(caddr_t add_ptr, size_t add_len, int cons, uint flags, caddr_t pro_ptr, size_t pro_len) { mblk_t *mp; N_bind_req_t *p; if ((mp = allocb(sizeof(*p) + add_len + pro_len, BPRI_MED))) { mp->b_datap->db_type = M_PCPROTO; p = (N_bind_req_t *) mp->b_wptr; p->PRIM_type = N_BIND_REQ; p->ADDR_length = 0; p->ADDR_offset = 0; p->CONIND_number = 0; p->BIND_flags = flags; p->PROTOID_length = pro_len; p->PROTOID_offset = pro_len ? sizeof(*p) + add_len : 0; /* might pad */ mp->b_wptr += sizeof(*p); bcopy(add_ptr, mp->b_wptr, add_len); mp->b_wptr += add_len; bcopy(pro_ptr, mp->b_wptr, pro_len); mp->b_wptr += pro_len; } return (mp); } /* * N_UNBIND_REQ * ------------------------------------------------------------------------- */ static inline mblk_t *n_unbind_req(void) { mblk_t *mp; N_unbind_req_t *p; if ((mp = allocb(sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PCPROTO; p = (N_unbind_req_t *) mp->b_wptr; p->PRIM_type = N_UNBIND_REQ; mp->b_wptr += sizeof(*p); } return (mp); } /* * N_CONN_REQ * ------------------------------------------------------------------------- */ static inline mblk_t *n_conn_req(caddr_t dst_ptr, size_t dst_len, uint flags, caddr_t qos_ptr, size_t qos_len) { mblk_t *mp; N_conn_req_t *p; if ((mp = allocb(sizeof(*p) + dst_len + qos_len, BPRI_MED))) { mp->b_datap->db_type = M_PCPROTO; p = (N_conn_req_t *) mp->b_wptr; p->PRIM_type = N_CONN_REQ; p->DEST_length = dst_len; p->DEST_offset = dst_len ? sizeof(*p) : 0; p->CONN_flags = flags; p->QOS_length = qos_len; p->QOS_offset = qos_len ? sizeof(*p) + dst_len : 0; /* might pad */ mp->b_wptr += sizeof(*p); bcopy(dst_ptr, mp->b_wptr, dst_len); mp->b_wptr += dst_len; bcopy(qos_ptr, mp->b_wptr, qos_len); mp->b_wptr += qos_len; } return (mp); } /* * N_CONN_RES * ------------------------------------------------------------------------- */ static inline mblk_t *n_conn_res(queue_t * q, caddr_t res_ptr, size_t res_len, uint flags, caddr_t qos_ptr, size_t qos_len) { mblk_t *mp; N_conn_res_t *p; if ((mp = allocb(sizeof(*p) + res_len + qos_len, BPRI_MED))) { mp->b_datap->db_type = M_PCPROTO; p = (N_conn_res_t *) mp->b_wptr; p->PRIM_type = N_CONN_RES; p->TOKEN_value = q; p->RES_length = res_len; p->RES_offset = res_len ? sizeof(*p) : 0; p->CONN_flags = flags; p->QOS_length = qos_len; p->QOS_offset = qos_len ? sizeof(*p) : 0; mp->b_wptr += sizeof(*p); bcopy(res_ptr, mp->b_wptr, res_len); mp->b_wptr += res_len; bcopy(qos_ptr, mp->b_wptr, qos_len); mp->b_wptr += qos_len; } return (mp); } /* * N_DATA_REQ * ------------------------------------------------------------------------- */ static inline mblk_t *n_data_req(uint flags) { mblk_t *mp; N_data_req_t *p; if ((mp = allocb(sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PCPROTO; p = (N_data_req_t *) mp->b_wptr; p->PRIM_type = N_DATA_REQ; p->DATA_xfer_flags = flags; mp->b_wptr += sizeof(*p); } return (mp); } /* * N_DATACK_REQ * ------------------------------------------------------------------------- */ static inline mblk_t *n_datack_req(void) { mblk_t *mp; N_datack_req_t *p; if ((mp = allocb(sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PCPROTO; p = (N_datack_req_t *) mp->b_wptr; p->PRIM_type = N_DATACK_REQ; mp->b_wptr += sizeof(*p); } return (mp); } /* * N_EXDATA_REQ * ------------------------------------------------------------------------- */ static inline mblk_t *n_exdata_req(void) { mblk_t *mp; N_exdata_req_t *p; if ((mp = allocb(sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PCPROTO; p = (N_exdata_req_t *) mp->b_wptr; p->PRIM_type = N_EXDATA_REQ; mp->b_wptr += sizeof(*p); } return (mp); } /* * N_RESET_REQ * ------------------------------------------------------------------------- */ static inline mblk_t *n_reset_req(int reason) { mblk_t *mp; N_reset_req_t *p; if ((mp = allocb(sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PCPROTO; p = (N_reset_req_t *) mp->b_wptr; p->PRIM_type = N_RESET_REQ; p->RESET_reason = reason; mp->b_wptr += sizeof(*p); } return (mp); } /* * N_RESET_CON * ------------------------------------------------------------------------- */ static inline mblk_t *n_reset_con(void) { mblk_t *mp; N_reset_con_t *p; if ((mp = allocb(sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PCPROTO; p = (N_reset_con_t *) mp->b_wptr; p->PRIM_type = N_RESET_CON; mp->b_wptr += sizeof(*p); } return (mp); } /* * N_DISCON_REQ * ------------------------------------------------------------------------- */ static inline mblk_t *n_discon_req(int reason, caddr_t res_ptr, size_t res_len, uint seq) { mblk_t *mp; N_discon_req_t *p; if ((mp = allocb(sizeof(*p) + res_len, BPRI_MED))) { mp->b_datap->db_type = M_PCPROTO; p = (N_discon_req_t *) mp->b_wptr; p->PRIM_type = N_DISCON_REQ; p->DISCON_reason = reason; p->RES_length = res_len; p->RES_offset = res_len ? sizeof(*p) : 0; p->SEQ_number = seq; mp->b_wptr += sizeof(*p); bcopy(res_ptr, mp->b_wptr, res_len); mp->b_wptr += res_len; } return (mp); } /* * N_UNITDATA_REQ * ------------------------------------------------------------------------- */ static inline mblk_t *n_unitdata_req(caddr_t dst_ptr, size_t dst_len) { mblk_t *mp; N_unitdata_req_t *p; if ((mp = allocb(sizeof(*p) + dst_len, BPRI_MED))) { mp->b_datap->db_type = M_PCPROTO; p = (N_unitdata_req_t *) mp->b_wptr; p->PRIM_type = N_DISCON_REQ; p->DEST_length = dst_len; p->DEST_offset = dst_len ? sizeof(*p) : 0; p->RESERVED_field[0] = 0; p->RESERVED_field[1] = 0; mp->b_wptr += sizeof(*p); bcopy(dst_ptr, mp->b_wptr, dst_len); mp->b_wptr += dst_len; } return (mp); }
|
|||||||||||||||||||||||||||
OpenSS7 SS7 for the Common Man |
Home | Overview | Status | News | Documentation | Resources | About | ||||||||||||||||||||
© Copyright 1997-2004,OpenSS7 Corporation, All Rights Reserved. |