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/m2ua/m2ua_asp.h#ifndef __M2UA_ASP_H__ #define __M2UA_ASP_H__ #ident "@(#) $RCSfile: m2ua_asp.h,v $ $Name: $($Revision: 0.8.2.1 $) $Date: 2002/10/18 03:28:38 $" #include "../ua/ua_asp.h" /* UA --> UA Common Messages */ #include "m2ua_msg.h" /* M2UA specific messages */ /* * ======================================================================= * * M2UA Peer Messages * * ======================================================================= * These inline functions build M2UA peer messages. */ /* * UA_RKMM_REG_REQ * ------------------------------------------------------------------------ */ static inline mblk_t *m2ua_reg_req(uint id, uint sdti, uint sdli) { mblk_t *mp, *np; static const size_t mlen = UA_MHDR_SIZE + UA_SIZE(M2UA_PARM_LINK_KEY); if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = UA_RKMM_REG_REQ; *((uint32_t *) mp->b_wptr)++ = __constant_htonl(mlen); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_LINK_KEY; *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_LOC_KEY_ID; *((uint32_t *) mp->b_wptr)++ = htonl(id); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_LOC_SDTI; *((uint32_t *) mp->b_wptr)++ = htonl(sdti); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_LOC_SDLI; *((uint32_t *) mp->b_wptr)++ = htonl(sdli); if ((np = n_exdata_req(0, N_QOS_PPI_M2UA, 0, mp))) return (np); freeb(mp); } return (NULL); } /* * UA_RKMM_REG_RSP * ------------------------------------------------------------------------ */ static inline mblk_t *m2ua_reg_rsp(uint id, uint status, uint iid) { mblk_t *mp, *np; static const size_t mlen = UA_MHDR_SIZE + UA_SIZE(M2UA_PARM_REG_RESULT); if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = UA_RKMM_REG_RSP; *((uint32_t *) mp->b_wptr)++ = __constant_htonl(mlen); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_REG_RESULT; *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_LOC_KEY_ID; *((uint32_t *) mp->b_wptr)++ = htonl(id); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_REG_STATUS; *((uint32_t *) mp->b_wptr)++ = htonl(status); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_IID; *((uint32_t *) mp->b_wptr)++ = status ? 0 : htonl(iid); if ((np = n_exdata_req(0, N_QOS_PPI_M2UA, 0, mp))) return (np); freeb(mp); } return (NULL); } /* * UA_RKMM_DEREG_REQ * ------------------------------------------------------------------------ */ static inline mblk_t *m2ua_dereg_req(uint iid) { mblk_t *mp, *np; static const size_t mlen = UA_MHDR_SIZE + UA_SIZE(M2UA_PARM_IID); if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = UA_RKMM_DEREG_REQ; *((uint32_t *) mp->b_wptr)++ = __constant_htonl(mlen); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_IID; *((uint32_t *) mp->b_wptr)++ = htonl(iid); if ((np = n_exdata_req(0, N_QOS_PPI_M2UA, 0, mp))) return (np); freeb(mp); } return (NULL); } /* * UA_RKMM_DEREG_RSP * ------------------------------------------------------------------------ */ static inline mblk_t *m2ua_dereg_rsp(uint iid, uint status) { mblk_t *mp, *np; static const size_t mlen = UA_MHDR_SIZE + UA_SIZE(M2UA_PARM_DEREG_STATUS); if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = UA_RKMM_DEREG_RSP; *((uint32_t *) mp->b_wptr)++ = __constant_htonl(mlen); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_DEREG_RESULT; *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_IID; *((uint32_t *) mp->b_wptr)++ = htonl(iid); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_DEREG_STATUS; *((uint32_t *) mp->b_wptr)++ = htonl(status); if ((np = n_exdata_req(0, N_QOS_PPI_M2UA, 0, mp))) return (np); freeb(mp); } return (NULL); } /* * M2UA_MAUP_DATA * ------------------------------------------------------------------------- * There are two forms of the M2UA_MAUP_DATA, one with M2UA_PARM_DATA1 for * normal data and one with M2UA_PARM_DATA2 for TTC data. */ static inline mblk_t *m2ua_data1(uint iid, mblk_t * db) { mblk_t *mp, *np; static const size_t mlen = UA_MHDR_SIZE + UA_SIZE(M2UA_PARM_IID) + UA_PHDR_SIZE; if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = M2UA_MAUP_DATA; *((uint32_t *) mp->b_wptr)++ = htonl(mlen + msgdsize(db)); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_IID; *((uint32_t *) mp->b_wptr)++ = htonl(iid); *((uint32_t *) mp->b_wptr)++ = M2UA_PHDR(M2UA_PARM_DATA1, dlen); mp->b_cont = db; if ((np = n_data_req(N_RC_FLAG, N_QOS_PPI_M2UA, iid, mp))) return (np); freeb(mp); } return (NULL); } static inline mblk_t *m2ua_data2(uint iid, mblk_t * dp) { mblk_t *mp, *np; static const size_t mlen = UA_MHDR_SIZE + UA_SIZE(M2UA_PARM_IID) + UA_PHDR_SIZE; if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = M2UA_MAUP_DATA; *((uint32_t *) mp->b_wptr)++ = htonl(mlen + msgsize(db)); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_IID; *((uint32_t *) mp->b_wptr)++ = htonl(iid); *((uint32_t *) mp->b_wptr)++ = M2UA_PHDR(M2UA_PARM_DATA2, dlen); mp->b_cont = db; if ((np = n_data_req(N_RC_FLAG, N_QOS_PPI_M2UA, iid, mp))) return (np); freeb(mp); } return (NULL); } /* * M2UA_MAUP_ESTAB_REQ * ------------------------------------------------------------------------- */ static inline mblk_t *m2ua_estab_req(uint iid) { mblk_t *mp, *np; static const size_t mlen = UA_MHDR_SIZE + UA_SIZE(M2UA_PARM_IID); if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = M2UA_MAUP_ESTAB_REQ; *((uint32_t *) mp->b_wptr)++ = __constant_htonl(mlen); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_IID; *((uint32_t *) mp->b_wptr)++ = htonl(iid); if ((np = n_data_req(0, N_QOS_PPI_M2UA, iid, mp))) return (np); freeb(mp); } return (NULL); } /* * M2UA_MAUP_ESTAB_CON * ------------------------------------------------------------------------- */ static inline mblk_t *m2ua_estab_con(uint iid) { mblk_t *mp, *np; static const size_t mlen = UA_MHDR_SIZE + UA_SIZE(M2UA_PARM_IID); if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = M2UA_MAUP_ESTAB_CON; *((uint32_t *) mp->b_wptr)++ = __constant_htonl(mlen); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_IID; *((uint32_t *) mp->b_wptr)++ = htonl(iid); if ((np = n_data_req(0, N_QOS_PPI_M2UA, iid, mp))) return (np); freeb(mp); } return (NULL); } /* * M2UA_MAUP_REL_REQ * ------------------------------------------------------------------------- */ static inline mblk_t *m2ua_rel_req(uint iid) { mblk_t *mp, *np; static const size_t mlen = UA_MHDR_SIZE + UA_SIZE(M2UA_PARM_IID); if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = M2UA_MAUP_REL_REQ; *((uint32_t *) mp->b_wptr)++ = __constant_htonl(mlen); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_IID; *((uint32_t *) mp->b_wptr)++ = htonl(iid); if ((np = n_data_req(0, N_QOS_PPI_M2UA, iid, mp))) return (np); freeb(mp); } return (NULL); } /* * M2UA_MAUP_REL_CON * ------------------------------------------------------------------------- */ static inline mblk_t *m2ua_rel_con(uint iid) { mblk_t *mp, *np; static const size_t mlen = UA_MHDR_SIZE + UA_SIZE(M2UA_PARM_IID); if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = M2UA_MAUP_REL_CON; *((uint32_t *) mp->b_wptr)++ = __constant_htonl(mlen); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_IID; *((uint32_t *) mp->b_wptr)++ = htonl(iid); if ((np = n_data_req(0, N_QOS_PPI_M2UA, iid, mp))) return (np); freeb(mp); } return (NULL); } /* * M2UA_MAUP_REL_IND * ------------------------------------------------------------------------- */ static inline mblk_t *m2ua_rel_ind(uint iid) { mblk_t *mp, *np; static const size_t mlen = UA_MHDR_SIZE + UA_SIZE(M2UA_PARM_IID); if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = M2UA_MAUP_REL_IND; *((uint32_t *) mp->b_wptr)++ = __constant_htonl(mlen); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_IID; *((uint32_t *) mp->b_wptr)++ = htonl(iid); if ((np = n_data_req(0, N_QOS_PPI_M2UA, iid, mp))) return (np); freeb(mp); } return (NULL); } /* * M2UA_MAUP_STATE_REQ * ------------------------------------------------------------------------- */ static inline mblk_t *m2ua_state_req(uint iid, uint state) { mblk_t *mp, *np; static const size_t mlen = UA_MHDR_SIZE + UA_SIZE(M2UA_PARM_IID) + UA_SIZE(M2UA_PARM_STATE_REQUEST); if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = M2UA_MAUP_STATE_REQ; *((uint32_t *) mp->b_wptr)++ = __constant_htonl(mlen); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_IID; *((uint32_t *) mp->b_wptr)++ = htonl(iid); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_STATE_REQUEST; *((uint32_t *) mp->b_wptr)++ = htonl(state); if ((np = n_data_req(0, N_QOS_PPI_M2UA, iid, mp))) return (np); freeb(mp); } return (NULL); } /* * M2UA_MAUP_STATE_CON * ------------------------------------------------------------------------- */ static inline mblk_t *m2ua_state_con(uint iid, uint status) { mblk_t *mp, *np; static const size_t mlen = UA_MHDR_SIZE + UA_SIZE(M2UA_PARM_IID) + UA_SIZE(M2UA_PARM_STATE_REQUEST); if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = M2UA_MAUP_STATE_CON; *((uint32_t *) mp->b_wptr)++ = __constant_htonl(mlen); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_IID; *((uint32_t *) mp->b_wptr)++ = htonl(iid); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_STATE_REQUEST; *((uint32_t *) mp->b_wptr)++ = htonl(status); if ((np = n_data_req(0, N_QOS_PPI_M2UA, iid, mp))) return (np); freeb(mp); } return (NULL); } /* * M2UA_MAUP_STATE_IND * ------------------------------------------------------------------------- */ static inline mblk_t *m2ua_state_ind(uint iid, uint event) { mblk_t *mp, *np; static const size_t mlen = UA_MHDR_SIZE + UA_SIZE(M2UA_PARM_IID) + UA_SIZE(M2UA_PARM_STATE_EVENT); if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = M2UA_MAUP_STATE_IND; *((uint32_t *) mp->b_wptr)++ = __constant_htonl(mlen); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_IID; *((uint32_t *) mp->b_wptr)++ = htonl(iid); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_STATE_EVENT; *((uint32_t *) mp->b_wptr)++ = htonl(event); if ((np = n_data_req(0, N_QOS_PPI_M2UA, iid, mp))) return (np); freeb(mp); } return (NULL); } /* * M2UA_MAUP_RETR_REQ * ------------------------------------------------------------------------- */ static inline mblk_t *m2ua_retr_req(uint iid, uint action, uint fsnc) { mblk_t *mp, *np; size_t mlen = UA_MHDR_SIZE + UA_SIZE(M2UA_PARM_IID) + UA_SIZE(M2UA_PARM_ACTION) + (action == M2UA_ACTION_RTRV_MSGS) ? UA_SIZE(M2UA_PARM_SEQNO) : 0; if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = M2UA_MAUP_RETR_REQ; *((uint32_t *) mp->b_wptr)++ = htonl(mlen); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_IID; *((uint32_t *) mp->b_wptr)++ = htonl(iid); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_ACTION; *((uint32_t *) mp->b_wptr)++ = htonl(action); if (action == M2UA_ACTION_RTRV_MSGS) { *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_SEQNO; *((uint32_t *) mp->b_wptr)++ = htnol(fsnc); } if ((np = n_data_req(0, N_QOS_PPI_M2UA, iid, mp))) return (np); freeb(mp); } return (NULL); } /* * M2UA_MAUP_RETR_CON * ------------------------------------------------------------------------- */ static inline mblk_t *m2ua_retr_con(uint iid, uint action, uint result) { mblk_t *mp, *np; static const size_t mlen = UA_MHDR_SIZE + UA_SIZE(M2UA_PARM_IID) + UA_SIZE(M2UA_PARM_ACTION) + UA_SIZE(M2UA_PARM_RETR_RESULT); if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = M2UA_MAUP_RETR_CON; *((uint32_t *) mp->b_wptr)++ = __constant_htonl(mlen); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_IID; *((uint32_t *) mp->b_wptr)++ = htonl(iid); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_ACTION; *((uint32_t *) mp->b_wptr)++ = htonl(action); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_RETR_RESULT; *((uint32_t *) mp->b_wptr)++ = htonl(result); if ((np = n_data_req(0, N_QOS_PPI_M2UA, iid, mp))) return (np); freeb(mp); } return (NULL); } /* * M2UA_MAUP_RETR_IND * ------------------------------------------------------------------------- * There are two retrieval indication functions, one for normal data and one * for TTC data. */ static inline mblk_t *m2ua_retr_ind1(uint iid, mblk_t * dp) { mblk_t *mp, *np; static const size_t mlen = UA_MHDR_SIZE + UA_SIZE(M2UA_PARM_IID) + UA_PHDR_SIZE; if ((mp = allocb(mlen, BPRI_MED))) { const size_t dlen = msgdsize(dp); mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = M2UA_MAUP_RETR_IND; *((uint32_t *) mp->b_wptr)++ = htonl(mlen + dlen); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_IID; *((uint32_t *) mp->b_wptr)++ = htonl(iid); *((uint32_t *) mp->b_wptr)++ = M2UA_PHDR(M2UA_PARM_DATA1, dlen); mp->b_cont = dp; if ((np = n_data_req(0, N_QOS_PPI_M2UA, iid, mp))) return (np); freeb(mp); } return (NULL); } static inline mblk_t *m2ua_retr_ind2(uint iid, mblk_t * dp) { mblk_t *mp, *np; static const size_t mlen = UA_MHDR_SIZE + UA_SIZE(M2UA_PARM_IID) + UA_PHDR_SIZE; if ((mp = allocb(mlen, BPRI_MED))) { const size_t dlen = msgdsize(dp); mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = M2UA_MAUP_RETR_IND; *((uint32_t *) mp->b_wptr)++ = htonl(mlen + dlen); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_IID; *((uint32_t *) mp->b_wptr)++ = htonl(iid); *((uint32_t *) mp->b_wptr)++ = M2UA_PHDR(M2UA_PARM_DATA2, dlen); mp->b_cont = dp; if ((np = n_data_req(0, N_QOS_PPI_M2UA, iid, mp))) return (np); freeb(mp); } return (NULL); } /* * M2UA_MAUP_RETR_COMP_IND * ------------------------------------------------------------------------- */ static inline mblk_t *m2ua_retr_comp_ind(uint iid, uint action, uint result) { mblk_t *mp, *np; static const size_t mlen = UA_MHDR_SIZE + UA_SIZE(M2UA_PARM_IID) + UA_SIZE(M2UA_PARM_ACTION) + UA_SIZE(M2UA_PARM_RETR_RESULT); if ((mp = allocb(mlen, BRPI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = M2UA_MAUP_RETR_COMP_IND; *((uint32_t *) mp->b_wptr)++ = __constant_htonl(mlen); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_IID; *((uint32_t *) mp->b_wptr)++ = htonl(iid); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_ACTION; *((uint32_t *) mp->b_wptr)++ = htonl(action); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_RETR_RESULT; *((uint32_t *) mp->b_wptr)++ = htonl(result); if ((np = n_data_req(0, N_QOS_PPI_M2UA, iid, mp))) return (np); freeb(mp); } return (NULL); } /* * M2UA_MAUP_CONG_IND * ------------------------------------------------------------------------- */ static inline mblk_t *m2ua_cong_ind(uint iid, uint cong_status, uint disc_status) { mblk_t *mp, *np; static const size_t mlen = UA_MHDR_SIZE + UA_SIZE(M2UA_PARM_IID) + UA_SIZE(M2UA_PARM_CONG_STATUS) + UA_SIZE(M2UA_PARM_DISC_STATUS); if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = M2UA_MAUP_CONG_IND; *((uint32_t *) mp->b_wptr)++ = __constant_htonl(mlen); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_IID; *((uint32_t *) mp->b_wptr)++ = htonl(iid); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_CONG_STATUS; *((uint32_t *) mp->b_wptr)++ = htonl(cong_status); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_DISC_STATUS; *((uint32_t *) mp->b_wptr)++ = htonl(disc_status); if ((np = n_data_req(0, N_QOS_PPI_M2UA, iid, mp))) return (np); freeb(mp); } return (NULL); } /* * M2UA_MAUP_DATA_ACK * ------------------------------------------------------------------------- */ static inline mblk_t *m2ua_data_ack(uint iid, uint coorid) { mblk_t *mp, *np; static const size_t mlen = UA_MHDR_SIZE + UA_SIZE(M2UA_PARM_IID) + UA_SIZE(M2UA_PARM_CORR_ID_ACK); if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = M2UA_MAUP_DATA_ACK; *((uint32_t *) mp->b_wptr)++ = __constant_htonl(mlen); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_IID; *((uint32_t *) mp->b_wptr)++ = htonl(iid); *((uint32_t *) mp->b_wptr)++ = M2UA_PARM_COOR_ID_ACK; *((uint32_t *) mp->b_wptr)++ = htonl(coorid); if ((np = n_exdata_req(0, N_QOS_PPI_M2UA, iid, mp))) return (np); freeb(mp); } return (NULL); } #endif /* __M2UA_ASP_H__ */
|
|||||||||||||||||||||||||||
OpenSS7 SS7 for the Common Man |
Home | Overview | Status | News | Documentation | Resources | About | ||||||||||||||||||||
© Copyright 1997-2004,OpenSS7 Corporation, All Rights Reserved. |