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/ua/ua_asp.h#ifndef __UA_ASP_H__ #define __UA_ASP_H__ #ident "@(#) $RCSfile: ua_asp.h,v $ $Name: $($Revision: 0.8.2.1 $) $Date: 2002/10/18 02:26:19 $" /* * ========================================================================= * * UA --> UA Common Messages * * ========================================================================= * These inlines are called by UA state machines to build messages to send to * their peers. */ /* * UA_MGMT_ERR * ------------------------------------------------------------------------- */ static inline mblk_t *ua_send_err(const uint ppi, uint ecode, caddr_t dia_ptr, size_t dia_len) { mblk_t *mp, *np; size_t mlen = UA_MHDR_SIZE + UA_SIZE(UA_PARM_ECODE) + dia_len ? UA_SIZE(UA_PARM_DIAG) + UA_PAD4(dia_len) : 0; if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = UA_MGMT_ERR; *((uint32_t *) mp->b_wptr)++ = htonl(mlen); *((uint32_t *) mp->b_wptr)++ = UA_PARM_ECODE; *((uint32_t *) mp->b_wptr)++ = htonl(ecode); if (dia_len) { *((uint32_t *) mp->b_wptr)++ = UA_PHDR(UA_PARM_DIAG, dia_len); bcopy(dia_ptr, mp->b_wptr, dia_len); mp->b_wptr += UA_PAD4(dia_len); } if ((np = n_exdata_req(0, ppi, 0, mp))) return (np); freeb(mp); } return (NULL); } /* * UA_MGMT_NTFY * ------------------------------------------------------------------------- */ static inline mblk_t *ua_send_ntfy(const uint ppi, uint status, uint * aspid, uint32_t * iid, size_t num_iid, uint32_t * rcs, size_t num_rcs, caddr_t inf_ptr, size_t inf_len) { mblk_t *mp, *np; size_t mlen = UA_MHDR_SIZE + UA_SIZE(UA_PARM_STATUS) + aspid ? UA_SIZE(UA_PARM_ASPID) : 0 + num_iid ? UA_PHDR_SIZE + num_iid * sizeof(uint32_t) : 0 + num_rcs ? UA_PHDR_SIZE + num_rcs * sizeof(uint32_t) : 0 + inf_len ? UA_PHDR_SIZE + UA_PAD4(inf_len) : 0; if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = UA_MGMT_NTFY; *((uint32_t *) mp->b_wptr)++ = htonl(mlen); *((uint32_t *) mp->b_wptr)++ = UA_PARM_STATUS; *((uint32_t *) mp->b_wptr)++ = htonl(status); if (aspid) *((uint32_t *) mp->b_wptr)++ = UA_PARM_ASPID; if (aspid) *((uint32_t *) mp->b_wptr)++ = htonl(*aspid); if (num_iid) *((uint32_t *) mp->b_wptr)++ = UA_PHDR(UA_PARM_RC, num_iid * sizeof(uint32_t)); while (num_iid--) *((uint32_t *) mp->b_wptr)++ = htonl(*iid++); if (num_rcs) *((uint32_t *) mp->b_wptr)++ = UA_PHDR(UA_PARM_RC, num_rcs * sizeof(uint32_t)); while (num_rcs--) *((uint32_t *) mp->b_wptr)++ = htonl(*rcs++); if (inf_len) { *((uint32_t *) mp->b_wptr)++ = UA_PHDR(UA_PARM_INFO, inf_len); bcopy(inf_ptr, mp->b_wptr, inf_len); mp->b_wptr += UA_PAD4(inf_len); } if ((np = n_exdata_req(0, ppi, 0, mp))) return (np); freeb(mp); } return (NULL); } /* * UA_ASPS_ASPUP_REQ * ------------------------------------------------------------------------- */ static inline mblk_t *ua_send_aspup_req(const uint ppi, uint aspid, caddr_t inf_ptr, size_t inf_len) { mblk_t *mp, *np; size_t mlen = UA_MHDR_SIZE + aspid ? UA_SIZE(UA_PARM_ASPID) : 0 + inf_len ? UA_PHDR_SIZE + UA_PAD4(inf_len) : 0; if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = UA_ASPS_ASPUP_REQ; *((uint32_t *) mp->b_wptr)++ = htonl(mlen); if (aspid) { *((uint32_t *) mp->b_wptr)++ = UA_PARM_ASPID; *((uint32_t *) mp->b_wptr)++ = htonl(aspid); } if (inf_len) { *((uint32_t *) mp->b_wptr)++ = UA_PHDR(UA_PARM_INFO, inf_len); bcopy(inf_ptr, mp->b_wptr, inf_len); mp->b_wptr += UA_PAD4(inf_len); } if ((np = n_exdata_req(0, ppi, 0, mp))) return (np); freeb(mp); } return (NULL); } /* * UA_ASPS_ASPDN_REQ * ------------------------------------------------------------------------- */ static inline mblk_t *ua_send_aspdn_req(const uint ppi, caddr_t inf_ptr, size_t inf_len) { mblk_t *mp, *np; size_t mlen = UA_MHDR_SIZE + inf_len ? UA_PHDR_SIZE + UA_PAD4(inf_len) : 0; if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = UA_ASPS_ASPDN_REQ; *((uint32_t *) mp->b_wptr)++ = htonl(mlen); if (inf_len) { *((uint32_t *) mp->b_wptr)++ = UA_PHDR(UA_PARM_INFO, inf_len); bcopy(inf_ptr, mp->b_wptr, inf_len); mp->b_wptr += UA_PAD4(inf_len); } if ((np = n_exdata_req(0, ppi, 0, mp))) return (np); freeb(mp); } return (NULL); } /* * UA_ASPS_HBEAT_REQ * ------------------------------------------------------------------------- */ static inline mblk_t *ua_send_beat_req(const uint ppi, caddr_t hbt_ptr, size_t hbt_len) { mblk_t *mp, *np; size_t mlen = UA_MHDR_SIZE + hbt_len ? UA_PHDR_SIZE + UA_PAD4(hbt_len) : 0; if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = UA_ASPS_HBEAT_REQ; *((uint32_t *) mp->b_wptr)++ = htonl(mlen); if (hbt_len) { *((uint32_t *) mp->b_wptr)++ = UA_PHDR(UA_PARM_HBDATA, hbt_len); bcopy(hbt_ptr, mp->b_wptr, hbt_len); mp->b_wptr += UA_PAD4(hbt_len); } if ((np = n_exdata_req(0, ppi, 0, mp))) return (np); freeb(mp); } return (NULL); } /* * UA_ASPS_ASPUP_ACK * ------------------------------------------------------------------------- */ static inline mblk_t *ua_send_aspup_ack(const uint ppi, uint aspid, caddr_t inf_ptr, size_t inf_len) { mblk_t *mp, *np; size_t mlen = UA_MHDR_SIZE + aspid ? UA_SIZE(UA_PARM_ASPID) : 0 + inf_len ? UA_PHDR_SIZE + UA_PAD4(inf_len) : 0; if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = UA_ASPS_ASPUP_ACK; *((uint32_t *) mp->b_wptr)++ = htonl(mlen); if (aspid) { *((uint32_t *) mp->b_wptr)++ = UA_PARM_ASPID; *((uint32_t *) mp->b_wptr)++ = htonl(aspid); } if (inf_len) { *((uint32_t *) mp->b_wptr)++ = UA_PHDR(UA_PARM_INFO, inf_len); bcopy(inf_ptr, mp->b_wptr, inf_len); mp->b_wptr += UA_PAD4(inf_len); } if ((np = n_exdata_req(0, ppi, 0, mp))) return (np); freeb(mp); } return (NULL); } /* * UA_ASPS_ASPDN_ACK * ------------------------------------------------------------------------- */ static inline mblk_t *ua_send_aspdn_ack(const uint ppi, caddr_t inf_ptr, size_t inf_len) { mblk_t *mp, *np; size_t mlen = UA_MHDR_SIZE + inf_len ? UA_PHDR_SIZE + UA_PAD4(inf_len) : 0; if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = UA_ASPS_ASPDN_ACK; *((uint32_t *) mp->b_wptr)++ = htonl(mlen); if (inf_len) { *((uint32_t *) mp->b_wptr)++ = UA_PHDR(UA_PARM_INFO, inf_len); bcopy(inf_ptr, mp->b_wptr, inf_len); mp->b_wptr += UA_PAD4(inf_len); } if ((np = n_exdata_req(0, ppi, 0, mp))) return (np); freeb(mp); } return (NULL); } /* * UA_ASPS_HBEAT_ACK * ------------------------------------------------------------------------- */ static inline mblk_t *ua_send_beat_ack(const uint ppi, caddr_t hbt_ptr, size_t hbt_len) { mblk_t *mp, *np; size_t mlen = UA_MHDR_SIZE + hbt_len ? UA_PHDR_SIZE + UA_PAD4(hbt_len) : 0; if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = UA_ASPS_HBEAT_ACK; *((uint32_t *) mp->b_wptr)++ = htonl(mlen); if (hbt_len) { *((uint32_t *) mp->b_wptr)++ = UA_PHDR(UA_PARM_HBDATA, hbt_len); bcopy(hbt_ptr, mp->b_wptr, hbt_len); mp->b_wptr += UA_PAD4(hbt_len); } if ((np = n_exdata_req(0, ppi, 0, mp))) return (np); freeb(mp); } return (NULL); } /* * UA_ASPT_ASPAC_REQ * ------------------------------------------------------------------------- */ static inline mblk_t *ua_send_aspac_req(const uint ppi, uint tmode, uint32_t * iid, size_t num_iid, uint32_t * rcs, size_t num_rcs, caddr_t inf_ptr, size_t inf_len) { mblk_t *mp, *np; size_t mlen = UA_MHDR_SIZE + UA_SIZE(UA_PARM_TMODE) + num_iid ? UA_PHDR_SIZE + num_iid * sizeof(uint32_t) : 0 + num_rcs ? UA_PHDR_SIZE + num_rcs * sizeof(uint32_t) : 0 + inf_len ? UA_PHDR_SIZE + UA_PAD4(inf_len) : 0; if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = UA_ASPT_ASPAC_REQ; *((uint32_t *) mp->b_wptr)++ = htonl(mlen); *((uint32_t *) mp->b_wptr)++ = UA_PARM_TMODE; *((uint32_t *) mp->b_wptr)++ = htonl(tmode); if (num_iid) *((uint32_t *) mp->b_wptr)++ = UA_PHDR(UA_PARM_IID, num_iid * sizeof(uint32_t)); while (num_iid--) *((uint32_t *) mp->b_wptr)++ = htonl(*iid++); if (num_rcs) *((uint32_t *) mp->b_wptr)++ = UA_PHDR(UA_PARM_RC, num_rcs * sizeof(uint32_t)); while (num_rcs--) *((uint32_t *) mp->b_wptr)++ = htonl(*rcs++); if (inf_len) { *((uint32_t *) mp->b_wptr)++ = UA_PHDR(UA_PARM_INFO, inf_len); bcopy(inf_ptr, mp->b_wptr, inf_len); mp->b_wptr += UA_PAD4(inf_len); } if ((np = n_exdata_req(0, ppi, 0, mp))) return (np); freeb(mp); } return (NULL); } /* * UA_ASPT_ASPIA_REQ * ------------------------------------------------------------------------- */ static inline mblk_t *ua_send_aspia_req(const uint ppi, uint32_t * iid, size_t num_iid, uint32_t * rcs, size_t num_rcs, caddr_t inf_ptr, size_t inf_len) { mblk_t *mp, *np; size_t mlen = UA_MHDR_SIZE + num_iid ? UA_PHDR_SIZE + num_iid * sizeof(uint32_t) : 0 + num_rcs ? UA_PHDR_SIZE + num_rcs * sizeof(uint32_t) : 0 + inf_len ? UA_PHDR_SIZE + UA_PAD4(inf_len) : 0; if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = UA_ASPT_ASPIA_REQ; *((uint32_t *) mp->b_wptr)++ = htonl(mlen); if (num_iid) *((uint32_t *) mp->b_wptr)++ = UA_PHDR(UA_PARM_IID, num_iid * sizeof(uint32_t)); while (num_iid--) *((uint32_t *) mp->b_wptr)++ = htonl(*iid++); if (num_rcs) *((uint32_t *) mp->b_wptr)++ = UA_PHDR(UA_PARM_RC, num_rcs * sizeof(uint32_t)); while (num_rcs--) *((uint32_t *) mp->b_wptr)++ = htonl(*rcs++); if (inf_len) { *((uint32_t *) mp->b_wptr)++ = UA_PHDR(UA_PARM_INFO, inf_len); bcopy(inf_ptr, mp->b_wptr, inf_len); mp->b_wptr += UA_PAD4(inf_len); } if ((np = n_exdata_req(0, ppi, 0, mp))) return (np); freeb(mp); } return (NULL); } /* * UA_ASPT_ASPAC_ACK * ------------------------------------------------------------------------- * M2UA will have to use its own here, this is good enough for M3UA and SUA. */ static inline mblk_t *ua_send_aspac_ack(const uint ppi, uint tmode, uint32_t * iid, size_t num_iid, uint32_t * rcs, size_t num_rcs, caddr_t inf_ptr, size_t inf_len) { mblk_t *mp, *np; size_t mlen = UA_MHDR_SIZE + UA_SIZE(UA_PARM_TMODE) + num_iid ? UA_PHDR_SIZE + num_iid * sizeof(uint32_t) : 0 + num_rcs ? UA_PHDR_SIZE + num_rcs * sizeof(uint32_t) : 0 + inf_len ? UA_PHDR_SIZE + UA_PAD4(inf_len) : 0; if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = UA_ASPT_ASPAC_ACK; *((uint32_t *) mp->b_wptr)++ = htonl(mlen); *((uint32_t *) mp->b_wptr)++ = UA_PARM_TMODE; *((uint32_t *) mp->b_wptr)++ = htonl(tmode); if (num_iid) *((uint32_t *) mp->b_wptr)++ = UA_PHDR(UA_PARM_IID, num_iid * sizeof(uint32_t)); while (num_iid--) *((uint32_t *) mp->b_wptr)++ = htonl(*iid++); if (num_rcs) *((uint32_t *) mp->b_wptr)++ = UA_PHDR(UA_PARM_RC, num_rcs * sizeof(uint32_t)); while (num_rcs--) *((uint32_t *) mp->b_wptr)++ = htonl(*rcs++); if (inf_len) { *((uint32_t *) mp->b_wptr)++ = UA_PHDR(UA_PARM_INFO, inf_len); bcopy(inf_ptr, mp->b_wptr, inf_len); mp->b_wptr += UA_PAD4(inf_len); } if ((np = n_exdata_req(0, ppi, 0, mp))) return (np); freeb(mp); } return (NULL); } /* * UA_ASPT_ASPIA_ACK * ------------------------------------------------------------------------- */ static inline mblk_t *ua_send_aspia_ack(const uint ppi, uint32_t * iid, size_t num_iid, uint32_t * rcs, size_t num_rcs, caddr_t inf_ptr, size_t inf_len) { mblk_t *mp, *np; size_t mlen = UA_MHDR_SIZE + num_iid ? UA_PHDR_SIZE + num_iid * sizeof(uint32_t) : 0 + num_rcs ? UA_PHDR_SIZE + num_rcs * sizeof(uint32_t) : 0 + inf_len ? UA_PHDR_SIZE + UA_PAD4(inf_len) : 0; if ((mp = allocb(mlen, BPRI_MED))) { mp->b_datap->db_type = M_DATA; *((uint32_t *) mp->b_wptr)++ = UA_ASPT_ASPIA_ACK; *((uint32_t *) mp->b_wptr)++ = htonl(mlen); if (num_iid) *((uint32_t *) mp->b_wptr)++ = UA_PHDR(UA_PARM_IID, num_iid * sizeof(uint32_t)); while (num_iid--) *((uint32_t *) mp->b_wptr)++ = htonl(*iid++); if (num_rcs) *((uint32_t *) mp->b_wptr)++ = UA_PHDR(UA_PARM_RC, num_rcs * sizeof(uint32_t)); while (num_rcs--) *((uint32_t *) mp->b_wptr)++ = htonl(*rcs++); if (inf_len) { *((uint32_t *) mp->b_wptr)++ = UA_PHDR(UA_PARM_INFO, inf_len); bcopy(inf_ptr, mp->b_wptr, inf_len); mp->b_wptr += UA_PAD4(inf_len); } if ((np = n_exdata_req(0, ppi, 0, mp))) return (np); freeb(mp); } return (NULL); } #endif /* __UA_ASP_H__ */
|
|||||||||||||||||||||||||||
OpenSS7 SS7 for the Common Man |
Home | Overview | Status | News | Documentation | Resources | About | ||||||||||||||||||||
© Copyright 1997-2004,OpenSS7 Corporation, All Rights Reserved. |