📄 sl.c
字号:
/* * LMI_STATS_IND * ----------------------------------- * TODO: Statistics indications need to be provided in the implementation. */STATIC INLINE intlmi_stats_ind(queue_t *q, struct sl *sl, ulong interval, mblk_t *dp){ mblk_t *mp; lmi_stats_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PROTO; p = ((typeof(p)) mp->b_wptr)++; p->lmi_primitive = LMI_STATS_IND; p->lmi_interval = interval; p->lmi_timestamp = jiffies; mp->b_cont = dp; printd(("%s: %p: <- LMI_STATS_IND\n", MOD_NAME, sl)); putnext(sl->oq, mp); return (QR_DONE); } rare(); return (-ENOBUFS);}#endif#if 0/* * LMI_EVENT_IND * ----------------------------------- * TODO: Event indications need to be provided in the implementation. */STATIC INLINE intlmi_event_ind(queue_t *q, struct sl *sl, ulong oid, ulong level){ mblk_t *mp; lmi_event_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PROTO; p = ((typeof(p)) mp->b_wptr)++; p->lmi_primitive = LMI_EVENT_IND; p->lmi_objectid = oid; p->lmi_timestamp = jiffies; p->lmi_severity = level; printd(("%s: %p: <- LMI_EVENT_IND\n", MOD_NAME, sl)); putnext(sl->oq, mp); return (QR_DONE); } rare(); return (-ENOBUFS);}#endif#if 0/* * SL_PDU_IND * ----------------------------------- * We don't actually use SL_PDU_INDs, we pass along M_DATA messages. */STATIC INLINE intsl_pdu_ind(queue_t *q, struct sl *sl, mblk_t *dp){ mblk_t *mp; sl_pdu_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PROTO; p = ((typeof(p)) mp->b_wptr)++; p->sl_primitive = SL_PDU_IND; mp->b_cont = dp; printd(("%s: %p: <- SL_PDU_IND\n", MOD_NAME, sl)); putnext(sl->oq, mp); return (QR_ABSORBED); } rare(); return (-ENOBUFS);}#endif/* * SL_LINK_CONGESTED_IND * ----------------------------------- */STATIC INLINE intsl_link_congested_ind(queue_t *q, struct sl *sl, ulong cong, ulong disc){ mblk_t *mp; sl_link_cong_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PCPROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_LINK_CONGESTED_IND; p->sl_cong_status = cong; p->sl_disc_status = disc; printd(("%s: %p: <- SL_LINK_CONGESTED_IND\n", MOD_NAME, sl)); putnext(sl->oq, mp); return (QR_DONE); } rare(); return (-ENOBUFS);}/* * SL_LINK_CONGESTION_CEASED_IND * ----------------------------------- */STATIC INLINE intsl_link_congestion_ceased_ind(queue_t *q, struct sl *sl, ulong cong, ulong disc){ mblk_t *mp; sl_link_cong_ceased_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PCPROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_LINK_CONGESTION_CEASED_IND; p->sl_timestamp = jiffies; p->sl_cong_status = cong; p->sl_disc_status = disc; printd(("%s: %p: <- SL_LINK_CONGESTION_CEASED_IND\n", MOD_NAME, sl)); putnext(sl->oq, mp); return (QR_DONE); } rare(); return (-ENOBUFS);}/* * SL_RETRIEVED_MESSAGE_IND * ----------------------------------- */STATIC INLINE intsl_retrieved_message_ind(queue_t *q, struct sl *sl, mblk_t *dp){ mblk_t *mp; sl_retrieved_msg_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_RETRIEVED_MESSAGE_IND; mp->b_cont = dp; printd(("%s: %p: <- SL_RETRIEVED_MESSAGE_IND\n", MOD_NAME, sl)); putnext(sl->oq, mp); return (QR_DONE); } rare(); return (-ENOBUFS);}/* * SL_RETRIEVAL_COMPLETE_IND * ----------------------------------- */STATIC INLINE intsl_retrieval_complete_ind(queue_t *q, struct sl *sl){ mblk_t *mp; sl_retrieval_comp_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_RETRIEVAL_COMPLETE_IND; printd(("%s: %p: <- SL_RETRIEVAL_COMPLETE_IND\n", MOD_NAME, sl)); putnext(sl->oq, mp); return (QR_DONE); } rare(); return (-ENOBUFS);}/* * SL_RB_CLEARED_IND * ----------------------------------- */STATIC INLINE intsl_rb_cleared_ind(queue_t *q, struct sl *sl){ mblk_t *mp; sl_rb_cleared_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_RB_CLEARED_IND; printd(("%s: %p: <- SL_RB_CLEARED_IND\n", MOD_NAME, sl)); putnext(sl->oq, mp); return (QR_DONE); } rare(); return (-ENOBUFS);}/* * SL_BSNT_IND * ----------------------------------- */STATIC INLINE intsl_bsnt_ind(queue_t *q, struct sl *sl, ulong bsnt){ mblk_t *mp; sl_bsnt_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_BSNT_IND; p->sl_bsnt = bsnt; printd(("%s: %p: <- SL_BSNT_IND\n", MOD_NAME, sl)); putnext(sl->oq, mp); return (QR_DONE); } rare(); return (-ENOBUFS);}/* * SL_IN_SERVICE_IND * ----------------------------------- */STATIC INLINE intsl_in_service_ind(queue_t *q, struct sl *sl){ mblk_t *mp; sl_in_service_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_IN_SERVICE_IND; printd(("%s: %p: <- SL_IN_SERVICE_IND\n", MOD_NAME, sl)); putnext(sl->oq, mp); return (QR_DONE); } rare(); return (-ENOBUFS);}/* * SL_OUT_OF_SERVICE_IND * ----------------------------------- */STATIC INLINE intsl_out_of_service_ind(queue_t *q, struct sl *sl, ulong reason){ mblk_t *mp; sl_out_of_service_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PCPROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_OUT_OF_SERVICE_IND; p->sl_timestamp = jiffies; p->sl_reason = reason; printd(("%s: %p: <- SL_OUT_OF_SERVICE_IND\n", MOD_NAME, sl)); putnext(sl->oq, mp); return (QR_DONE); } rare(); return (-ENOBUFS);}/* * SL_REMOTE_PROCESSOR_OUTAGE_IND * ----------------------------------- */STATIC INLINE intsl_remote_processor_outage_ind(queue_t *q, struct sl *sl){ mblk_t *mp; sl_rem_proc_out_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PCPROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_REMOTE_PROCESSOR_OUTAGE_IND; p->sl_timestamp = jiffies; printd(("%s: %p: <- SL_REMOTE_PROCESSOR_OUTAGE_IND\n", MOD_NAME, sl)); putnext(sl->oq, mp); return (QR_DONE); } rare(); return (-ENOBUFS);}/* * SL_REMOTE_PROCESSOR_RECOVERED_IND * ----------------------------------- */STATIC INLINE intsl_remote_processor_recovered_ind(queue_t *q, struct sl *sl){ mblk_t *mp; sl_rem_proc_recovered_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PCPROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_REMOTE_PROCESSOR_RECOVERED_IND; p->sl_timestamp = jiffies; printd(("%s: %p: <- SL_REMOTE_PROCESSOR_RECOVERED_IND\n", MOD_NAME, sl)); putnext(sl->oq, mp); return (QR_DONE); } rare(); return (-ENOBUFS);}/* * SL_RTB_CLEARED_IND * ----------------------------------- */STATIC INLINE intsl_rtb_cleared_ind(queue_t *q, struct sl *sl){ mblk_t *mp; sl_rtb_cleared_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_RTB_CLEARED_IND; printd(("%s: %p: <- SL_RTB_CLEARED_IND\n", MOD_NAME, sl)); putnext(sl->oq, mp); return (QR_DONE); } rare(); return (-ENOBUFS);}#if 0/* * SL_RETRIEVAL_NOT_POSSIBLE_IND * ----------------------------------- * This primitive is not necessary in the current implementation. Retrieval * is always possible. */STATIC INLINE intsl_retrieval_not_possible_ind(queue_t *q, struct sl *sl){ mblk_t *mp; sl_retrieval_not_poss_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_RETRIEVAL_NOT_POSSIBLE_IND; printd(("%s: %p: <- SL_RETRIEVAL_NOT_POSSIBLE_IND\n", MOD_NAME, sl)); putnext(sl->oq, mp); return (QR_DONE); } rare(); return (-ENOBUFS);}/* * SL_BSNT_NOT_RETRIEVABLE_IND * ----------------------------------- * This primitive is not necessary in the current implementation. Retrieval * of BSNT is always possible. */STATIC INLINE intsl_bsnt_not_retrievable_ind(queue_t *q, struct sl *sl, ulong bsnt){ mblk_t *mp; sl_bsnt_not_retr_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_BSNT_NOT_RETRIEVABLE_IND; p->sl_bsnt = bsnt; printd(("%s: %p: <- SL_BSNT_NOT_RETRIEVABLE_IND\n", MOD_NAME, sl)); putnext(sl->oq, mp); return (QR_DONE); } rare(); return (-ENOBUFS);}#endif#if 0/* * SL_OPTMGMT_ACK * ----------------------------------- * Option management from the local management interface is not yet * implemented. */STATIC INLINE intsl_optmgmt_ack(queue_t *q, struct sl *sl, caddr_t opt_ptr, size_t opt_len, ulong flags){ mblk_t *mp; sl_optmgmt_ack_t *p; if ((mp = ss7_allocb(q, sizeof(*p) + opt_len, BPRI_MED))) { mp->b_datap->db_type = M_PCPROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_OPTMGMT_ACK; p->opt_length = opt_len; p->opt_offset = opt_len ? sizeof(*p) : 0; p->mgmt_flags = flags; bcopy(opt_ptr, mp->b_wptr, opt_len); mp->b_wptr += opt_len; printd(("%s: %p: <- SL_OPTMGMT_ACK\n", MOD_NAME, sl)); putnext(sl->oq, mp); return (QR_DONE); } rare(); return (-ENOBUFS);}#endif#if 0/* * SL_NOTIFY_IND * ----------------------------------- * TODO: Notification indications need to be included in the current * implementation. Notifications should be provided using LMI_EVENT_IND and * not SL_NOTIFY_IND ??? */STATIC INLINE intsl_notify_ind(queue_t *q, struct sl *sl, ulong oid, ulong level){ mblk_t *mp; sl_notify_ind_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PCPROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sl_primitive = SL_NOTIFY_IND; p->sl_objectid = oid; p->sl_timestamp = jiffies; p->sl_severity = level; printd(("%s: %p: <- SL_NOTIFY_IND\n", MOD_NAME, sl)); putnext(sl->oq, mp); return (QR_DONE); } rare(); return (-ENOBUFS);}#endif/* * ------------------------------------------------------------------------ * * Primitive sent downstream * * ------------------------------------------------------------------------ *//* * LMI_INFO_REQ * ----------------------------------- * Generates the initial information request to synchronize the SL with the * underlying SDT layer. This must be successful or the stream will be * rendered unusable. */STATIC INLINE intsdt_info_req(queue_t *q, struct sl *sl){ mblk_t *mp; lmi_info_req_t *p; if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->lmi_primitive = LMI_INFO_REQ; printd(("%s: %p: LMI_INFO_REQ ->\n", MOD_NAME, sl)); putnext(sl->iq, mp); return (QR_DONE); } rare(); return (-ENOBUFS);}#if 0/* * SDT_DAEDT_TRANSMISSION_REQ * ----------------------------------- * We don't use transmission requests, we pass just M_DATA blocks instead. */STATIC INLINE intsdt_daedt_transmission_req(queue_t *q, struct sl *sl, mblk_t *dp){ mblk_t *mp; sdt_daedt_transmission_req_t *p; ensure(dp, return (-EFAULT)); if ((mp = ss7_allocb(q, sizeof(*p), BPRI_MED))) { mp->b_datap->db_type = M_PROTO; p = (typeof(p)) mp->b_wptr; mp->b_wptr += sizeof(*p); p->sdt_primitive = SDT_DAEDT_TRANSMISSION_REQ; mp->b_cont = dp;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -