From 664e0b71ab3fed96bbfa74f61aef9bf8749a643f Mon Sep 17 00:00:00 2001 From: harti Date: Mon, 3 Nov 2003 09:11:53 +0000 Subject: These files are generated by the genfiles script. See FREEBSD-upgrade for instructions how to upgrade these. --- sys/contrib/ngatm/netnatm/msg/uni_ie.h | 57 + sys/contrib/ngatm/netnatm/msg/uni_ietab.h | 958 ++++++ sys/contrib/ngatm/netnatm/msg/uni_msg.c | 4901 +++++++++++++++++++++++++++++ sys/contrib/ngatm/netnatm/msg/uni_msg.h | 342 ++ 4 files changed, 6258 insertions(+) create mode 100644 sys/contrib/ngatm/netnatm/msg/uni_ie.h create mode 100644 sys/contrib/ngatm/netnatm/msg/uni_ietab.h create mode 100644 sys/contrib/ngatm/netnatm/msg/uni_msg.c create mode 100644 sys/contrib/ngatm/netnatm/msg/uni_msg.h (limited to 'sys') diff --git a/sys/contrib/ngatm/netnatm/msg/uni_ie.h b/sys/contrib/ngatm/netnatm/msg/uni_ie.h new file mode 100644 index 0000000..f24c560 --- /dev/null +++ b/sys/contrib/ngatm/netnatm/msg/uni_ie.h @@ -0,0 +1,57 @@ +/* This file was created automatically + * Source file: $Begemot: libunimsg/atm/msg/ie.def,v 1.3 2003/09/19 11:58:15 hbb Exp $ + * $FreeBSD$ + */ + +#ifndef _NETNATM_MSG_UNI_IE_H_ +#define _NETNATM_MSG_UNI_IE_H_ + +union uni_ieall { + struct uni_iehdr h; + struct uni_ie_cause cause; + struct uni_ie_callstate callstate; + struct uni_ie_facility facility; + struct uni_ie_notify notify; + struct uni_ie_eetd eetd; + struct uni_ie_conned conned; + struct uni_ie_connedsub connedsub; + struct uni_ie_epref epref; + struct uni_ie_epstate epstate; + struct uni_ie_aal aal; + struct uni_ie_traffic traffic; + struct uni_ie_connid connid; + struct uni_ie_qos qos; + struct uni_ie_bhli bhli; + struct uni_ie_bearer bearer; + struct uni_ie_blli blli; + struct uni_ie_lshift lshift; + struct uni_ie_nlshift nlshift; + struct uni_ie_scompl scompl; + struct uni_ie_repeat repeat; + struct uni_ie_calling calling; + struct uni_ie_callingsub callingsub; + struct uni_ie_called called; + struct uni_ie_calledsub calledsub; + struct uni_ie_tns tns; + struct uni_ie_restart restart; + struct uni_ie_uu uu; + struct uni_ie_git git; + struct uni_ie_mintraffic mintraffic; + struct uni_ie_atraffic atraffic; + struct uni_ie_abrsetup abrsetup; + struct uni_ie_report report; + struct uni_ie_called_soft called_soft; + struct uni_ie_crankback crankback; + struct uni_ie_dtl dtl; + struct uni_ie_calling_soft calling_soft; + struct uni_ie_abradd abradd; + struct uni_ie_lij_callid lij_callid; + struct uni_ie_lij_param lij_param; + struct uni_ie_lij_seqno lij_seqno; + struct uni_ie_cscope cscope; + struct uni_ie_exqos exqos; + struct uni_ie_mdcr mdcr; + struct uni_ie_unrec unrec; +}; + +#endif diff --git a/sys/contrib/ngatm/netnatm/msg/uni_ietab.h b/sys/contrib/ngatm/netnatm/msg/uni_ietab.h new file mode 100644 index 0000000..62cba33 --- /dev/null +++ b/sys/contrib/ngatm/netnatm/msg/uni_ietab.h @@ -0,0 +1,958 @@ +/* This file was created automatically + * Source file: $Begemot: libunimsg/atm/msg/ie.def,v 1.3 2003/09/19 11:58:15 hbb Exp $ + * $FreeBSD$ + */ + + +static void uni_ie_print_itu_cause(struct uni_ie_cause *, struct unicx *); +static int uni_ie_check_itu_cause(struct uni_ie_cause *, struct unicx *); +static int uni_ie_encode_itu_cause(struct uni_msg *, struct uni_ie_cause *, struct unicx *); +static int uni_ie_decode_itu_cause(struct uni_ie_cause *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_cause = { + 0, + 34, + (uni_print_f)uni_ie_print_itu_cause, + (uni_check_f)uni_ie_check_itu_cause, + (uni_encode_f)uni_ie_encode_itu_cause, + (uni_decode_f)uni_ie_decode_itu_cause +}; + +static void uni_ie_print_net_cause(struct uni_ie_cause *, struct unicx *); +static int uni_ie_check_net_cause(struct uni_ie_cause *, struct unicx *); +static int uni_ie_encode_net_cause(struct uni_msg *, struct uni_ie_cause *, struct unicx *); +static int uni_ie_decode_net_cause(struct uni_ie_cause *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_net_cause = { + 0, + 34, + (uni_print_f)uni_ie_print_net_cause, + (uni_check_f)uni_ie_check_net_cause, + (uni_encode_f)uni_ie_encode_net_cause, + (uni_decode_f)uni_ie_decode_net_cause +}; + +static void uni_ie_print_itu_callstate(struct uni_ie_callstate *, struct unicx *); +static int uni_ie_check_itu_callstate(struct uni_ie_callstate *, struct unicx *); +static int uni_ie_encode_itu_callstate(struct uni_msg *, struct uni_ie_callstate *, struct unicx *); +static int uni_ie_decode_itu_callstate(struct uni_ie_callstate *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_callstate = { + 0, + 5, + (uni_print_f)uni_ie_print_itu_callstate, + (uni_check_f)uni_ie_check_itu_callstate, + (uni_encode_f)uni_ie_encode_itu_callstate, + (uni_decode_f)uni_ie_decode_itu_callstate +}; + +static void uni_ie_print_itu_facility(struct uni_ie_facility *, struct unicx *); +static int uni_ie_check_itu_facility(struct uni_ie_facility *, struct unicx *); +static int uni_ie_encode_itu_facility(struct uni_msg *, struct uni_ie_facility *, struct unicx *); +static int uni_ie_decode_itu_facility(struct uni_ie_facility *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_facility = { + 0, + UNI_FACILITY_MAXAPDU+1+4, + (uni_print_f)uni_ie_print_itu_facility, + (uni_check_f)uni_ie_check_itu_facility, + (uni_encode_f)uni_ie_encode_itu_facility, + (uni_decode_f)uni_ie_decode_itu_facility +}; + +static void uni_ie_print_itu_notify(struct uni_ie_notify *, struct unicx *); +static int uni_ie_check_itu_notify(struct uni_ie_notify *, struct unicx *); +static int uni_ie_encode_itu_notify(struct uni_msg *, struct uni_ie_notify *, struct unicx *); +static int uni_ie_decode_itu_notify(struct uni_ie_notify *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_notify = { + 0, + UNI_NOTIFY_MAXLEN+4, + (uni_print_f)uni_ie_print_itu_notify, + (uni_check_f)uni_ie_check_itu_notify, + (uni_encode_f)uni_ie_encode_itu_notify, + (uni_decode_f)uni_ie_decode_itu_notify +}; + +static void uni_ie_print_itu_eetd(struct uni_ie_eetd *, struct unicx *); +static int uni_ie_check_itu_eetd(struct uni_ie_eetd *, struct unicx *); +static int uni_ie_encode_itu_eetd(struct uni_msg *, struct uni_ie_eetd *, struct unicx *); +static int uni_ie_decode_itu_eetd(struct uni_ie_eetd *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_eetd = { + 0, + 11, + (uni_print_f)uni_ie_print_itu_eetd, + (uni_check_f)uni_ie_check_itu_eetd, + (uni_encode_f)uni_ie_encode_itu_eetd, + (uni_decode_f)uni_ie_decode_itu_eetd +}; + +static void uni_ie_print_net_eetd(struct uni_ie_eetd *, struct unicx *); +static int uni_ie_check_net_eetd(struct uni_ie_eetd *, struct unicx *); +static int uni_ie_encode_net_eetd(struct uni_msg *, struct uni_ie_eetd *, struct unicx *); +static int uni_ie_decode_net_eetd(struct uni_ie_eetd *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_net_eetd = { + 0, + 13, + (uni_print_f)uni_ie_print_net_eetd, + (uni_check_f)uni_ie_check_net_eetd, + (uni_encode_f)uni_ie_encode_net_eetd, + (uni_decode_f)uni_ie_decode_net_eetd +}; + +static void uni_ie_print_itu_conned(struct uni_ie_conned *, struct unicx *); +static int uni_ie_check_itu_conned(struct uni_ie_conned *, struct unicx *); +static int uni_ie_encode_itu_conned(struct uni_msg *, struct uni_ie_conned *, struct unicx *); +static int uni_ie_decode_itu_conned(struct uni_ie_conned *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_conned = { + 0, + 25, + (uni_print_f)uni_ie_print_itu_conned, + (uni_check_f)uni_ie_check_itu_conned, + (uni_encode_f)uni_ie_encode_itu_conned, + (uni_decode_f)uni_ie_decode_itu_conned +}; + +static void uni_ie_print_itu_connedsub(struct uni_ie_connedsub *, struct unicx *); +static int uni_ie_check_itu_connedsub(struct uni_ie_connedsub *, struct unicx *); +static int uni_ie_encode_itu_connedsub(struct uni_msg *, struct uni_ie_connedsub *, struct unicx *); +static int uni_ie_decode_itu_connedsub(struct uni_ie_connedsub *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_connedsub = { + UNIFL_ACCESS, + 25, + (uni_print_f)uni_ie_print_itu_connedsub, + (uni_check_f)uni_ie_check_itu_connedsub, + (uni_encode_f)uni_ie_encode_itu_connedsub, + (uni_decode_f)uni_ie_decode_itu_connedsub +}; + +static void uni_ie_print_itu_epref(struct uni_ie_epref *, struct unicx *); +static int uni_ie_check_itu_epref(struct uni_ie_epref *, struct unicx *); +static int uni_ie_encode_itu_epref(struct uni_msg *, struct uni_ie_epref *, struct unicx *); +static int uni_ie_decode_itu_epref(struct uni_ie_epref *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_epref = { + 0, + 7, + (uni_print_f)uni_ie_print_itu_epref, + (uni_check_f)uni_ie_check_itu_epref, + (uni_encode_f)uni_ie_encode_itu_epref, + (uni_decode_f)uni_ie_decode_itu_epref +}; + +static void uni_ie_print_itu_epstate(struct uni_ie_epstate *, struct unicx *); +static int uni_ie_check_itu_epstate(struct uni_ie_epstate *, struct unicx *); +static int uni_ie_encode_itu_epstate(struct uni_msg *, struct uni_ie_epstate *, struct unicx *); +static int uni_ie_decode_itu_epstate(struct uni_ie_epstate *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_epstate = { + 0, + 5, + (uni_print_f)uni_ie_print_itu_epstate, + (uni_check_f)uni_ie_check_itu_epstate, + (uni_encode_f)uni_ie_encode_itu_epstate, + (uni_decode_f)uni_ie_decode_itu_epstate +}; + +static void uni_ie_print_itu_aal(struct uni_ie_aal *, struct unicx *); +static int uni_ie_check_itu_aal(struct uni_ie_aal *, struct unicx *); +static int uni_ie_encode_itu_aal(struct uni_msg *, struct uni_ie_aal *, struct unicx *); +static int uni_ie_decode_itu_aal(struct uni_ie_aal *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_aal = { + UNIFL_ACCESS, + 21, + (uni_print_f)uni_ie_print_itu_aal, + (uni_check_f)uni_ie_check_itu_aal, + (uni_encode_f)uni_ie_encode_itu_aal, + (uni_decode_f)uni_ie_decode_itu_aal +}; + +static void uni_ie_print_itu_traffic(struct uni_ie_traffic *, struct unicx *); +static int uni_ie_check_itu_traffic(struct uni_ie_traffic *, struct unicx *); +static int uni_ie_encode_itu_traffic(struct uni_msg *, struct uni_ie_traffic *, struct unicx *); +static int uni_ie_decode_itu_traffic(struct uni_ie_traffic *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_traffic = { + 0, + 30, + (uni_print_f)uni_ie_print_itu_traffic, + (uni_check_f)uni_ie_check_itu_traffic, + (uni_encode_f)uni_ie_encode_itu_traffic, + (uni_decode_f)uni_ie_decode_itu_traffic +}; + +static const struct iedecl decl_net_traffic = { + UNIFL_DEFAULT, + 0, + (uni_print_f)NULL, + (uni_check_f)NULL, + (uni_encode_f)NULL, + (uni_decode_f)NULL +}; + +static void uni_ie_print_itu_connid(struct uni_ie_connid *, struct unicx *); +static int uni_ie_check_itu_connid(struct uni_ie_connid *, struct unicx *); +static int uni_ie_encode_itu_connid(struct uni_msg *, struct uni_ie_connid *, struct unicx *); +static int uni_ie_decode_itu_connid(struct uni_ie_connid *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_connid = { + 0, + 9, + (uni_print_f)uni_ie_print_itu_connid, + (uni_check_f)uni_ie_check_itu_connid, + (uni_encode_f)uni_ie_encode_itu_connid, + (uni_decode_f)uni_ie_decode_itu_connid +}; + +static void uni_ie_print_itu_qos(struct uni_ie_qos *, struct unicx *); +static int uni_ie_check_itu_qos(struct uni_ie_qos *, struct unicx *); +static int uni_ie_encode_itu_qos(struct uni_msg *, struct uni_ie_qos *, struct unicx *); +static int uni_ie_decode_itu_qos(struct uni_ie_qos *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_qos = { + 0, + 6, + (uni_print_f)uni_ie_print_itu_qos, + (uni_check_f)uni_ie_check_itu_qos, + (uni_encode_f)uni_ie_encode_itu_qos, + (uni_decode_f)uni_ie_decode_itu_qos +}; + +static void uni_ie_print_net_qos(struct uni_ie_qos *, struct unicx *); +static int uni_ie_check_net_qos(struct uni_ie_qos *, struct unicx *); +static int uni_ie_encode_net_qos(struct uni_msg *, struct uni_ie_qos *, struct unicx *); +static int uni_ie_decode_net_qos(struct uni_ie_qos *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_net_qos = { + 0, + 6, + (uni_print_f)uni_ie_print_net_qos, + (uni_check_f)uni_ie_check_net_qos, + (uni_encode_f)uni_ie_encode_net_qos, + (uni_decode_f)uni_ie_decode_net_qos +}; + +static void uni_ie_print_itu_bhli(struct uni_ie_bhli *, struct unicx *); +static int uni_ie_check_itu_bhli(struct uni_ie_bhli *, struct unicx *); +static int uni_ie_encode_itu_bhli(struct uni_msg *, struct uni_ie_bhli *, struct unicx *); +static int uni_ie_decode_itu_bhli(struct uni_ie_bhli *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_bhli = { + UNIFL_ACCESS, + 13, + (uni_print_f)uni_ie_print_itu_bhli, + (uni_check_f)uni_ie_check_itu_bhli, + (uni_encode_f)uni_ie_encode_itu_bhli, + (uni_decode_f)uni_ie_decode_itu_bhli +}; + +static void uni_ie_print_itu_bearer(struct uni_ie_bearer *, struct unicx *); +static int uni_ie_check_itu_bearer(struct uni_ie_bearer *, struct unicx *); +static int uni_ie_encode_itu_bearer(struct uni_msg *, struct uni_ie_bearer *, struct unicx *); +static int uni_ie_decode_itu_bearer(struct uni_ie_bearer *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_bearer = { + 0, + 7, + (uni_print_f)uni_ie_print_itu_bearer, + (uni_check_f)uni_ie_check_itu_bearer, + (uni_encode_f)uni_ie_encode_itu_bearer, + (uni_decode_f)uni_ie_decode_itu_bearer +}; + +static void uni_ie_print_itu_blli(struct uni_ie_blli *, struct unicx *); +static int uni_ie_check_itu_blli(struct uni_ie_blli *, struct unicx *); +static int uni_ie_encode_itu_blli(struct uni_msg *, struct uni_ie_blli *, struct unicx *); +static int uni_ie_decode_itu_blli(struct uni_ie_blli *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_blli = { + UNIFL_ACCESS, + 17, + (uni_print_f)uni_ie_print_itu_blli, + (uni_check_f)uni_ie_check_itu_blli, + (uni_encode_f)uni_ie_encode_itu_blli, + (uni_decode_f)uni_ie_decode_itu_blli +}; + +static void uni_ie_print_itu_lshift(struct uni_ie_lshift *, struct unicx *); +static int uni_ie_check_itu_lshift(struct uni_ie_lshift *, struct unicx *); +static int uni_ie_encode_itu_lshift(struct uni_msg *, struct uni_ie_lshift *, struct unicx *); +static int uni_ie_decode_itu_lshift(struct uni_ie_lshift *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_lshift = { + 0, + 5, + (uni_print_f)uni_ie_print_itu_lshift, + (uni_check_f)uni_ie_check_itu_lshift, + (uni_encode_f)uni_ie_encode_itu_lshift, + (uni_decode_f)uni_ie_decode_itu_lshift +}; + +static void uni_ie_print_itu_nlshift(struct uni_ie_nlshift *, struct unicx *); +static int uni_ie_check_itu_nlshift(struct uni_ie_nlshift *, struct unicx *); +static int uni_ie_encode_itu_nlshift(struct uni_msg *, struct uni_ie_nlshift *, struct unicx *); +static int uni_ie_decode_itu_nlshift(struct uni_ie_nlshift *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_nlshift = { + 0, + 5, + (uni_print_f)uni_ie_print_itu_nlshift, + (uni_check_f)uni_ie_check_itu_nlshift, + (uni_encode_f)uni_ie_encode_itu_nlshift, + (uni_decode_f)uni_ie_decode_itu_nlshift +}; + +static void uni_ie_print_itu_scompl(struct uni_ie_scompl *, struct unicx *); +static int uni_ie_check_itu_scompl(struct uni_ie_scompl *, struct unicx *); +static int uni_ie_encode_itu_scompl(struct uni_msg *, struct uni_ie_scompl *, struct unicx *); +static int uni_ie_decode_itu_scompl(struct uni_ie_scompl *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_scompl = { + 0, + 5, + (uni_print_f)uni_ie_print_itu_scompl, + (uni_check_f)uni_ie_check_itu_scompl, + (uni_encode_f)uni_ie_encode_itu_scompl, + (uni_decode_f)uni_ie_decode_itu_scompl +}; + +static void uni_ie_print_itu_repeat(struct uni_ie_repeat *, struct unicx *); +static int uni_ie_check_itu_repeat(struct uni_ie_repeat *, struct unicx *); +static int uni_ie_encode_itu_repeat(struct uni_msg *, struct uni_ie_repeat *, struct unicx *); +static int uni_ie_decode_itu_repeat(struct uni_ie_repeat *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_repeat = { + 0, + 5, + (uni_print_f)uni_ie_print_itu_repeat, + (uni_check_f)uni_ie_check_itu_repeat, + (uni_encode_f)uni_ie_encode_itu_repeat, + (uni_decode_f)uni_ie_decode_itu_repeat +}; + +static void uni_ie_print_itu_calling(struct uni_ie_calling *, struct unicx *); +static int uni_ie_check_itu_calling(struct uni_ie_calling *, struct unicx *); +static int uni_ie_encode_itu_calling(struct uni_msg *, struct uni_ie_calling *, struct unicx *); +static int uni_ie_decode_itu_calling(struct uni_ie_calling *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_calling = { + 0, + 26, + (uni_print_f)uni_ie_print_itu_calling, + (uni_check_f)uni_ie_check_itu_calling, + (uni_encode_f)uni_ie_encode_itu_calling, + (uni_decode_f)uni_ie_decode_itu_calling +}; + +static void uni_ie_print_itu_callingsub(struct uni_ie_callingsub *, struct unicx *); +static int uni_ie_check_itu_callingsub(struct uni_ie_callingsub *, struct unicx *); +static int uni_ie_encode_itu_callingsub(struct uni_msg *, struct uni_ie_callingsub *, struct unicx *); +static int uni_ie_decode_itu_callingsub(struct uni_ie_callingsub *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_callingsub = { + UNIFL_ACCESS, + 25, + (uni_print_f)uni_ie_print_itu_callingsub, + (uni_check_f)uni_ie_check_itu_callingsub, + (uni_encode_f)uni_ie_encode_itu_callingsub, + (uni_decode_f)uni_ie_decode_itu_callingsub +}; + +static void uni_ie_print_itu_called(struct uni_ie_called *, struct unicx *); +static int uni_ie_check_itu_called(struct uni_ie_called *, struct unicx *); +static int uni_ie_encode_itu_called(struct uni_msg *, struct uni_ie_called *, struct unicx *); +static int uni_ie_decode_itu_called(struct uni_ie_called *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_called = { + 0, + 25, + (uni_print_f)uni_ie_print_itu_called, + (uni_check_f)uni_ie_check_itu_called, + (uni_encode_f)uni_ie_encode_itu_called, + (uni_decode_f)uni_ie_decode_itu_called +}; + +static void uni_ie_print_itu_calledsub(struct uni_ie_calledsub *, struct unicx *); +static int uni_ie_check_itu_calledsub(struct uni_ie_calledsub *, struct unicx *); +static int uni_ie_encode_itu_calledsub(struct uni_msg *, struct uni_ie_calledsub *, struct unicx *); +static int uni_ie_decode_itu_calledsub(struct uni_ie_calledsub *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_calledsub = { + UNIFL_ACCESS, + 25, + (uni_print_f)uni_ie_print_itu_calledsub, + (uni_check_f)uni_ie_check_itu_calledsub, + (uni_encode_f)uni_ie_encode_itu_calledsub, + (uni_decode_f)uni_ie_decode_itu_calledsub +}; + +static void uni_ie_print_itu_tns(struct uni_ie_tns *, struct unicx *); +static int uni_ie_check_itu_tns(struct uni_ie_tns *, struct unicx *); +static int uni_ie_encode_itu_tns(struct uni_msg *, struct uni_ie_tns *, struct unicx *); +static int uni_ie_decode_itu_tns(struct uni_ie_tns *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_tns = { + 0, + 9, + (uni_print_f)uni_ie_print_itu_tns, + (uni_check_f)uni_ie_check_itu_tns, + (uni_encode_f)uni_ie_encode_itu_tns, + (uni_decode_f)uni_ie_decode_itu_tns +}; + +static const struct iedecl decl_net_tns = { + UNIFL_DEFAULT, + 0, + (uni_print_f)NULL, + (uni_check_f)NULL, + (uni_encode_f)NULL, + (uni_decode_f)NULL +}; + +static void uni_ie_print_itu_restart(struct uni_ie_restart *, struct unicx *); +static int uni_ie_check_itu_restart(struct uni_ie_restart *, struct unicx *); +static int uni_ie_encode_itu_restart(struct uni_msg *, struct uni_ie_restart *, struct unicx *); +static int uni_ie_decode_itu_restart(struct uni_ie_restart *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_restart = { + 0, + 5, + (uni_print_f)uni_ie_print_itu_restart, + (uni_check_f)uni_ie_check_itu_restart, + (uni_encode_f)uni_ie_encode_itu_restart, + (uni_decode_f)uni_ie_decode_itu_restart +}; + +static void uni_ie_print_itu_uu(struct uni_ie_uu *, struct unicx *); +static int uni_ie_check_itu_uu(struct uni_ie_uu *, struct unicx *); +static int uni_ie_encode_itu_uu(struct uni_msg *, struct uni_ie_uu *, struct unicx *); +static int uni_ie_decode_itu_uu(struct uni_ie_uu *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_uu = { + UNIFL_ACCESS, + UNI_UU_MAXLEN+4, + (uni_print_f)uni_ie_print_itu_uu, + (uni_check_f)uni_ie_check_itu_uu, + (uni_encode_f)uni_ie_encode_itu_uu, + (uni_decode_f)uni_ie_decode_itu_uu +}; + +static void uni_ie_print_net_git(struct uni_ie_git *, struct unicx *); +static int uni_ie_check_net_git(struct uni_ie_git *, struct unicx *); +static int uni_ie_encode_net_git(struct uni_msg *, struct uni_ie_git *, struct unicx *); +static int uni_ie_decode_net_git(struct uni_ie_git *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_net_git = { + 0, + 33, + (uni_print_f)uni_ie_print_net_git, + (uni_check_f)uni_ie_check_net_git, + (uni_encode_f)uni_ie_encode_net_git, + (uni_decode_f)uni_ie_decode_net_git +}; + +static void uni_ie_print_itu_mintraffic(struct uni_ie_mintraffic *, struct unicx *); +static int uni_ie_check_itu_mintraffic(struct uni_ie_mintraffic *, struct unicx *); +static int uni_ie_encode_itu_mintraffic(struct uni_msg *, struct uni_ie_mintraffic *, struct unicx *); +static int uni_ie_decode_itu_mintraffic(struct uni_ie_mintraffic *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_mintraffic = { + 0, + 20, + (uni_print_f)uni_ie_print_itu_mintraffic, + (uni_check_f)uni_ie_check_itu_mintraffic, + (uni_encode_f)uni_ie_encode_itu_mintraffic, + (uni_decode_f)uni_ie_decode_itu_mintraffic +}; + +static const struct iedecl decl_net_mintraffic = { + UNIFL_DEFAULT, + 0, + (uni_print_f)NULL, + (uni_check_f)NULL, + (uni_encode_f)NULL, + (uni_decode_f)NULL +}; + +static void uni_ie_print_itu_atraffic(struct uni_ie_atraffic *, struct unicx *); +static int uni_ie_check_itu_atraffic(struct uni_ie_atraffic *, struct unicx *); +static int uni_ie_encode_itu_atraffic(struct uni_msg *, struct uni_ie_atraffic *, struct unicx *); +static int uni_ie_decode_itu_atraffic(struct uni_ie_atraffic *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_atraffic = { + 0, + 30, + (uni_print_f)uni_ie_print_itu_atraffic, + (uni_check_f)uni_ie_check_itu_atraffic, + (uni_encode_f)uni_ie_encode_itu_atraffic, + (uni_decode_f)uni_ie_decode_itu_atraffic +}; + +static const struct iedecl decl_net_atraffic = { + UNIFL_DEFAULT, + 0, + (uni_print_f)NULL, + (uni_check_f)NULL, + (uni_encode_f)NULL, + (uni_decode_f)NULL +}; + +static void uni_ie_print_net_abrsetup(struct uni_ie_abrsetup *, struct unicx *); +static int uni_ie_check_net_abrsetup(struct uni_ie_abrsetup *, struct unicx *); +static int uni_ie_encode_net_abrsetup(struct uni_msg *, struct uni_ie_abrsetup *, struct unicx *); +static int uni_ie_decode_net_abrsetup(struct uni_ie_abrsetup *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_net_abrsetup = { + 0, + 36, + (uni_print_f)uni_ie_print_net_abrsetup, + (uni_check_f)uni_ie_check_net_abrsetup, + (uni_encode_f)uni_ie_encode_net_abrsetup, + (uni_decode_f)uni_ie_decode_net_abrsetup +}; + +static void uni_ie_print_itu_report(struct uni_ie_report *, struct unicx *); +static int uni_ie_check_itu_report(struct uni_ie_report *, struct unicx *); +static int uni_ie_encode_itu_report(struct uni_msg *, struct uni_ie_report *, struct unicx *); +static int uni_ie_decode_itu_report(struct uni_ie_report *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_report = { + 0, + 5, + (uni_print_f)uni_ie_print_itu_report, + (uni_check_f)uni_ie_check_itu_report, + (uni_encode_f)uni_ie_encode_itu_report, + (uni_decode_f)uni_ie_decode_itu_report +}; + +static void uni_ie_print_net_called_soft(struct uni_ie_called_soft *, struct unicx *); +static int uni_ie_check_net_called_soft(struct uni_ie_called_soft *, struct unicx *); +static int uni_ie_encode_net_called_soft(struct uni_msg *, struct uni_ie_called_soft *, struct unicx *); +static int uni_ie_decode_net_called_soft(struct uni_ie_called_soft *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_net_called_soft = { + 0, + 11, + (uni_print_f)uni_ie_print_net_called_soft, + (uni_check_f)uni_ie_check_net_called_soft, + (uni_encode_f)uni_ie_encode_net_called_soft, + (uni_decode_f)uni_ie_decode_net_called_soft +}; + +static void uni_ie_print_net_crankback(struct uni_ie_crankback *, struct unicx *); +static int uni_ie_check_net_crankback(struct uni_ie_crankback *, struct unicx *); +static int uni_ie_encode_net_crankback(struct uni_msg *, struct uni_ie_crankback *, struct unicx *); +static int uni_ie_decode_net_crankback(struct uni_ie_crankback *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_net_crankback = { + 0, + 72, + (uni_print_f)uni_ie_print_net_crankback, + (uni_check_f)uni_ie_check_net_crankback, + (uni_encode_f)uni_ie_encode_net_crankback, + (uni_decode_f)uni_ie_decode_net_crankback +}; + +static void uni_ie_print_net_dtl(struct uni_ie_dtl *, struct unicx *); +static int uni_ie_check_net_dtl(struct uni_ie_dtl *, struct unicx *); +static int uni_ie_encode_net_dtl(struct uni_msg *, struct uni_ie_dtl *, struct unicx *); +static int uni_ie_decode_net_dtl(struct uni_ie_dtl *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_net_dtl = { + 0, + UNI_DTL_LOGNP_SIZE*UNI_DTL_MAXNUM+6, + (uni_print_f)uni_ie_print_net_dtl, + (uni_check_f)uni_ie_check_net_dtl, + (uni_encode_f)uni_ie_encode_net_dtl, + (uni_decode_f)uni_ie_decode_net_dtl +}; + +static void uni_ie_print_net_calling_soft(struct uni_ie_calling_soft *, struct unicx *); +static int uni_ie_check_net_calling_soft(struct uni_ie_calling_soft *, struct unicx *); +static int uni_ie_encode_net_calling_soft(struct uni_msg *, struct uni_ie_calling_soft *, struct unicx *); +static int uni_ie_decode_net_calling_soft(struct uni_ie_calling_soft *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_net_calling_soft = { + 0, + 10, + (uni_print_f)uni_ie_print_net_calling_soft, + (uni_check_f)uni_ie_check_net_calling_soft, + (uni_encode_f)uni_ie_encode_net_calling_soft, + (uni_decode_f)uni_ie_decode_net_calling_soft +}; + +static void uni_ie_print_net_abradd(struct uni_ie_abradd *, struct unicx *); +static int uni_ie_check_net_abradd(struct uni_ie_abradd *, struct unicx *); +static int uni_ie_encode_net_abradd(struct uni_msg *, struct uni_ie_abradd *, struct unicx *); +static int uni_ie_decode_net_abradd(struct uni_ie_abradd *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_net_abradd = { + 0, + 14, + (uni_print_f)uni_ie_print_net_abradd, + (uni_check_f)uni_ie_check_net_abradd, + (uni_encode_f)uni_ie_encode_net_abradd, + (uni_decode_f)uni_ie_decode_net_abradd +}; + +static void uni_ie_print_net_lij_callid(struct uni_ie_lij_callid *, struct unicx *); +static int uni_ie_check_net_lij_callid(struct uni_ie_lij_callid *, struct unicx *); +static int uni_ie_encode_net_lij_callid(struct uni_msg *, struct uni_ie_lij_callid *, struct unicx *); +static int uni_ie_decode_net_lij_callid(struct uni_ie_lij_callid *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_net_lij_callid = { + 0, + 9, + (uni_print_f)uni_ie_print_net_lij_callid, + (uni_check_f)uni_ie_check_net_lij_callid, + (uni_encode_f)uni_ie_encode_net_lij_callid, + (uni_decode_f)uni_ie_decode_net_lij_callid +}; + +static void uni_ie_print_net_lij_param(struct uni_ie_lij_param *, struct unicx *); +static int uni_ie_check_net_lij_param(struct uni_ie_lij_param *, struct unicx *); +static int uni_ie_encode_net_lij_param(struct uni_msg *, struct uni_ie_lij_param *, struct unicx *); +static int uni_ie_decode_net_lij_param(struct uni_ie_lij_param *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_net_lij_param = { + 0, + 5, + (uni_print_f)uni_ie_print_net_lij_param, + (uni_check_f)uni_ie_check_net_lij_param, + (uni_encode_f)uni_ie_encode_net_lij_param, + (uni_decode_f)uni_ie_decode_net_lij_param +}; + +static void uni_ie_print_net_lij_seqno(struct uni_ie_lij_seqno *, struct unicx *); +static int uni_ie_check_net_lij_seqno(struct uni_ie_lij_seqno *, struct unicx *); +static int uni_ie_encode_net_lij_seqno(struct uni_msg *, struct uni_ie_lij_seqno *, struct unicx *); +static int uni_ie_decode_net_lij_seqno(struct uni_ie_lij_seqno *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_net_lij_seqno = { + 0, + 8, + (uni_print_f)uni_ie_print_net_lij_seqno, + (uni_check_f)uni_ie_check_net_lij_seqno, + (uni_encode_f)uni_ie_encode_net_lij_seqno, + (uni_decode_f)uni_ie_decode_net_lij_seqno +}; + +static void uni_ie_print_net_cscope(struct uni_ie_cscope *, struct unicx *); +static int uni_ie_check_net_cscope(struct uni_ie_cscope *, struct unicx *); +static int uni_ie_encode_net_cscope(struct uni_msg *, struct uni_ie_cscope *, struct unicx *); +static int uni_ie_decode_net_cscope(struct uni_ie_cscope *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_net_cscope = { + 0, + 6, + (uni_print_f)uni_ie_print_net_cscope, + (uni_check_f)uni_ie_check_net_cscope, + (uni_encode_f)uni_ie_encode_net_cscope, + (uni_decode_f)uni_ie_decode_net_cscope +}; + +static void uni_ie_print_net_exqos(struct uni_ie_exqos *, struct unicx *); +static int uni_ie_check_net_exqos(struct uni_ie_exqos *, struct unicx *); +static int uni_ie_encode_net_exqos(struct uni_msg *, struct uni_ie_exqos *, struct unicx *); +static int uni_ie_decode_net_exqos(struct uni_ie_exqos *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_net_exqos = { + 0, + 25, + (uni_print_f)uni_ie_print_net_exqos, + (uni_check_f)uni_ie_check_net_exqos, + (uni_encode_f)uni_ie_encode_net_exqos, + (uni_decode_f)uni_ie_decode_net_exqos +}; + +static void uni_ie_print_net_mdcr(struct uni_ie_mdcr *, struct unicx *); +static int uni_ie_check_net_mdcr(struct uni_ie_mdcr *, struct unicx *); +static int uni_ie_encode_net_mdcr(struct uni_msg *, struct uni_ie_mdcr *, struct unicx *); +static int uni_ie_decode_net_mdcr(struct uni_ie_mdcr *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_net_mdcr = { + 0, + 13, + (uni_print_f)uni_ie_print_net_mdcr, + (uni_check_f)uni_ie_check_net_mdcr, + (uni_encode_f)uni_ie_encode_net_mdcr, + (uni_decode_f)uni_ie_decode_net_mdcr +}; + +static void uni_ie_print_itu_unrec(struct uni_ie_unrec *, struct unicx *); +static int uni_ie_check_itu_unrec(struct uni_ie_unrec *, struct unicx *); +static int uni_ie_encode_itu_unrec(struct uni_msg *, struct uni_ie_unrec *, struct unicx *); +static int uni_ie_decode_itu_unrec(struct uni_ie_unrec *, struct uni_msg *, u_int, struct unicx *); + +static struct iedecl decl_itu_unrec = { + 0, + 128, + (uni_print_f)uni_ie_print_itu_unrec, + (uni_check_f)uni_ie_check_itu_unrec, + (uni_encode_f)uni_ie_encode_itu_unrec, + (uni_decode_f)uni_ie_decode_itu_unrec +}; + +const struct iedecl *uni_ietable[256][4] = { + { NULL, NULL, NULL, NULL, }, /* 0x00 */ + { NULL, NULL, NULL, NULL, }, /* 0x01 */ + { NULL, NULL, NULL, NULL, }, /* 0x02 */ + { NULL, NULL, NULL, NULL, }, /* 0x03 */ + { NULL, NULL, NULL, NULL, }, /* 0x04 */ + { NULL, NULL, NULL, NULL, }, /* 0x05 */ + { NULL, NULL, NULL, NULL, }, /* 0x06 */ + { NULL, NULL, NULL, NULL, }, /* 0x07 */ + { &decl_itu_cause, NULL, NULL, &decl_net_cause, }, /* 0x08 */ + { NULL, NULL, NULL, NULL, }, /* 0x09 */ + { NULL, NULL, NULL, NULL, }, /* 0x0a */ + { NULL, NULL, NULL, NULL, }, /* 0x0b */ + { NULL, NULL, NULL, NULL, }, /* 0x0c */ + { NULL, NULL, NULL, NULL, }, /* 0x0d */ + { NULL, NULL, NULL, NULL, }, /* 0x0e */ + { NULL, NULL, NULL, NULL, }, /* 0x0f */ + { NULL, NULL, NULL, NULL, }, /* 0x10 */ + { NULL, NULL, NULL, NULL, }, /* 0x11 */ + { NULL, NULL, NULL, NULL, }, /* 0x12 */ + { NULL, NULL, NULL, NULL, }, /* 0x13 */ + { &decl_itu_callstate, NULL, NULL, NULL, }, /* 0x14 */ + { NULL, NULL, NULL, NULL, }, /* 0x15 */ + { NULL, NULL, NULL, NULL, }, /* 0x16 */ + { NULL, NULL, NULL, NULL, }, /* 0x17 */ + { NULL, NULL, NULL, NULL, }, /* 0x18 */ + { NULL, NULL, NULL, NULL, }, /* 0x19 */ + { NULL, NULL, NULL, NULL, }, /* 0x1a */ + { NULL, NULL, NULL, NULL, }, /* 0x1b */ + { &decl_itu_facility, NULL, NULL, NULL, }, /* 0x1c */ + { NULL, NULL, NULL, NULL, }, /* 0x1d */ + { NULL, NULL, NULL, NULL, }, /* 0x1e */ + { NULL, NULL, NULL, NULL, }, /* 0x1f */ + { NULL, NULL, NULL, NULL, }, /* 0x20 */ + { NULL, NULL, NULL, NULL, }, /* 0x21 */ + { NULL, NULL, NULL, NULL, }, /* 0x22 */ + { NULL, NULL, NULL, NULL, }, /* 0x23 */ + { NULL, NULL, NULL, NULL, }, /* 0x24 */ + { NULL, NULL, NULL, NULL, }, /* 0x25 */ + { NULL, NULL, NULL, NULL, }, /* 0x26 */ + { &decl_itu_notify, NULL, NULL, NULL, }, /* 0x27 */ + { NULL, NULL, NULL, NULL, }, /* 0x28 */ + { NULL, NULL, NULL, NULL, }, /* 0x29 */ + { NULL, NULL, NULL, NULL, }, /* 0x2a */ + { NULL, NULL, NULL, NULL, }, /* 0x2b */ + { NULL, NULL, NULL, NULL, }, /* 0x2c */ + { NULL, NULL, NULL, NULL, }, /* 0x2d */ + { NULL, NULL, NULL, NULL, }, /* 0x2e */ + { NULL, NULL, NULL, NULL, }, /* 0x2f */ + { NULL, NULL, NULL, NULL, }, /* 0x30 */ + { NULL, NULL, NULL, NULL, }, /* 0x31 */ + { NULL, NULL, NULL, NULL, }, /* 0x32 */ + { NULL, NULL, NULL, NULL, }, /* 0x33 */ + { NULL, NULL, NULL, NULL, }, /* 0x34 */ + { NULL, NULL, NULL, NULL, }, /* 0x35 */ + { NULL, NULL, NULL, NULL, }, /* 0x36 */ + { NULL, NULL, NULL, NULL, }, /* 0x37 */ + { NULL, NULL, NULL, NULL, }, /* 0x38 */ + { NULL, NULL, NULL, NULL, }, /* 0x39 */ + { NULL, NULL, NULL, NULL, }, /* 0x3a */ + { NULL, NULL, NULL, NULL, }, /* 0x3b */ + { NULL, NULL, NULL, NULL, }, /* 0x3c */ + { NULL, NULL, NULL, NULL, }, /* 0x3d */ + { NULL, NULL, NULL, NULL, }, /* 0x3e */ + { NULL, NULL, NULL, NULL, }, /* 0x3f */ + { NULL, NULL, NULL, NULL, }, /* 0x40 */ + { NULL, NULL, NULL, NULL, }, /* 0x41 */ + { &decl_itu_eetd, NULL, NULL, &decl_net_eetd, }, /* 0x42 */ + { NULL, NULL, NULL, NULL, }, /* 0x43 */ + { NULL, NULL, NULL, NULL, }, /* 0x44 */ + { NULL, NULL, NULL, NULL, }, /* 0x45 */ + { NULL, NULL, NULL, NULL, }, /* 0x46 */ + { NULL, NULL, NULL, NULL, }, /* 0x47 */ + { NULL, NULL, NULL, NULL, }, /* 0x48 */ + { NULL, NULL, NULL, NULL, }, /* 0x49 */ + { NULL, NULL, NULL, NULL, }, /* 0x4a */ + { NULL, NULL, NULL, NULL, }, /* 0x4b */ + { &decl_itu_conned, NULL, NULL, NULL, }, /* 0x4c */ + { &decl_itu_connedsub, NULL, NULL, NULL, }, /* 0x4d */ + { NULL, NULL, NULL, NULL, }, /* 0x4e */ + { NULL, NULL, NULL, NULL, }, /* 0x4f */ + { NULL, NULL, NULL, NULL, }, /* 0x50 */ + { NULL, NULL, NULL, NULL, }, /* 0x51 */ + { NULL, NULL, NULL, NULL, }, /* 0x52 */ + { NULL, NULL, NULL, NULL, }, /* 0x53 */ + { &decl_itu_epref, NULL, NULL, NULL, }, /* 0x54 */ + { &decl_itu_epstate, NULL, NULL, NULL, }, /* 0x55 */ + { NULL, NULL, NULL, NULL, }, /* 0x56 */ + { NULL, NULL, NULL, NULL, }, /* 0x57 */ + { &decl_itu_aal, NULL, NULL, NULL, }, /* 0x58 */ + { &decl_itu_traffic, NULL, NULL, &decl_net_traffic, }, /* 0x59 */ + { &decl_itu_connid, NULL, NULL, NULL, }, /* 0x5a */ + { NULL, NULL, NULL, NULL, }, /* 0x5b */ + { &decl_itu_qos, NULL, NULL, &decl_net_qos, }, /* 0x5c */ + { &decl_itu_bhli, NULL, NULL, NULL, }, /* 0x5d */ + { &decl_itu_bearer, NULL, NULL, NULL, }, /* 0x5e */ + { &decl_itu_blli, NULL, NULL, NULL, }, /* 0x5f */ + { &decl_itu_lshift, NULL, NULL, NULL, }, /* 0x60 */ + { &decl_itu_nlshift, NULL, NULL, NULL, }, /* 0x61 */ + { &decl_itu_scompl, NULL, NULL, NULL, }, /* 0x62 */ + { &decl_itu_repeat, NULL, NULL, NULL, }, /* 0x63 */ + { NULL, NULL, NULL, NULL, }, /* 0x64 */ + { NULL, NULL, NULL, NULL, }, /* 0x65 */ + { NULL, NULL, NULL, NULL, }, /* 0x66 */ + { NULL, NULL, NULL, NULL, }, /* 0x67 */ + { NULL, NULL, NULL, NULL, }, /* 0x68 */ + { NULL, NULL, NULL, NULL, }, /* 0x69 */ + { NULL, NULL, NULL, NULL, }, /* 0x6a */ + { NULL, NULL, NULL, NULL, }, /* 0x6b */ + { &decl_itu_calling, NULL, NULL, NULL, }, /* 0x6c */ + { &decl_itu_callingsub, NULL, NULL, NULL, }, /* 0x6d */ + { NULL, NULL, NULL, NULL, }, /* 0x6e */ + { NULL, NULL, NULL, NULL, }, /* 0x6f */ + { &decl_itu_called, NULL, NULL, NULL, }, /* 0x70 */ + { &decl_itu_calledsub, NULL, NULL, NULL, }, /* 0x71 */ + { NULL, NULL, NULL, NULL, }, /* 0x72 */ + { NULL, NULL, NULL, NULL, }, /* 0x73 */ + { NULL, NULL, NULL, NULL, }, /* 0x74 */ + { NULL, NULL, NULL, NULL, }, /* 0x75 */ + { NULL, NULL, NULL, NULL, }, /* 0x76 */ + { NULL, NULL, NULL, NULL, }, /* 0x77 */ + { &decl_itu_tns, NULL, NULL, &decl_net_tns, }, /* 0x78 */ + { &decl_itu_restart, NULL, NULL, NULL, }, /* 0x79 */ + { NULL, NULL, NULL, NULL, }, /* 0x7a */ + { NULL, NULL, NULL, NULL, }, /* 0x7b */ + { NULL, NULL, NULL, NULL, }, /* 0x7c */ + { NULL, NULL, NULL, NULL, }, /* 0x7d */ + { &decl_itu_uu, NULL, NULL, NULL, }, /* 0x7e */ + { NULL, NULL, NULL, &decl_net_git, }, /* 0x7f */ + { NULL, NULL, NULL, NULL, }, /* 0x80 */ + { &decl_itu_mintraffic, NULL, NULL, &decl_net_mintraffic, }, /* 0x81 */ + { &decl_itu_atraffic, NULL, NULL, &decl_net_atraffic, }, /* 0x82 */ + { NULL, NULL, NULL, NULL, }, /* 0x83 */ + { NULL, NULL, NULL, &decl_net_abrsetup, }, /* 0x84 */ + { NULL, NULL, NULL, NULL, }, /* 0x85 */ + { NULL, NULL, NULL, NULL, }, /* 0x86 */ + { NULL, NULL, NULL, NULL, }, /* 0x87 */ + { NULL, NULL, NULL, NULL, }, /* 0x88 */ + { &decl_itu_report, NULL, NULL, NULL, }, /* 0x89 */ + { NULL, NULL, NULL, NULL, }, /* 0x8a */ + { NULL, NULL, NULL, NULL, }, /* 0x8b */ + { NULL, NULL, NULL, NULL, }, /* 0x8c */ + { NULL, NULL, NULL, NULL, }, /* 0x8d */ + { NULL, NULL, NULL, NULL, }, /* 0x8e */ + { NULL, NULL, NULL, NULL, }, /* 0x8f */ + { NULL, NULL, NULL, NULL, }, /* 0x90 */ + { NULL, NULL, NULL, NULL, }, /* 0x91 */ + { NULL, NULL, NULL, NULL, }, /* 0x92 */ + { NULL, NULL, NULL, NULL, }, /* 0x93 */ + { NULL, NULL, NULL, NULL, }, /* 0x94 */ + { NULL, NULL, NULL, NULL, }, /* 0x95 */ + { NULL, NULL, NULL, NULL, }, /* 0x96 */ + { NULL, NULL, NULL, NULL, }, /* 0x97 */ + { NULL, NULL, NULL, NULL, }, /* 0x98 */ + { NULL, NULL, NULL, NULL, }, /* 0x99 */ + { NULL, NULL, NULL, NULL, }, /* 0x9a */ + { NULL, NULL, NULL, NULL, }, /* 0x9b */ + { NULL, NULL, NULL, NULL, }, /* 0x9c */ + { NULL, NULL, NULL, NULL, }, /* 0x9d */ + { NULL, NULL, NULL, NULL, }, /* 0x9e */ + { NULL, NULL, NULL, NULL, }, /* 0x9f */ + { NULL, NULL, NULL, NULL, }, /* 0xa0 */ + { NULL, NULL, NULL, NULL, }, /* 0xa1 */ + { NULL, NULL, NULL, NULL, }, /* 0xa2 */ + { NULL, NULL, NULL, NULL, }, /* 0xa3 */ + { NULL, NULL, NULL, NULL, }, /* 0xa4 */ + { NULL, NULL, NULL, NULL, }, /* 0xa5 */ + { NULL, NULL, NULL, NULL, }, /* 0xa6 */ + { NULL, NULL, NULL, NULL, }, /* 0xa7 */ + { NULL, NULL, NULL, NULL, }, /* 0xa8 */ + { NULL, NULL, NULL, NULL, }, /* 0xa9 */ + { NULL, NULL, NULL, NULL, }, /* 0xaa */ + { NULL, NULL, NULL, NULL, }, /* 0xab */ + { NULL, NULL, NULL, NULL, }, /* 0xac */ + { NULL, NULL, NULL, NULL, }, /* 0xad */ + { NULL, NULL, NULL, NULL, }, /* 0xae */ + { NULL, NULL, NULL, NULL, }, /* 0xaf */ + { NULL, NULL, NULL, NULL, }, /* 0xb0 */ + { NULL, NULL, NULL, NULL, }, /* 0xb1 */ + { NULL, NULL, NULL, NULL, }, /* 0xb2 */ + { NULL, NULL, NULL, NULL, }, /* 0xb3 */ + { NULL, NULL, NULL, NULL, }, /* 0xb4 */ + { NULL, NULL, NULL, NULL, }, /* 0xb5 */ + { NULL, NULL, NULL, NULL, }, /* 0xb6 */ + { NULL, NULL, NULL, NULL, }, /* 0xb7 */ + { NULL, NULL, NULL, NULL, }, /* 0xb8 */ + { NULL, NULL, NULL, NULL, }, /* 0xb9 */ + { NULL, NULL, NULL, NULL, }, /* 0xba */ + { NULL, NULL, NULL, NULL, }, /* 0xbb */ + { NULL, NULL, NULL, NULL, }, /* 0xbc */ + { NULL, NULL, NULL, NULL, }, /* 0xbd */ + { NULL, NULL, NULL, NULL, }, /* 0xbe */ + { NULL, NULL, NULL, NULL, }, /* 0xbf */ + { NULL, NULL, NULL, NULL, }, /* 0xc0 */ + { NULL, NULL, NULL, NULL, }, /* 0xc1 */ + { NULL, NULL, NULL, NULL, }, /* 0xc2 */ + { NULL, NULL, NULL, NULL, }, /* 0xc3 */ + { NULL, NULL, NULL, NULL, }, /* 0xc4 */ + { NULL, NULL, NULL, NULL, }, /* 0xc5 */ + { NULL, NULL, NULL, NULL, }, /* 0xc6 */ + { NULL, NULL, NULL, NULL, }, /* 0xc7 */ + { NULL, NULL, NULL, NULL, }, /* 0xc8 */ + { NULL, NULL, NULL, NULL, }, /* 0xc9 */ + { NULL, NULL, NULL, NULL, }, /* 0xca */ + { NULL, NULL, NULL, NULL, }, /* 0xcb */ + { NULL, NULL, NULL, NULL, }, /* 0xcc */ + { NULL, NULL, NULL, NULL, }, /* 0xcd */ + { NULL, NULL, NULL, NULL, }, /* 0xce */ + { NULL, NULL, NULL, NULL, }, /* 0xcf */ + { NULL, NULL, NULL, NULL, }, /* 0xd0 */ + { NULL, NULL, NULL, NULL, }, /* 0xd1 */ + { NULL, NULL, NULL, NULL, }, /* 0xd2 */ + { NULL, NULL, NULL, NULL, }, /* 0xd3 */ + { NULL, NULL, NULL, NULL, }, /* 0xd4 */ + { NULL, NULL, NULL, NULL, }, /* 0xd5 */ + { NULL, NULL, NULL, NULL, }, /* 0xd6 */ + { NULL, NULL, NULL, NULL, }, /* 0xd7 */ + { NULL, NULL, NULL, NULL, }, /* 0xd8 */ + { NULL, NULL, NULL, NULL, }, /* 0xd9 */ + { NULL, NULL, NULL, NULL, }, /* 0xda */ + { NULL, NULL, NULL, NULL, }, /* 0xdb */ + { NULL, NULL, NULL, NULL, }, /* 0xdc */ + { NULL, NULL, NULL, NULL, }, /* 0xdd */ + { NULL, NULL, NULL, NULL, }, /* 0xde */ + { NULL, NULL, NULL, NULL, }, /* 0xdf */ + { NULL, NULL, NULL, &decl_net_called_soft, }, /* 0xe0 */ + { NULL, NULL, NULL, &decl_net_crankback, }, /* 0xe1 */ + { NULL, NULL, NULL, &decl_net_dtl, }, /* 0xe2 */ + { NULL, NULL, NULL, &decl_net_calling_soft, }, /* 0xe3 */ + { NULL, NULL, NULL, &decl_net_abradd, }, /* 0xe4 */ + { NULL, NULL, NULL, NULL, }, /* 0xe5 */ + { NULL, NULL, NULL, NULL, }, /* 0xe6 */ + { NULL, NULL, NULL, NULL, }, /* 0xe7 */ + { NULL, NULL, NULL, &decl_net_lij_callid, }, /* 0xe8 */ + { NULL, NULL, NULL, &decl_net_lij_param, }, /* 0xe9 */ + { NULL, NULL, NULL, &decl_net_lij_seqno, }, /* 0xea */ + { NULL, NULL, NULL, &decl_net_cscope, }, /* 0xeb */ + { NULL, NULL, NULL, &decl_net_exqos, }, /* 0xec */ + { NULL, NULL, NULL, NULL, }, /* 0xed */ + { NULL, NULL, NULL, NULL, }, /* 0xee */ + { NULL, NULL, NULL, NULL, }, /* 0xef */ + { NULL, NULL, NULL, &decl_net_mdcr, }, /* 0xf0 */ + { NULL, NULL, NULL, NULL, }, /* 0xf1 */ + { NULL, NULL, NULL, NULL, }, /* 0xf2 */ + { NULL, NULL, NULL, NULL, }, /* 0xf3 */ + { NULL, NULL, NULL, NULL, }, /* 0xf4 */ + { NULL, NULL, NULL, NULL, }, /* 0xf5 */ + { NULL, NULL, NULL, NULL, }, /* 0xf6 */ + { NULL, NULL, NULL, NULL, }, /* 0xf7 */ + { NULL, NULL, NULL, NULL, }, /* 0xf8 */ + { NULL, NULL, NULL, NULL, }, /* 0xf9 */ + { NULL, NULL, NULL, NULL, }, /* 0xfa */ + { NULL, NULL, NULL, NULL, }, /* 0xfb */ + { NULL, NULL, NULL, NULL, }, /* 0xfc */ + { NULL, NULL, NULL, NULL, }, /* 0xfd */ + { &decl_itu_unrec, NULL, NULL, NULL, }, /* 0xfe */ + { NULL, NULL, NULL, NULL, }, /* 0xff */ +}; diff --git a/sys/contrib/ngatm/netnatm/msg/uni_msg.c b/sys/contrib/ngatm/netnatm/msg/uni_msg.c new file mode 100644 index 0000000..f999185 --- /dev/null +++ b/sys/contrib/ngatm/netnatm/msg/uni_msg.c @@ -0,0 +1,4901 @@ +/* This file was created automatically + * Source file: $Begemot: libunimsg/atm/msg/msg.def,v 1.3 2003/09/19 11:58:15 hbb Exp $ + * $FreeBSD$ + */ + +#include +#include + +#ifdef _KERNEL +#include +#else +#include +#endif +#include +#include +#include +#include +#include + +static void +print_alerting(struct uni_alerting *msg, struct unicx *cx) +{ + u_int i; + + if(msg->connid.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CONNID, (union uni_ieall *)&msg->connid, cx); + if(msg->epref.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_EPREF, (union uni_ieall *)&msg->epref, cx); + if(msg->notify.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_NOTIFY, (union uni_ieall *)&msg->notify, cx); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if(msg->git[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_GIT, (union uni_ieall *)&msg->git[i], cx); + if(msg->uu.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UU, (union uni_ieall *)&msg->uu, cx); + if(msg->report.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_REPORT, (union uni_ieall *)&msg->report, cx); + if(msg->unrec.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UNREC, (union uni_ieall *)&msg->unrec, cx); +} + +static int +check_alerting(struct uni_alerting *m, struct unicx *cx) +{ + int ret = 0; + u_int i; + + if(!(!cx->pnni)) + ret |= IE_ISPRESENT(m->connid); + else + ret |= uni_check_ie(UNI_IE_CONNID, (union uni_ieall *)&m->connid, cx); + ret |= uni_check_ie(UNI_IE_EPREF, (union uni_ieall *)&m->epref, cx); + ret |= uni_check_ie(UNI_IE_NOTIFY, (union uni_ieall *)&m->notify, cx); + for(i = 0; i < UNI_NUM_IE_GIT ; i++) { + ret |= uni_check_ie(UNI_IE_GIT, (union uni_ieall *)&m->git[i], cx); + } + if(!(!cx->pnni)) + ret |= IE_ISPRESENT(m->uu); + else + ret |= uni_check_ie(UNI_IE_UU, (union uni_ieall *)&m->uu, cx); + if(!(!cx->pnni)) + ret |= IE_ISPRESENT(m->report); + else + ret |= uni_check_ie(UNI_IE_REPORT, (union uni_ieall *)&m->report, cx); + ret |= uni_check_ie(UNI_IE_UNREC, (union uni_ieall *)&m->unrec, cx); + + return ret; +} + +static int +encode_alerting(struct uni_msg *msg, struct uni_alerting *p, struct unicx *cx) +{ + u_int mlen; + u_int i; + + if(uni_encode_msg_hdr(msg, &p->hdr, UNI_ALERTING, cx, &mlen)) + return (-2); + + if((p->connid.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CONNID, msg, (union uni_ieall *)&p->connid, cx)) + return (UNI_IE_CONNID); + if((p->epref.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_EPREF, msg, (union uni_ieall *)&p->epref, cx)) + return (UNI_IE_EPREF); + if((p->notify.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_NOTIFY, msg, (union uni_ieall *)&p->notify, cx)) + return (UNI_IE_NOTIFY); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if((p->git[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_GIT, msg, (union uni_ieall *)&p->git[i], cx)) + return ((i << 16) + UNI_IE_GIT); + if((p->uu.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UU, msg, (union uni_ieall *)&p->uu, cx)) + return (UNI_IE_UU); + if((p->report.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_REPORT, msg, (union uni_ieall *)&p->report, cx)) + return (UNI_IE_REPORT); + if((p->unrec.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UNREC, msg, (union uni_ieall *)&p->unrec, cx)) + return (UNI_IE_UNREC); + + msg->b_buf[mlen+0] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 8; + msg->b_buf[mlen+1] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 0; + + return (0); +} + +static int +decode_alerting(struct uni_alerting *out, struct uni_msg *msg, + enum uni_ietype ie, struct uni_iehdr *hdr, u_int ielen, + struct unicx *cx) +{ + u_int i; + + switch (ie) { + + case UNI_IE_CONNID: + if (!(!cx->pnni)) + return (DEC_ILL); + out->connid.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CONNID, (union uni_ieall *)&out->connid, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_EPREF: + out->epref.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_EPREF, (union uni_ieall *)&out->epref, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_NOTIFY: + out->notify.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_NOTIFY, (union uni_ieall *)&out->notify, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_GIT: + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if (!IE_ISPRESENT(out->git[i])) { + out->git[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_GIT, (union uni_ieall *)&out->git[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_UU: + if (!(!cx->pnni)) + return (DEC_ILL); + out->uu.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UU, (union uni_ieall *)&out->uu, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_REPORT: + if (!(!cx->pnni)) + return (DEC_ILL); + out->report.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_REPORT, (union uni_ieall *)&out->report, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_UNREC: + out->unrec.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UNREC, (union uni_ieall *)&out->unrec, msg, ielen, cx)) + return (DEC_ERR); + break; + + default: + return (DEC_ILL); + } + return (DEC_OK); +} + +static const struct msgdecl decl_alerting = { + 0, + "alerting", + (uni_msg_print_f)print_alerting, + (uni_msg_check_f)check_alerting, + (uni_msg_encode_f)encode_alerting, + (uni_msg_decode_f)decode_alerting +}; + +static void +print_call_proc(struct uni_call_proc *msg, struct unicx *cx) +{ + if(msg->connid.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CONNID, (union uni_ieall *)&msg->connid, cx); + if(msg->epref.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_EPREF, (union uni_ieall *)&msg->epref, cx); + if(msg->notify.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_NOTIFY, (union uni_ieall *)&msg->notify, cx); + if(msg->unrec.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UNREC, (union uni_ieall *)&msg->unrec, cx); +} + +static int +check_call_proc(struct uni_call_proc *m, struct unicx *cx) +{ + int ret = 0; + + ret |= uni_check_ie(UNI_IE_CONNID, (union uni_ieall *)&m->connid, cx); + ret |= uni_check_ie(UNI_IE_EPREF, (union uni_ieall *)&m->epref, cx); + if(!(!cx->pnni)) + ret |= IE_ISPRESENT(m->notify); + else + ret |= uni_check_ie(UNI_IE_NOTIFY, (union uni_ieall *)&m->notify, cx); + ret |= uni_check_ie(UNI_IE_UNREC, (union uni_ieall *)&m->unrec, cx); + + return ret; +} + +static int +encode_call_proc(struct uni_msg *msg, struct uni_call_proc *p, struct unicx *cx) +{ + u_int mlen; + + if(uni_encode_msg_hdr(msg, &p->hdr, UNI_CALL_PROC, cx, &mlen)) + return (-2); + + if((p->connid.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CONNID, msg, (union uni_ieall *)&p->connid, cx)) + return (UNI_IE_CONNID); + if((p->epref.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_EPREF, msg, (union uni_ieall *)&p->epref, cx)) + return (UNI_IE_EPREF); + if((p->notify.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_NOTIFY, msg, (union uni_ieall *)&p->notify, cx)) + return (UNI_IE_NOTIFY); + if((p->unrec.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UNREC, msg, (union uni_ieall *)&p->unrec, cx)) + return (UNI_IE_UNREC); + + msg->b_buf[mlen+0] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 8; + msg->b_buf[mlen+1] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 0; + + return (0); +} + +static int +decode_call_proc(struct uni_call_proc *out, struct uni_msg *msg, + enum uni_ietype ie, struct uni_iehdr *hdr, u_int ielen, + struct unicx *cx) +{ + switch (ie) { + + case UNI_IE_CONNID: + out->connid.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CONNID, (union uni_ieall *)&out->connid, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_EPREF: + out->epref.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_EPREF, (union uni_ieall *)&out->epref, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_NOTIFY: + if (!(!cx->pnni)) + return (DEC_ILL); + out->notify.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_NOTIFY, (union uni_ieall *)&out->notify, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_UNREC: + out->unrec.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UNREC, (union uni_ieall *)&out->unrec, msg, ielen, cx)) + return (DEC_ERR); + break; + + default: + return (DEC_ILL); + } + return (DEC_OK); +} + +static const struct msgdecl decl_call_proc = { + 0, + "call_proc", + (uni_msg_print_f)print_call_proc, + (uni_msg_check_f)check_call_proc, + (uni_msg_encode_f)encode_call_proc, + (uni_msg_decode_f)decode_call_proc +}; + +static void +print_connect(struct uni_connect *msg, struct unicx *cx) +{ + u_int i; + + if(msg->aal.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_AAL, (union uni_ieall *)&msg->aal, cx); + if(msg->blli.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_BLLI, (union uni_ieall *)&msg->blli, cx); + if(msg->connid.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CONNID, (union uni_ieall *)&msg->connid, cx); + if(msg->epref.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_EPREF, (union uni_ieall *)&msg->epref, cx); + if(msg->notify.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_NOTIFY, (union uni_ieall *)&msg->notify, cx); + if(msg->conned.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CONNED, (union uni_ieall *)&msg->conned, cx); + if(msg->connedsub.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CONNEDSUB, (union uni_ieall *)&msg->connedsub, cx); + if(msg->eetd.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_EETD, (union uni_ieall *)&msg->eetd, cx); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if(msg->git[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_GIT, (union uni_ieall *)&msg->git[i], cx); + if(msg->uu.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UU, (union uni_ieall *)&msg->uu, cx); + if(msg->traffic.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_TRAFFIC, (union uni_ieall *)&msg->traffic, cx); + if(msg->exqos.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_EXQOS, (union uni_ieall *)&msg->exqos, cx); + if(msg->facility.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_FACILITY, (union uni_ieall *)&msg->facility, cx); + if(msg->abrsetup.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_ABRSETUP, (union uni_ieall *)&msg->abrsetup, cx); + if(msg->abradd.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_ABRADD, (union uni_ieall *)&msg->abradd, cx); + if(msg->called_soft.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CALLED_SOFT, (union uni_ieall *)&msg->called_soft, cx); + if(msg->report.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_REPORT, (union uni_ieall *)&msg->report, cx); + if(msg->unrec.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UNREC, (union uni_ieall *)&msg->unrec, cx); +} + +static int +check_connect(struct uni_connect *m, struct unicx *cx) +{ + int ret = 0; + u_int i; + + ret |= uni_check_ie(UNI_IE_AAL, (union uni_ieall *)&m->aal, cx); + ret |= uni_check_ie(UNI_IE_BLLI, (union uni_ieall *)&m->blli, cx); + if(!(!cx->pnni)) + ret |= IE_ISPRESENT(m->connid); + else + ret |= uni_check_ie(UNI_IE_CONNID, (union uni_ieall *)&m->connid, cx); + ret |= uni_check_ie(UNI_IE_EPREF, (union uni_ieall *)&m->epref, cx); + ret |= uni_check_ie(UNI_IE_NOTIFY, (union uni_ieall *)&m->notify, cx); + ret |= uni_check_ie(UNI_IE_CONNED, (union uni_ieall *)&m->conned, cx); + ret |= uni_check_ie(UNI_IE_CONNEDSUB, (union uni_ieall *)&m->connedsub, cx); + ret |= uni_check_ie(UNI_IE_EETD, (union uni_ieall *)&m->eetd, cx); + for(i = 0; i < UNI_NUM_IE_GIT ; i++) { + ret |= uni_check_ie(UNI_IE_GIT, (union uni_ieall *)&m->git[i], cx); + } + if(!(!cx->pnni)) + ret |= IE_ISPRESENT(m->uu); + else + ret |= uni_check_ie(UNI_IE_UU, (union uni_ieall *)&m->uu, cx); + ret |= uni_check_ie(UNI_IE_TRAFFIC, (union uni_ieall *)&m->traffic, cx); + ret |= uni_check_ie(UNI_IE_EXQOS, (union uni_ieall *)&m->exqos, cx); + if(!(cx->q2932)) + ret |= IE_ISPRESENT(m->facility); + else + ret |= uni_check_ie(UNI_IE_FACILITY, (union uni_ieall *)&m->facility, cx); + ret |= uni_check_ie(UNI_IE_ABRSETUP, (union uni_ieall *)&m->abrsetup, cx); + ret |= uni_check_ie(UNI_IE_ABRADD, (union uni_ieall *)&m->abradd, cx); + if(!(cx->pnni)) + ret |= IE_ISPRESENT(m->called_soft); + else + ret |= uni_check_ie(UNI_IE_CALLED_SOFT, (union uni_ieall *)&m->called_soft, cx); + if(!(!cx->pnni)) + ret |= IE_ISPRESENT(m->report); + else + ret |= uni_check_ie(UNI_IE_REPORT, (union uni_ieall *)&m->report, cx); + ret |= uni_check_ie(UNI_IE_UNREC, (union uni_ieall *)&m->unrec, cx); + + return ret; +} + +static int +encode_connect(struct uni_msg *msg, struct uni_connect *p, struct unicx *cx) +{ + u_int mlen; + u_int i; + + if(uni_encode_msg_hdr(msg, &p->hdr, UNI_CONNECT, cx, &mlen)) + return (-2); + + if((p->aal.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_AAL, msg, (union uni_ieall *)&p->aal, cx)) + return (UNI_IE_AAL); + if((p->blli.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_BLLI, msg, (union uni_ieall *)&p->blli, cx)) + return (UNI_IE_BLLI); + if((p->connid.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CONNID, msg, (union uni_ieall *)&p->connid, cx)) + return (UNI_IE_CONNID); + if((p->epref.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_EPREF, msg, (union uni_ieall *)&p->epref, cx)) + return (UNI_IE_EPREF); + if((p->notify.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_NOTIFY, msg, (union uni_ieall *)&p->notify, cx)) + return (UNI_IE_NOTIFY); + if((p->conned.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CONNED, msg, (union uni_ieall *)&p->conned, cx)) + return (UNI_IE_CONNED); + if((p->connedsub.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CONNEDSUB, msg, (union uni_ieall *)&p->connedsub, cx)) + return (UNI_IE_CONNEDSUB); + if((p->eetd.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_EETD, msg, (union uni_ieall *)&p->eetd, cx)) + return (UNI_IE_EETD); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if((p->git[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_GIT, msg, (union uni_ieall *)&p->git[i], cx)) + return ((i << 16) + UNI_IE_GIT); + if((p->uu.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UU, msg, (union uni_ieall *)&p->uu, cx)) + return (UNI_IE_UU); + if((p->traffic.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_TRAFFIC, msg, (union uni_ieall *)&p->traffic, cx)) + return (UNI_IE_TRAFFIC); + if((p->exqos.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_EXQOS, msg, (union uni_ieall *)&p->exqos, cx)) + return (UNI_IE_EXQOS); + if((p->facility.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_FACILITY, msg, (union uni_ieall *)&p->facility, cx)) + return (UNI_IE_FACILITY); + if((p->abrsetup.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_ABRSETUP, msg, (union uni_ieall *)&p->abrsetup, cx)) + return (UNI_IE_ABRSETUP); + if((p->abradd.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_ABRADD, msg, (union uni_ieall *)&p->abradd, cx)) + return (UNI_IE_ABRADD); + if((p->called_soft.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CALLED_SOFT, msg, (union uni_ieall *)&p->called_soft, cx)) + return (UNI_IE_CALLED_SOFT); + if((p->report.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_REPORT, msg, (union uni_ieall *)&p->report, cx)) + return (UNI_IE_REPORT); + if((p->unrec.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UNREC, msg, (union uni_ieall *)&p->unrec, cx)) + return (UNI_IE_UNREC); + + msg->b_buf[mlen+0] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 8; + msg->b_buf[mlen+1] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 0; + + return (0); +} + +static int +decode_connect(struct uni_connect *out, struct uni_msg *msg, + enum uni_ietype ie, struct uni_iehdr *hdr, u_int ielen, + struct unicx *cx) +{ + u_int i; + + switch (ie) { + + case UNI_IE_AAL: + out->aal.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_AAL, (union uni_ieall *)&out->aal, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_BLLI: + out->blli.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_BLLI, (union uni_ieall *)&out->blli, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CONNID: + if (!(!cx->pnni)) + return (DEC_ILL); + out->connid.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CONNID, (union uni_ieall *)&out->connid, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_EPREF: + out->epref.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_EPREF, (union uni_ieall *)&out->epref, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_NOTIFY: + out->notify.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_NOTIFY, (union uni_ieall *)&out->notify, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CONNED: + out->conned.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CONNED, (union uni_ieall *)&out->conned, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CONNEDSUB: + out->connedsub.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CONNEDSUB, (union uni_ieall *)&out->connedsub, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_EETD: + out->eetd.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_EETD, (union uni_ieall *)&out->eetd, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_GIT: + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if (!IE_ISPRESENT(out->git[i])) { + out->git[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_GIT, (union uni_ieall *)&out->git[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_UU: + if (!(!cx->pnni)) + return (DEC_ILL); + out->uu.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UU, (union uni_ieall *)&out->uu, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_TRAFFIC: + out->traffic.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_TRAFFIC, (union uni_ieall *)&out->traffic, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_EXQOS: + out->exqos.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_EXQOS, (union uni_ieall *)&out->exqos, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_FACILITY: + if (!(cx->q2932)) + return (DEC_ILL); + out->facility.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_FACILITY, (union uni_ieall *)&out->facility, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_ABRSETUP: + out->abrsetup.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_ABRSETUP, (union uni_ieall *)&out->abrsetup, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_ABRADD: + out->abradd.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_ABRADD, (union uni_ieall *)&out->abradd, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CALLED_SOFT: + if (!(cx->pnni)) + return (DEC_ILL); + out->called_soft.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CALLED_SOFT, (union uni_ieall *)&out->called_soft, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_REPORT: + if (!(!cx->pnni)) + return (DEC_ILL); + out->report.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_REPORT, (union uni_ieall *)&out->report, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_UNREC: + out->unrec.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UNREC, (union uni_ieall *)&out->unrec, msg, ielen, cx)) + return (DEC_ERR); + break; + + default: + return (DEC_ILL); + } + return (DEC_OK); +} + +static const struct msgdecl decl_connect = { + 0, + "connect", + (uni_msg_print_f)print_connect, + (uni_msg_check_f)check_connect, + (uni_msg_encode_f)encode_connect, + (uni_msg_decode_f)decode_connect +}; + +static void +print_connect_ack(struct uni_connect_ack *msg, struct unicx *cx) +{ + if(msg->notify.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_NOTIFY, (union uni_ieall *)&msg->notify, cx); + if(msg->unrec.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UNREC, (union uni_ieall *)&msg->unrec, cx); +} + +static int +check_connect_ack(struct uni_connect_ack *m, struct unicx *cx) +{ + int ret = 0; + + ret |= uni_check_ie(UNI_IE_NOTIFY, (union uni_ieall *)&m->notify, cx); + ret |= uni_check_ie(UNI_IE_UNREC, (union uni_ieall *)&m->unrec, cx); + + return ret; +} + +static int +encode_connect_ack(struct uni_msg *msg, struct uni_connect_ack *p, struct unicx *cx) +{ + u_int mlen; + + if(uni_encode_msg_hdr(msg, &p->hdr, UNI_CONNECT_ACK, cx, &mlen)) + return (-2); + + if((p->notify.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_NOTIFY, msg, (union uni_ieall *)&p->notify, cx)) + return (UNI_IE_NOTIFY); + if((p->unrec.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UNREC, msg, (union uni_ieall *)&p->unrec, cx)) + return (UNI_IE_UNREC); + + msg->b_buf[mlen+0] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 8; + msg->b_buf[mlen+1] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 0; + + return (0); +} + +static int +decode_connect_ack(struct uni_connect_ack *out, struct uni_msg *msg, + enum uni_ietype ie, struct uni_iehdr *hdr, u_int ielen, + struct unicx *cx) +{ + switch (ie) { + + case UNI_IE_NOTIFY: + out->notify.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_NOTIFY, (union uni_ieall *)&out->notify, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_UNREC: + out->unrec.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UNREC, (union uni_ieall *)&out->unrec, msg, ielen, cx)) + return (DEC_ERR); + break; + + default: + return (DEC_ILL); + } + return (DEC_OK); +} + +static const struct msgdecl decl_connect_ack = { + 0, + "connect_ack", + (uni_msg_print_f)print_connect_ack, + (uni_msg_check_f)check_connect_ack, + (uni_msg_encode_f)encode_connect_ack, + (uni_msg_decode_f)decode_connect_ack +}; + +static void +print_release(struct uni_release *msg, struct unicx *cx) +{ + u_int i; + + for(i = 0; i < 2; i++) + if(msg->cause[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CAUSE, (union uni_ieall *)&msg->cause[i], cx); + if(msg->notify.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_NOTIFY, (union uni_ieall *)&msg->notify, cx); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if(msg->git[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_GIT, (union uni_ieall *)&msg->git[i], cx); + if(msg->uu.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UU, (union uni_ieall *)&msg->uu, cx); + if(msg->facility.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_FACILITY, (union uni_ieall *)&msg->facility, cx); + if(msg->crankback.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CRANKBACK, (union uni_ieall *)&msg->crankback, cx); + if(msg->unrec.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UNREC, (union uni_ieall *)&msg->unrec, cx); +} + +static int +check_release(struct uni_release *m, struct unicx *cx) +{ + int ret = 0; + u_int i; + + for(i = 0; i < 2 ; i++) { + ret |= uni_check_ie(UNI_IE_CAUSE, (union uni_ieall *)&m->cause[i], cx); + } + ret |= uni_check_ie(UNI_IE_NOTIFY, (union uni_ieall *)&m->notify, cx); + for(i = 0; i < UNI_NUM_IE_GIT ; i++) { + ret |= uni_check_ie(UNI_IE_GIT, (union uni_ieall *)&m->git[i], cx); + } + if(!(!cx->pnni)) + ret |= IE_ISPRESENT(m->uu); + else + ret |= uni_check_ie(UNI_IE_UU, (union uni_ieall *)&m->uu, cx); + if(!(cx->q2932)) + ret |= IE_ISPRESENT(m->facility); + else + ret |= uni_check_ie(UNI_IE_FACILITY, (union uni_ieall *)&m->facility, cx); + if(!(cx->pnni)) + ret |= IE_ISPRESENT(m->crankback); + else + ret |= uni_check_ie(UNI_IE_CRANKBACK, (union uni_ieall *)&m->crankback, cx); + ret |= uni_check_ie(UNI_IE_UNREC, (union uni_ieall *)&m->unrec, cx); + + return ret; +} + +static int +encode_release(struct uni_msg *msg, struct uni_release *p, struct unicx *cx) +{ + u_int mlen; + u_int i; + + if(uni_encode_msg_hdr(msg, &p->hdr, UNI_RELEASE, cx, &mlen)) + return (-2); + + for(i = 0; i < 2; i++) + if((p->cause[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CAUSE, msg, (union uni_ieall *)&p->cause[i], cx)) + return ((i << 16) + UNI_IE_CAUSE); + if((p->notify.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_NOTIFY, msg, (union uni_ieall *)&p->notify, cx)) + return (UNI_IE_NOTIFY); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if((p->git[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_GIT, msg, (union uni_ieall *)&p->git[i], cx)) + return ((i << 16) + UNI_IE_GIT); + if((p->uu.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UU, msg, (union uni_ieall *)&p->uu, cx)) + return (UNI_IE_UU); + if((p->facility.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_FACILITY, msg, (union uni_ieall *)&p->facility, cx)) + return (UNI_IE_FACILITY); + if((p->crankback.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CRANKBACK, msg, (union uni_ieall *)&p->crankback, cx)) + return (UNI_IE_CRANKBACK); + if((p->unrec.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UNREC, msg, (union uni_ieall *)&p->unrec, cx)) + return (UNI_IE_UNREC); + + msg->b_buf[mlen+0] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 8; + msg->b_buf[mlen+1] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 0; + + return (0); +} + +static int +decode_release(struct uni_release *out, struct uni_msg *msg, + enum uni_ietype ie, struct uni_iehdr *hdr, u_int ielen, + struct unicx *cx) +{ + u_int i; + + switch (ie) { + + case UNI_IE_CAUSE: + for(i = 0; i < 2; i++) + if (!IE_ISPRESENT(out->cause[i])) { + out->cause[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CAUSE, (union uni_ieall *)&out->cause[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_NOTIFY: + out->notify.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_NOTIFY, (union uni_ieall *)&out->notify, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_GIT: + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if (!IE_ISPRESENT(out->git[i])) { + out->git[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_GIT, (union uni_ieall *)&out->git[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_UU: + if (!(!cx->pnni)) + return (DEC_ILL); + out->uu.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UU, (union uni_ieall *)&out->uu, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_FACILITY: + if (!(cx->q2932)) + return (DEC_ILL); + out->facility.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_FACILITY, (union uni_ieall *)&out->facility, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CRANKBACK: + if (!(cx->pnni)) + return (DEC_ILL); + out->crankback.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CRANKBACK, (union uni_ieall *)&out->crankback, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_UNREC: + out->unrec.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UNREC, (union uni_ieall *)&out->unrec, msg, ielen, cx)) + return (DEC_ERR); + break; + + default: + return (DEC_ILL); + } + return (DEC_OK); +} + +static const struct msgdecl decl_release = { + 0, + "release", + (uni_msg_print_f)print_release, + (uni_msg_check_f)check_release, + (uni_msg_encode_f)encode_release, + (uni_msg_decode_f)decode_release +}; + +static void +print_release_compl(struct uni_release_compl *msg, struct unicx *cx) +{ + u_int i; + + for(i = 0; i < 2; i++) + if(msg->cause[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CAUSE, (union uni_ieall *)&msg->cause[i], cx); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if(msg->git[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_GIT, (union uni_ieall *)&msg->git[i], cx); + if(msg->uu.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UU, (union uni_ieall *)&msg->uu, cx); + if(msg->crankback.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CRANKBACK, (union uni_ieall *)&msg->crankback, cx); + if(msg->unrec.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UNREC, (union uni_ieall *)&msg->unrec, cx); +} + +static int +check_release_compl(struct uni_release_compl *m, struct unicx *cx) +{ + int ret = 0; + u_int i; + + for(i = 0; i < 2 ; i++) { + ret |= uni_check_ie(UNI_IE_CAUSE, (union uni_ieall *)&m->cause[i], cx); + } + for(i = 0; i < UNI_NUM_IE_GIT ; i++) { + if(!(!cx->pnni)) + ret |= IE_ISPRESENT(m->git[i]); + else + ret |= uni_check_ie(UNI_IE_GIT, (union uni_ieall *)&m->git[i], cx); + } + if(!(!cx->pnni)) + ret |= IE_ISPRESENT(m->uu); + else + ret |= uni_check_ie(UNI_IE_UU, (union uni_ieall *)&m->uu, cx); + if(!(cx->pnni)) + ret |= IE_ISPRESENT(m->crankback); + else + ret |= uni_check_ie(UNI_IE_CRANKBACK, (union uni_ieall *)&m->crankback, cx); + ret |= uni_check_ie(UNI_IE_UNREC, (union uni_ieall *)&m->unrec, cx); + + return ret; +} + +static int +encode_release_compl(struct uni_msg *msg, struct uni_release_compl *p, struct unicx *cx) +{ + u_int mlen; + u_int i; + + if(uni_encode_msg_hdr(msg, &p->hdr, UNI_RELEASE_COMPL, cx, &mlen)) + return (-2); + + for(i = 0; i < 2; i++) + if((p->cause[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CAUSE, msg, (union uni_ieall *)&p->cause[i], cx)) + return ((i << 16) + UNI_IE_CAUSE); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if((p->git[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_GIT, msg, (union uni_ieall *)&p->git[i], cx)) + return ((i << 16) + UNI_IE_GIT); + if((p->uu.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UU, msg, (union uni_ieall *)&p->uu, cx)) + return (UNI_IE_UU); + if((p->crankback.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CRANKBACK, msg, (union uni_ieall *)&p->crankback, cx)) + return (UNI_IE_CRANKBACK); + if((p->unrec.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UNREC, msg, (union uni_ieall *)&p->unrec, cx)) + return (UNI_IE_UNREC); + + msg->b_buf[mlen+0] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 8; + msg->b_buf[mlen+1] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 0; + + return (0); +} + +static int +decode_release_compl(struct uni_release_compl *out, struct uni_msg *msg, + enum uni_ietype ie, struct uni_iehdr *hdr, u_int ielen, + struct unicx *cx) +{ + u_int i; + + switch (ie) { + + case UNI_IE_CAUSE: + for(i = 0; i < 2; i++) + if (!IE_ISPRESENT(out->cause[i])) { + out->cause[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CAUSE, (union uni_ieall *)&out->cause[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_GIT: + if (!(!cx->pnni)) + return (DEC_ILL); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if (!IE_ISPRESENT(out->git[i])) { + out->git[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_GIT, (union uni_ieall *)&out->git[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_UU: + if (!(!cx->pnni)) + return (DEC_ILL); + out->uu.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UU, (union uni_ieall *)&out->uu, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CRANKBACK: + if (!(cx->pnni)) + return (DEC_ILL); + out->crankback.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CRANKBACK, (union uni_ieall *)&out->crankback, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_UNREC: + out->unrec.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UNREC, (union uni_ieall *)&out->unrec, msg, ielen, cx)) + return (DEC_ERR); + break; + + default: + return (DEC_ILL); + } + return (DEC_OK); +} + +static const struct msgdecl decl_release_compl = { + 0, + "release_compl", + (uni_msg_print_f)print_release_compl, + (uni_msg_check_f)check_release_compl, + (uni_msg_encode_f)encode_release_compl, + (uni_msg_decode_f)decode_release_compl +}; + +static void +print_setup(struct uni_setup *msg, struct unicx *cx) +{ + u_int i; + + if(msg->aal.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_AAL, (union uni_ieall *)&msg->aal, cx); + if(msg->traffic.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_TRAFFIC, (union uni_ieall *)&msg->traffic, cx); + if(msg->bearer.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_BEARER, (union uni_ieall *)&msg->bearer, cx); + if(msg->bhli.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_BHLI, (union uni_ieall *)&msg->bhli, cx); + if(msg->blli_repeat.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_REPEAT, (union uni_ieall *)&msg->blli_repeat, cx); + for(i = 0; i < UNI_NUM_IE_BLLI; i++) + if(msg->blli[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_BLLI, (union uni_ieall *)&msg->blli[i], cx); + if(msg->called.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CALLED, (union uni_ieall *)&msg->called, cx); + for(i = 0; i < UNI_NUM_IE_CALLEDSUB; i++) + if(msg->calledsub[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CALLEDSUB, (union uni_ieall *)&msg->calledsub[i], cx); + if(msg->calling.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CALLING, (union uni_ieall *)&msg->calling, cx); + for(i = 0; i < UNI_NUM_IE_CALLINGSUB; i++) + if(msg->callingsub[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CALLINGSUB, (union uni_ieall *)&msg->callingsub[i], cx); + if(msg->connid.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CONNID, (union uni_ieall *)&msg->connid, cx); + if(msg->qos.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_QOS, (union uni_ieall *)&msg->qos, cx); + if(msg->eetd.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_EETD, (union uni_ieall *)&msg->eetd, cx); + if(msg->notify.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_NOTIFY, (union uni_ieall *)&msg->notify, cx); + if(msg->scompl.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_SCOMPL, (union uni_ieall *)&msg->scompl, cx); + for(i = 0; i < UNI_NUM_IE_TNS; i++) + if(msg->tns[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_TNS, (union uni_ieall *)&msg->tns[i], cx); + if(msg->epref.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_EPREF, (union uni_ieall *)&msg->epref, cx); + if(msg->atraffic.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_ATRAFFIC, (union uni_ieall *)&msg->atraffic, cx); + if(msg->mintraffic.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_MINTRAFFIC, (union uni_ieall *)&msg->mintraffic, cx); + if(msg->uu.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UU, (union uni_ieall *)&msg->uu, cx); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if(msg->git[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_GIT, (union uni_ieall *)&msg->git[i], cx); + if(msg->lij_callid.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_LIJ_CALLID, (union uni_ieall *)&msg->lij_callid, cx); + if(msg->lij_param.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_LIJ_PARAM, (union uni_ieall *)&msg->lij_param, cx); + if(msg->lij_seqno.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_LIJ_SEQNO, (union uni_ieall *)&msg->lij_seqno, cx); + if(msg->exqos.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_EXQOS, (union uni_ieall *)&msg->exqos, cx); + if(msg->abrsetup.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_ABRSETUP, (union uni_ieall *)&msg->abrsetup, cx); + if(msg->abradd.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_ABRADD, (union uni_ieall *)&msg->abradd, cx); + if(msg->cscope.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CSCOPE, (union uni_ieall *)&msg->cscope, cx); + if(msg->calling_soft.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CALLING_SOFT, (union uni_ieall *)&msg->calling_soft, cx); + if(msg->called_soft.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CALLED_SOFT, (union uni_ieall *)&msg->called_soft, cx); + if(msg->dtl_repeat.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_REPEAT, (union uni_ieall *)&msg->dtl_repeat, cx); + for(i = 0; i < UNI_NUM_IE_DTL; i++) + if(msg->dtl[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_DTL, (union uni_ieall *)&msg->dtl[i], cx); + if(msg->report.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_REPORT, (union uni_ieall *)&msg->report, cx); + if(msg->mdcr.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_MDCR, (union uni_ieall *)&msg->mdcr, cx); + if(msg->unrec.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UNREC, (union uni_ieall *)&msg->unrec, cx); +} + +static int +check_setup(struct uni_setup *m, struct unicx *cx) +{ + int ret = 0; + u_int i; + + ret |= uni_check_ie(UNI_IE_AAL, (union uni_ieall *)&m->aal, cx); + ret |= uni_check_ie(UNI_IE_TRAFFIC, (union uni_ieall *)&m->traffic, cx); + ret |= uni_check_ie(UNI_IE_BEARER, (union uni_ieall *)&m->bearer, cx); + ret |= uni_check_ie(UNI_IE_BHLI, (union uni_ieall *)&m->bhli, cx); + ret |= uni_check_ie(UNI_IE_REPEAT, (union uni_ieall *)&m->blli_repeat, cx); + for(i = 0; i < UNI_NUM_IE_BLLI ; i++) { + ret |= uni_check_ie(UNI_IE_BLLI, (union uni_ieall *)&m->blli[i], cx); + } + ret |= uni_check_ie(UNI_IE_CALLED, (union uni_ieall *)&m->called, cx); + for(i = 0; i < UNI_NUM_IE_CALLEDSUB ; i++) { + ret |= uni_check_ie(UNI_IE_CALLEDSUB, (union uni_ieall *)&m->calledsub[i], cx); + } + ret |= uni_check_ie(UNI_IE_CALLING, (union uni_ieall *)&m->calling, cx); + for(i = 0; i < UNI_NUM_IE_CALLINGSUB ; i++) { + ret |= uni_check_ie(UNI_IE_CALLINGSUB, (union uni_ieall *)&m->callingsub[i], cx); + } + ret |= uni_check_ie(UNI_IE_CONNID, (union uni_ieall *)&m->connid, cx); + ret |= uni_check_ie(UNI_IE_QOS, (union uni_ieall *)&m->qos, cx); + ret |= uni_check_ie(UNI_IE_EETD, (union uni_ieall *)&m->eetd, cx); + ret |= uni_check_ie(UNI_IE_NOTIFY, (union uni_ieall *)&m->notify, cx); + if(!(!cx->pnni)) + ret |= IE_ISPRESENT(m->scompl); + else + ret |= uni_check_ie(UNI_IE_SCOMPL, (union uni_ieall *)&m->scompl, cx); + for(i = 0; i < UNI_NUM_IE_TNS ; i++) { + ret |= uni_check_ie(UNI_IE_TNS, (union uni_ieall *)&m->tns[i], cx); + } + ret |= uni_check_ie(UNI_IE_EPREF, (union uni_ieall *)&m->epref, cx); + ret |= uni_check_ie(UNI_IE_ATRAFFIC, (union uni_ieall *)&m->atraffic, cx); + ret |= uni_check_ie(UNI_IE_MINTRAFFIC, (union uni_ieall *)&m->mintraffic, cx); + if(!(!cx->pnni)) + ret |= IE_ISPRESENT(m->uu); + else + ret |= uni_check_ie(UNI_IE_UU, (union uni_ieall *)&m->uu, cx); + for(i = 0; i < UNI_NUM_IE_GIT ; i++) { + ret |= uni_check_ie(UNI_IE_GIT, (union uni_ieall *)&m->git[i], cx); + } + if(!(!cx->pnni)) + ret |= IE_ISPRESENT(m->lij_callid); + else + ret |= uni_check_ie(UNI_IE_LIJ_CALLID, (union uni_ieall *)&m->lij_callid, cx); + if(!(!cx->pnni)) + ret |= IE_ISPRESENT(m->lij_param); + else + ret |= uni_check_ie(UNI_IE_LIJ_PARAM, (union uni_ieall *)&m->lij_param, cx); + if(!(!cx->pnni)) + ret |= IE_ISPRESENT(m->lij_seqno); + else + ret |= uni_check_ie(UNI_IE_LIJ_SEQNO, (union uni_ieall *)&m->lij_seqno, cx); + ret |= uni_check_ie(UNI_IE_EXQOS, (union uni_ieall *)&m->exqos, cx); + ret |= uni_check_ie(UNI_IE_ABRSETUP, (union uni_ieall *)&m->abrsetup, cx); + ret |= uni_check_ie(UNI_IE_ABRADD, (union uni_ieall *)&m->abradd, cx); + ret |= uni_check_ie(UNI_IE_CSCOPE, (union uni_ieall *)&m->cscope, cx); + if(!(cx->pnni)) + ret |= IE_ISPRESENT(m->calling_soft); + else + ret |= uni_check_ie(UNI_IE_CALLING_SOFT, (union uni_ieall *)&m->calling_soft, cx); + if(!(cx->pnni)) + ret |= IE_ISPRESENT(m->called_soft); + else + ret |= uni_check_ie(UNI_IE_CALLED_SOFT, (union uni_ieall *)&m->called_soft, cx); + if(!(cx->pnni)) + ret |= IE_ISPRESENT(m->dtl_repeat); + else + ret |= uni_check_ie(UNI_IE_REPEAT, (union uni_ieall *)&m->dtl_repeat, cx); + for(i = 0; i < UNI_NUM_IE_DTL ; i++) { + if(!(cx->pnni)) + ret |= IE_ISPRESENT(m->dtl[i]); + else + ret |= uni_check_ie(UNI_IE_DTL, (union uni_ieall *)&m->dtl[i], cx); + } + if(!(!cx->pnni)) + ret |= IE_ISPRESENT(m->report); + else + ret |= uni_check_ie(UNI_IE_REPORT, (union uni_ieall *)&m->report, cx); + ret |= uni_check_ie(UNI_IE_MDCR, (union uni_ieall *)&m->mdcr, cx); + ret |= uni_check_ie(UNI_IE_UNREC, (union uni_ieall *)&m->unrec, cx); + + return ret; +} + +static int +encode_setup(struct uni_msg *msg, struct uni_setup *p, struct unicx *cx) +{ + u_int mlen; + u_int i; + + if(uni_encode_msg_hdr(msg, &p->hdr, UNI_SETUP, cx, &mlen)) + return (-2); + + if((p->aal.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_AAL, msg, (union uni_ieall *)&p->aal, cx)) + return (UNI_IE_AAL); + if((p->traffic.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_TRAFFIC, msg, (union uni_ieall *)&p->traffic, cx)) + return (UNI_IE_TRAFFIC); + if((p->bearer.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_BEARER, msg, (union uni_ieall *)&p->bearer, cx)) + return (UNI_IE_BEARER); + if((p->bhli.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_BHLI, msg, (union uni_ieall *)&p->bhli, cx)) + return (UNI_IE_BHLI); + if((p->blli_repeat.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_BLLI, msg, (union uni_ieall *)&p->blli_repeat, cx)) + return (0x10000000 + UNI_IE_BLLI); + for(i = 0; i < UNI_NUM_IE_BLLI; i++) + if((p->blli[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_BLLI, msg, (union uni_ieall *)&p->blli[i], cx)) + return ((i << 16) + UNI_IE_BLLI); + if((p->called.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CALLED, msg, (union uni_ieall *)&p->called, cx)) + return (UNI_IE_CALLED); + for(i = 0; i < UNI_NUM_IE_CALLEDSUB; i++) + if((p->calledsub[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CALLEDSUB, msg, (union uni_ieall *)&p->calledsub[i], cx)) + return ((i << 16) + UNI_IE_CALLEDSUB); + if((p->calling.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CALLING, msg, (union uni_ieall *)&p->calling, cx)) + return (UNI_IE_CALLING); + for(i = 0; i < UNI_NUM_IE_CALLINGSUB; i++) + if((p->callingsub[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CALLINGSUB, msg, (union uni_ieall *)&p->callingsub[i], cx)) + return ((i << 16) + UNI_IE_CALLINGSUB); + if((p->connid.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CONNID, msg, (union uni_ieall *)&p->connid, cx)) + return (UNI_IE_CONNID); + if((p->qos.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_QOS, msg, (union uni_ieall *)&p->qos, cx)) + return (UNI_IE_QOS); + if((p->eetd.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_EETD, msg, (union uni_ieall *)&p->eetd, cx)) + return (UNI_IE_EETD); + if((p->notify.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_NOTIFY, msg, (union uni_ieall *)&p->notify, cx)) + return (UNI_IE_NOTIFY); + if((p->scompl.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_SCOMPL, msg, (union uni_ieall *)&p->scompl, cx)) + return (UNI_IE_SCOMPL); + for(i = 0; i < UNI_NUM_IE_TNS; i++) + if((p->tns[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_TNS, msg, (union uni_ieall *)&p->tns[i], cx)) + return ((i << 16) + UNI_IE_TNS); + if((p->epref.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_EPREF, msg, (union uni_ieall *)&p->epref, cx)) + return (UNI_IE_EPREF); + if((p->atraffic.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_ATRAFFIC, msg, (union uni_ieall *)&p->atraffic, cx)) + return (UNI_IE_ATRAFFIC); + if((p->mintraffic.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_MINTRAFFIC, msg, (union uni_ieall *)&p->mintraffic, cx)) + return (UNI_IE_MINTRAFFIC); + if((p->uu.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UU, msg, (union uni_ieall *)&p->uu, cx)) + return (UNI_IE_UU); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if((p->git[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_GIT, msg, (union uni_ieall *)&p->git[i], cx)) + return ((i << 16) + UNI_IE_GIT); + if((p->lij_callid.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_LIJ_CALLID, msg, (union uni_ieall *)&p->lij_callid, cx)) + return (UNI_IE_LIJ_CALLID); + if((p->lij_param.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_LIJ_PARAM, msg, (union uni_ieall *)&p->lij_param, cx)) + return (UNI_IE_LIJ_PARAM); + if((p->lij_seqno.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_LIJ_SEQNO, msg, (union uni_ieall *)&p->lij_seqno, cx)) + return (UNI_IE_LIJ_SEQNO); + if((p->exqos.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_EXQOS, msg, (union uni_ieall *)&p->exqos, cx)) + return (UNI_IE_EXQOS); + if((p->abrsetup.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_ABRSETUP, msg, (union uni_ieall *)&p->abrsetup, cx)) + return (UNI_IE_ABRSETUP); + if((p->abradd.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_ABRADD, msg, (union uni_ieall *)&p->abradd, cx)) + return (UNI_IE_ABRADD); + if((p->cscope.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CSCOPE, msg, (union uni_ieall *)&p->cscope, cx)) + return (UNI_IE_CSCOPE); + if((p->calling_soft.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CALLING_SOFT, msg, (union uni_ieall *)&p->calling_soft, cx)) + return (UNI_IE_CALLING_SOFT); + if((p->called_soft.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CALLED_SOFT, msg, (union uni_ieall *)&p->called_soft, cx)) + return (UNI_IE_CALLED_SOFT); + if((p->dtl_repeat.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_DTL, msg, (union uni_ieall *)&p->dtl_repeat, cx)) + return (0x10000000 + UNI_IE_DTL); + for(i = 0; i < UNI_NUM_IE_DTL; i++) + if((p->dtl[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_DTL, msg, (union uni_ieall *)&p->dtl[i], cx)) + return ((i << 16) + UNI_IE_DTL); + if((p->report.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_REPORT, msg, (union uni_ieall *)&p->report, cx)) + return (UNI_IE_REPORT); + if((p->mdcr.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_MDCR, msg, (union uni_ieall *)&p->mdcr, cx)) + return (UNI_IE_MDCR); + if((p->unrec.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UNREC, msg, (union uni_ieall *)&p->unrec, cx)) + return (UNI_IE_UNREC); + + msg->b_buf[mlen+0] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 8; + msg->b_buf[mlen+1] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 0; + + return (0); +} + +static int +decode_setup(struct uni_setup *out, struct uni_msg *msg, + enum uni_ietype ie, struct uni_iehdr *hdr, u_int ielen, + struct unicx *cx) +{ + u_int i; + + switch (ie) { + + case UNI_IE_AAL: + out->aal.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_AAL, (union uni_ieall *)&out->aal, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_TRAFFIC: + out->traffic.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_TRAFFIC, (union uni_ieall *)&out->traffic, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_BEARER: + out->bearer.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_BEARER, (union uni_ieall *)&out->bearer, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_BHLI: + out->bhli.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_BHLI, (union uni_ieall *)&out->bhli, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_BLLI: + if (IE_ISPRESENT(cx->repeat)) + out->blli_repeat = cx->repeat; + for(i = 0; i < UNI_NUM_IE_BLLI; i++) + if (!IE_ISPRESENT(out->blli[i])) { + out->blli[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_BLLI, (union uni_ieall *)&out->blli[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_CALLED: + out->called.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CALLED, (union uni_ieall *)&out->called, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CALLEDSUB: + for(i = 0; i < UNI_NUM_IE_CALLEDSUB; i++) + if (!IE_ISPRESENT(out->calledsub[i])) { + out->calledsub[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CALLEDSUB, (union uni_ieall *)&out->calledsub[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_CALLING: + out->calling.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CALLING, (union uni_ieall *)&out->calling, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CALLINGSUB: + for(i = 0; i < UNI_NUM_IE_CALLINGSUB; i++) + if (!IE_ISPRESENT(out->callingsub[i])) { + out->callingsub[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CALLINGSUB, (union uni_ieall *)&out->callingsub[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_CONNID: + out->connid.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CONNID, (union uni_ieall *)&out->connid, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_QOS: + out->qos.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_QOS, (union uni_ieall *)&out->qos, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_EETD: + out->eetd.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_EETD, (union uni_ieall *)&out->eetd, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_NOTIFY: + out->notify.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_NOTIFY, (union uni_ieall *)&out->notify, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_SCOMPL: + if (!(!cx->pnni)) + return (DEC_ILL); + out->scompl.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_SCOMPL, (union uni_ieall *)&out->scompl, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_TNS: + for(i = 0; i < UNI_NUM_IE_TNS; i++) + if (!IE_ISPRESENT(out->tns[i])) { + out->tns[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_TNS, (union uni_ieall *)&out->tns[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_EPREF: + out->epref.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_EPREF, (union uni_ieall *)&out->epref, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_ATRAFFIC: + out->atraffic.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_ATRAFFIC, (union uni_ieall *)&out->atraffic, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_MINTRAFFIC: + out->mintraffic.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_MINTRAFFIC, (union uni_ieall *)&out->mintraffic, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_UU: + if (!(!cx->pnni)) + return (DEC_ILL); + out->uu.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UU, (union uni_ieall *)&out->uu, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_GIT: + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if (!IE_ISPRESENT(out->git[i])) { + out->git[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_GIT, (union uni_ieall *)&out->git[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_LIJ_CALLID: + if (!(!cx->pnni)) + return (DEC_ILL); + out->lij_callid.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_LIJ_CALLID, (union uni_ieall *)&out->lij_callid, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_LIJ_PARAM: + if (!(!cx->pnni)) + return (DEC_ILL); + out->lij_param.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_LIJ_PARAM, (union uni_ieall *)&out->lij_param, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_LIJ_SEQNO: + if (!(!cx->pnni)) + return (DEC_ILL); + out->lij_seqno.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_LIJ_SEQNO, (union uni_ieall *)&out->lij_seqno, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_EXQOS: + out->exqos.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_EXQOS, (union uni_ieall *)&out->exqos, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_ABRSETUP: + out->abrsetup.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_ABRSETUP, (union uni_ieall *)&out->abrsetup, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_ABRADD: + out->abradd.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_ABRADD, (union uni_ieall *)&out->abradd, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CSCOPE: + out->cscope.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CSCOPE, (union uni_ieall *)&out->cscope, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CALLING_SOFT: + if (!(cx->pnni)) + return (DEC_ILL); + out->calling_soft.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CALLING_SOFT, (union uni_ieall *)&out->calling_soft, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CALLED_SOFT: + if (!(cx->pnni)) + return (DEC_ILL); + out->called_soft.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CALLED_SOFT, (union uni_ieall *)&out->called_soft, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_DTL: + if (!(cx->pnni)) + return (DEC_ILL); + if (IE_ISPRESENT(cx->repeat)) + out->dtl_repeat = cx->repeat; + for(i = 0; i < UNI_NUM_IE_DTL; i++) + if (!IE_ISPRESENT(out->dtl[i])) { + out->dtl[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_DTL, (union uni_ieall *)&out->dtl[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_REPORT: + if (!(!cx->pnni)) + return (DEC_ILL); + out->report.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_REPORT, (union uni_ieall *)&out->report, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_MDCR: + out->mdcr.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_MDCR, (union uni_ieall *)&out->mdcr, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_UNREC: + out->unrec.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UNREC, (union uni_ieall *)&out->unrec, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_REPEAT: + cx->repeat.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if (uni_decode_ie_body(UNI_IE_REPEAT, (union uni_ieall *)&cx->repeat, msg, ielen, cx)) + return (DEC_ERR); + break; + + default: + return (DEC_ILL); + } + return (DEC_OK); +} + +static const struct msgdecl decl_setup = { + 0, + "setup", + (uni_msg_print_f)print_setup, + (uni_msg_check_f)check_setup, + (uni_msg_encode_f)encode_setup, + (uni_msg_decode_f)decode_setup +}; + +static void +print_status(struct uni_status *msg, struct unicx *cx) +{ + if(msg->callstate.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CALLSTATE, (union uni_ieall *)&msg->callstate, cx); + if(msg->cause.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CAUSE, (union uni_ieall *)&msg->cause, cx); + if(msg->epref.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_EPREF, (union uni_ieall *)&msg->epref, cx); + if(msg->epstate.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_EPSTATE, (union uni_ieall *)&msg->epstate, cx); + if(msg->unrec.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UNREC, (union uni_ieall *)&msg->unrec, cx); +} + +static int +check_status(struct uni_status *m, struct unicx *cx) +{ + int ret = 0; + + ret |= uni_check_ie(UNI_IE_CALLSTATE, (union uni_ieall *)&m->callstate, cx); + ret |= uni_check_ie(UNI_IE_CAUSE, (union uni_ieall *)&m->cause, cx); + ret |= uni_check_ie(UNI_IE_EPREF, (union uni_ieall *)&m->epref, cx); + ret |= uni_check_ie(UNI_IE_EPSTATE, (union uni_ieall *)&m->epstate, cx); + ret |= uni_check_ie(UNI_IE_UNREC, (union uni_ieall *)&m->unrec, cx); + + return ret; +} + +static int +encode_status(struct uni_msg *msg, struct uni_status *p, struct unicx *cx) +{ + u_int mlen; + + if(uni_encode_msg_hdr(msg, &p->hdr, UNI_STATUS, cx, &mlen)) + return (-2); + + if((p->callstate.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CALLSTATE, msg, (union uni_ieall *)&p->callstate, cx)) + return (UNI_IE_CALLSTATE); + if((p->cause.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CAUSE, msg, (union uni_ieall *)&p->cause, cx)) + return (UNI_IE_CAUSE); + if((p->epref.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_EPREF, msg, (union uni_ieall *)&p->epref, cx)) + return (UNI_IE_EPREF); + if((p->epstate.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_EPSTATE, msg, (union uni_ieall *)&p->epstate, cx)) + return (UNI_IE_EPSTATE); + if((p->unrec.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UNREC, msg, (union uni_ieall *)&p->unrec, cx)) + return (UNI_IE_UNREC); + + msg->b_buf[mlen+0] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 8; + msg->b_buf[mlen+1] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 0; + + return (0); +} + +static int +decode_status(struct uni_status *out, struct uni_msg *msg, + enum uni_ietype ie, struct uni_iehdr *hdr, u_int ielen, + struct unicx *cx) +{ + switch (ie) { + + case UNI_IE_CALLSTATE: + out->callstate.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CALLSTATE, (union uni_ieall *)&out->callstate, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CAUSE: + out->cause.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CAUSE, (union uni_ieall *)&out->cause, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_EPREF: + out->epref.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_EPREF, (union uni_ieall *)&out->epref, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_EPSTATE: + out->epstate.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_EPSTATE, (union uni_ieall *)&out->epstate, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_UNREC: + out->unrec.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UNREC, (union uni_ieall *)&out->unrec, msg, ielen, cx)) + return (DEC_ERR); + break; + + default: + return (DEC_ILL); + } + return (DEC_OK); +} + +static const struct msgdecl decl_status = { + 0, + "status", + (uni_msg_print_f)print_status, + (uni_msg_check_f)check_status, + (uni_msg_encode_f)encode_status, + (uni_msg_decode_f)decode_status +}; + +static void +print_status_enq(struct uni_status_enq *msg, struct unicx *cx) +{ + if(msg->epref.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_EPREF, (union uni_ieall *)&msg->epref, cx); + if(msg->unrec.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UNREC, (union uni_ieall *)&msg->unrec, cx); +} + +static int +check_status_enq(struct uni_status_enq *m, struct unicx *cx) +{ + int ret = 0; + + ret |= uni_check_ie(UNI_IE_EPREF, (union uni_ieall *)&m->epref, cx); + ret |= uni_check_ie(UNI_IE_UNREC, (union uni_ieall *)&m->unrec, cx); + + return ret; +} + +static int +encode_status_enq(struct uni_msg *msg, struct uni_status_enq *p, struct unicx *cx) +{ + u_int mlen; + + if(uni_encode_msg_hdr(msg, &p->hdr, UNI_STATUS_ENQ, cx, &mlen)) + return (-2); + + if((p->epref.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_EPREF, msg, (union uni_ieall *)&p->epref, cx)) + return (UNI_IE_EPREF); + if((p->unrec.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UNREC, msg, (union uni_ieall *)&p->unrec, cx)) + return (UNI_IE_UNREC); + + msg->b_buf[mlen+0] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 8; + msg->b_buf[mlen+1] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 0; + + return (0); +} + +static int +decode_status_enq(struct uni_status_enq *out, struct uni_msg *msg, + enum uni_ietype ie, struct uni_iehdr *hdr, u_int ielen, + struct unicx *cx) +{ + switch (ie) { + + case UNI_IE_EPREF: + out->epref.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_EPREF, (union uni_ieall *)&out->epref, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_UNREC: + out->unrec.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UNREC, (union uni_ieall *)&out->unrec, msg, ielen, cx)) + return (DEC_ERR); + break; + + default: + return (DEC_ILL); + } + return (DEC_OK); +} + +static const struct msgdecl decl_status_enq = { + 0, + "status_enq", + (uni_msg_print_f)print_status_enq, + (uni_msg_check_f)check_status_enq, + (uni_msg_encode_f)encode_status_enq, + (uni_msg_decode_f)decode_status_enq +}; + +static void +print_notify(struct uni_notify *msg, struct unicx *cx) +{ + if(msg->notify.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_NOTIFY, (union uni_ieall *)&msg->notify, cx); + if(msg->epref.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_EPREF, (union uni_ieall *)&msg->epref, cx); + if(msg->unrec.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UNREC, (union uni_ieall *)&msg->unrec, cx); +} + +static int +check_notify(struct uni_notify *m, struct unicx *cx) +{ + int ret = 0; + + ret |= uni_check_ie(UNI_IE_NOTIFY, (union uni_ieall *)&m->notify, cx); + ret |= uni_check_ie(UNI_IE_EPREF, (union uni_ieall *)&m->epref, cx); + ret |= uni_check_ie(UNI_IE_UNREC, (union uni_ieall *)&m->unrec, cx); + + return ret; +} + +static int +encode_notify(struct uni_msg *msg, struct uni_notify *p, struct unicx *cx) +{ + u_int mlen; + + if(uni_encode_msg_hdr(msg, &p->hdr, UNI_NOTIFY, cx, &mlen)) + return (-2); + + if((p->notify.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_NOTIFY, msg, (union uni_ieall *)&p->notify, cx)) + return (UNI_IE_NOTIFY); + if((p->epref.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_EPREF, msg, (union uni_ieall *)&p->epref, cx)) + return (UNI_IE_EPREF); + if((p->unrec.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UNREC, msg, (union uni_ieall *)&p->unrec, cx)) + return (UNI_IE_UNREC); + + msg->b_buf[mlen+0] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 8; + msg->b_buf[mlen+1] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 0; + + return (0); +} + +static int +decode_notify(struct uni_notify *out, struct uni_msg *msg, + enum uni_ietype ie, struct uni_iehdr *hdr, u_int ielen, + struct unicx *cx) +{ + switch (ie) { + + case UNI_IE_NOTIFY: + out->notify.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_NOTIFY, (union uni_ieall *)&out->notify, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_EPREF: + out->epref.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_EPREF, (union uni_ieall *)&out->epref, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_UNREC: + out->unrec.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UNREC, (union uni_ieall *)&out->unrec, msg, ielen, cx)) + return (DEC_ERR); + break; + + default: + return (DEC_ILL); + } + return (DEC_OK); +} + +static const struct msgdecl decl_notify = { + 0, + "notify", + (uni_msg_print_f)print_notify, + (uni_msg_check_f)check_notify, + (uni_msg_encode_f)encode_notify, + (uni_msg_decode_f)decode_notify +}; + +static void +print_restart(struct uni_restart *msg, struct unicx *cx) +{ + if(msg->connid.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CONNID, (union uni_ieall *)&msg->connid, cx); + if(msg->restart.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_RESTART, (union uni_ieall *)&msg->restart, cx); + if(msg->unrec.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UNREC, (union uni_ieall *)&msg->unrec, cx); +} + +static int +check_restart(struct uni_restart *m, struct unicx *cx) +{ + int ret = 0; + + ret |= uni_check_ie(UNI_IE_CONNID, (union uni_ieall *)&m->connid, cx); + ret |= uni_check_ie(UNI_IE_RESTART, (union uni_ieall *)&m->restart, cx); + ret |= uni_check_ie(UNI_IE_UNREC, (union uni_ieall *)&m->unrec, cx); + + return ret; +} + +static int +encode_restart(struct uni_msg *msg, struct uni_restart *p, struct unicx *cx) +{ + u_int mlen; + + if(uni_encode_msg_hdr(msg, &p->hdr, UNI_RESTART, cx, &mlen)) + return (-2); + + if((p->connid.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CONNID, msg, (union uni_ieall *)&p->connid, cx)) + return (UNI_IE_CONNID); + if((p->restart.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_RESTART, msg, (union uni_ieall *)&p->restart, cx)) + return (UNI_IE_RESTART); + if((p->unrec.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UNREC, msg, (union uni_ieall *)&p->unrec, cx)) + return (UNI_IE_UNREC); + + msg->b_buf[mlen+0] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 8; + msg->b_buf[mlen+1] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 0; + + return (0); +} + +static int +decode_restart(struct uni_restart *out, struct uni_msg *msg, + enum uni_ietype ie, struct uni_iehdr *hdr, u_int ielen, + struct unicx *cx) +{ + switch (ie) { + + case UNI_IE_CONNID: + out->connid.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CONNID, (union uni_ieall *)&out->connid, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_RESTART: + out->restart.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_RESTART, (union uni_ieall *)&out->restart, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_UNREC: + out->unrec.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UNREC, (union uni_ieall *)&out->unrec, msg, ielen, cx)) + return (DEC_ERR); + break; + + default: + return (DEC_ILL); + } + return (DEC_OK); +} + +static const struct msgdecl decl_restart = { + 0, + "restart", + (uni_msg_print_f)print_restart, + (uni_msg_check_f)check_restart, + (uni_msg_encode_f)encode_restart, + (uni_msg_decode_f)decode_restart +}; + +static void +print_restart_ack(struct uni_restart_ack *msg, struct unicx *cx) +{ + if(msg->connid.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CONNID, (union uni_ieall *)&msg->connid, cx); + if(msg->restart.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_RESTART, (union uni_ieall *)&msg->restart, cx); + if(msg->unrec.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UNREC, (union uni_ieall *)&msg->unrec, cx); +} + +static int +check_restart_ack(struct uni_restart_ack *m, struct unicx *cx) +{ + int ret = 0; + + ret |= uni_check_ie(UNI_IE_CONNID, (union uni_ieall *)&m->connid, cx); + ret |= uni_check_ie(UNI_IE_RESTART, (union uni_ieall *)&m->restart, cx); + ret |= uni_check_ie(UNI_IE_UNREC, (union uni_ieall *)&m->unrec, cx); + + return ret; +} + +static int +encode_restart_ack(struct uni_msg *msg, struct uni_restart_ack *p, struct unicx *cx) +{ + u_int mlen; + + if(uni_encode_msg_hdr(msg, &p->hdr, UNI_RESTART_ACK, cx, &mlen)) + return (-2); + + if((p->connid.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CONNID, msg, (union uni_ieall *)&p->connid, cx)) + return (UNI_IE_CONNID); + if((p->restart.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_RESTART, msg, (union uni_ieall *)&p->restart, cx)) + return (UNI_IE_RESTART); + if((p->unrec.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UNREC, msg, (union uni_ieall *)&p->unrec, cx)) + return (UNI_IE_UNREC); + + msg->b_buf[mlen+0] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 8; + msg->b_buf[mlen+1] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 0; + + return (0); +} + +static int +decode_restart_ack(struct uni_restart_ack *out, struct uni_msg *msg, + enum uni_ietype ie, struct uni_iehdr *hdr, u_int ielen, + struct unicx *cx) +{ + switch (ie) { + + case UNI_IE_CONNID: + out->connid.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CONNID, (union uni_ieall *)&out->connid, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_RESTART: + out->restart.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_RESTART, (union uni_ieall *)&out->restart, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_UNREC: + out->unrec.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UNREC, (union uni_ieall *)&out->unrec, msg, ielen, cx)) + return (DEC_ERR); + break; + + default: + return (DEC_ILL); + } + return (DEC_OK); +} + +static const struct msgdecl decl_restart_ack = { + 0, + "restart_ack", + (uni_msg_print_f)print_restart_ack, + (uni_msg_check_f)check_restart_ack, + (uni_msg_encode_f)encode_restart_ack, + (uni_msg_decode_f)decode_restart_ack +}; + +static void +print_add_party(struct uni_add_party *msg, struct unicx *cx) +{ + u_int i; + + if(msg->aal.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_AAL, (union uni_ieall *)&msg->aal, cx); + if(msg->bhli.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_BHLI, (union uni_ieall *)&msg->bhli, cx); + if(msg->blli.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_BLLI, (union uni_ieall *)&msg->blli, cx); + if(msg->called.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CALLED, (union uni_ieall *)&msg->called, cx); + for(i = 0; i < UNI_NUM_IE_CALLEDSUB; i++) + if(msg->calledsub[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CALLEDSUB, (union uni_ieall *)&msg->calledsub[i], cx); + if(msg->calling.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CALLING, (union uni_ieall *)&msg->calling, cx); + for(i = 0; i < UNI_NUM_IE_CALLINGSUB; i++) + if(msg->callingsub[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CALLINGSUB, (union uni_ieall *)&msg->callingsub[i], cx); + if(msg->scompl.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_SCOMPL, (union uni_ieall *)&msg->scompl, cx); + for(i = 0; i < UNI_NUM_IE_TNS; i++) + if(msg->tns[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_TNS, (union uni_ieall *)&msg->tns[i], cx); + if(msg->epref.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_EPREF, (union uni_ieall *)&msg->epref, cx); + if(msg->notify.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_NOTIFY, (union uni_ieall *)&msg->notify, cx); + if(msg->eetd.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_EETD, (union uni_ieall *)&msg->eetd, cx); + if(msg->uu.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UU, (union uni_ieall *)&msg->uu, cx); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if(msg->git[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_GIT, (union uni_ieall *)&msg->git[i], cx); + if(msg->lij_seqno.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_LIJ_SEQNO, (union uni_ieall *)&msg->lij_seqno, cx); + if(msg->calling_soft.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CALLING_SOFT, (union uni_ieall *)&msg->calling_soft, cx); + if(msg->called_soft.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CALLED_SOFT, (union uni_ieall *)&msg->called_soft, cx); + if(msg->dtl_repeat.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_REPEAT, (union uni_ieall *)&msg->dtl_repeat, cx); + for(i = 0; i < UNI_NUM_IE_DTL; i++) + if(msg->dtl[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_DTL, (union uni_ieall *)&msg->dtl[i], cx); + if(msg->unrec.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UNREC, (union uni_ieall *)&msg->unrec, cx); +} + +static int +check_add_party(struct uni_add_party *m, struct unicx *cx) +{ + int ret = 0; + u_int i; + + ret |= uni_check_ie(UNI_IE_AAL, (union uni_ieall *)&m->aal, cx); + ret |= uni_check_ie(UNI_IE_BHLI, (union uni_ieall *)&m->bhli, cx); + ret |= uni_check_ie(UNI_IE_BLLI, (union uni_ieall *)&m->blli, cx); + ret |= uni_check_ie(UNI_IE_CALLED, (union uni_ieall *)&m->called, cx); + for(i = 0; i < UNI_NUM_IE_CALLEDSUB ; i++) { + ret |= uni_check_ie(UNI_IE_CALLEDSUB, (union uni_ieall *)&m->calledsub[i], cx); + } + ret |= uni_check_ie(UNI_IE_CALLING, (union uni_ieall *)&m->calling, cx); + for(i = 0; i < UNI_NUM_IE_CALLINGSUB ; i++) { + ret |= uni_check_ie(UNI_IE_CALLINGSUB, (union uni_ieall *)&m->callingsub[i], cx); + } + if(!(!cx->pnni)) + ret |= IE_ISPRESENT(m->scompl); + else + ret |= uni_check_ie(UNI_IE_SCOMPL, (union uni_ieall *)&m->scompl, cx); + for(i = 0; i < UNI_NUM_IE_TNS ; i++) { + ret |= uni_check_ie(UNI_IE_TNS, (union uni_ieall *)&m->tns[i], cx); + } + ret |= uni_check_ie(UNI_IE_EPREF, (union uni_ieall *)&m->epref, cx); + ret |= uni_check_ie(UNI_IE_NOTIFY, (union uni_ieall *)&m->notify, cx); + ret |= uni_check_ie(UNI_IE_EETD, (union uni_ieall *)&m->eetd, cx); + if(!(!cx->pnni)) + ret |= IE_ISPRESENT(m->uu); + else + ret |= uni_check_ie(UNI_IE_UU, (union uni_ieall *)&m->uu, cx); + for(i = 0; i < UNI_NUM_IE_GIT ; i++) { + ret |= uni_check_ie(UNI_IE_GIT, (union uni_ieall *)&m->git[i], cx); + } + if(!(!cx->pnni)) + ret |= IE_ISPRESENT(m->lij_seqno); + else + ret |= uni_check_ie(UNI_IE_LIJ_SEQNO, (union uni_ieall *)&m->lij_seqno, cx); + if(!(cx->pnni)) + ret |= IE_ISPRESENT(m->calling_soft); + else + ret |= uni_check_ie(UNI_IE_CALLING_SOFT, (union uni_ieall *)&m->calling_soft, cx); + if(!(cx->pnni)) + ret |= IE_ISPRESENT(m->called_soft); + else + ret |= uni_check_ie(UNI_IE_CALLED_SOFT, (union uni_ieall *)&m->called_soft, cx); + if(!(cx->pnni)) + ret |= IE_ISPRESENT(m->dtl_repeat); + else + ret |= uni_check_ie(UNI_IE_REPEAT, (union uni_ieall *)&m->dtl_repeat, cx); + for(i = 0; i < UNI_NUM_IE_DTL ; i++) { + if(!(cx->pnni)) + ret |= IE_ISPRESENT(m->dtl[i]); + else + ret |= uni_check_ie(UNI_IE_DTL, (union uni_ieall *)&m->dtl[i], cx); + } + ret |= uni_check_ie(UNI_IE_UNREC, (union uni_ieall *)&m->unrec, cx); + + return ret; +} + +static int +encode_add_party(struct uni_msg *msg, struct uni_add_party *p, struct unicx *cx) +{ + u_int mlen; + u_int i; + + if(uni_encode_msg_hdr(msg, &p->hdr, UNI_ADD_PARTY, cx, &mlen)) + return (-2); + + if((p->aal.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_AAL, msg, (union uni_ieall *)&p->aal, cx)) + return (UNI_IE_AAL); + if((p->bhli.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_BHLI, msg, (union uni_ieall *)&p->bhli, cx)) + return (UNI_IE_BHLI); + if((p->blli.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_BLLI, msg, (union uni_ieall *)&p->blli, cx)) + return (UNI_IE_BLLI); + if((p->called.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CALLED, msg, (union uni_ieall *)&p->called, cx)) + return (UNI_IE_CALLED); + for(i = 0; i < UNI_NUM_IE_CALLEDSUB; i++) + if((p->calledsub[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CALLEDSUB, msg, (union uni_ieall *)&p->calledsub[i], cx)) + return ((i << 16) + UNI_IE_CALLEDSUB); + if((p->calling.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CALLING, msg, (union uni_ieall *)&p->calling, cx)) + return (UNI_IE_CALLING); + for(i = 0; i < UNI_NUM_IE_CALLINGSUB; i++) + if((p->callingsub[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CALLINGSUB, msg, (union uni_ieall *)&p->callingsub[i], cx)) + return ((i << 16) + UNI_IE_CALLINGSUB); + if((p->scompl.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_SCOMPL, msg, (union uni_ieall *)&p->scompl, cx)) + return (UNI_IE_SCOMPL); + for(i = 0; i < UNI_NUM_IE_TNS; i++) + if((p->tns[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_TNS, msg, (union uni_ieall *)&p->tns[i], cx)) + return ((i << 16) + UNI_IE_TNS); + if((p->epref.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_EPREF, msg, (union uni_ieall *)&p->epref, cx)) + return (UNI_IE_EPREF); + if((p->notify.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_NOTIFY, msg, (union uni_ieall *)&p->notify, cx)) + return (UNI_IE_NOTIFY); + if((p->eetd.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_EETD, msg, (union uni_ieall *)&p->eetd, cx)) + return (UNI_IE_EETD); + if((p->uu.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UU, msg, (union uni_ieall *)&p->uu, cx)) + return (UNI_IE_UU); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if((p->git[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_GIT, msg, (union uni_ieall *)&p->git[i], cx)) + return ((i << 16) + UNI_IE_GIT); + if((p->lij_seqno.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_LIJ_SEQNO, msg, (union uni_ieall *)&p->lij_seqno, cx)) + return (UNI_IE_LIJ_SEQNO); + if((p->calling_soft.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CALLING_SOFT, msg, (union uni_ieall *)&p->calling_soft, cx)) + return (UNI_IE_CALLING_SOFT); + if((p->called_soft.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CALLED_SOFT, msg, (union uni_ieall *)&p->called_soft, cx)) + return (UNI_IE_CALLED_SOFT); + if((p->dtl_repeat.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_DTL, msg, (union uni_ieall *)&p->dtl_repeat, cx)) + return (0x10000000 + UNI_IE_DTL); + for(i = 0; i < UNI_NUM_IE_DTL; i++) + if((p->dtl[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_DTL, msg, (union uni_ieall *)&p->dtl[i], cx)) + return ((i << 16) + UNI_IE_DTL); + if((p->unrec.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UNREC, msg, (union uni_ieall *)&p->unrec, cx)) + return (UNI_IE_UNREC); + + msg->b_buf[mlen+0] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 8; + msg->b_buf[mlen+1] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 0; + + return (0); +} + +static int +decode_add_party(struct uni_add_party *out, struct uni_msg *msg, + enum uni_ietype ie, struct uni_iehdr *hdr, u_int ielen, + struct unicx *cx) +{ + u_int i; + + switch (ie) { + + case UNI_IE_AAL: + out->aal.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_AAL, (union uni_ieall *)&out->aal, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_BHLI: + out->bhli.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_BHLI, (union uni_ieall *)&out->bhli, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_BLLI: + out->blli.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_BLLI, (union uni_ieall *)&out->blli, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CALLED: + out->called.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CALLED, (union uni_ieall *)&out->called, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CALLEDSUB: + for(i = 0; i < UNI_NUM_IE_CALLEDSUB; i++) + if (!IE_ISPRESENT(out->calledsub[i])) { + out->calledsub[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CALLEDSUB, (union uni_ieall *)&out->calledsub[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_CALLING: + out->calling.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CALLING, (union uni_ieall *)&out->calling, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CALLINGSUB: + for(i = 0; i < UNI_NUM_IE_CALLINGSUB; i++) + if (!IE_ISPRESENT(out->callingsub[i])) { + out->callingsub[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CALLINGSUB, (union uni_ieall *)&out->callingsub[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_SCOMPL: + if (!(!cx->pnni)) + return (DEC_ILL); + out->scompl.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_SCOMPL, (union uni_ieall *)&out->scompl, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_TNS: + for(i = 0; i < UNI_NUM_IE_TNS; i++) + if (!IE_ISPRESENT(out->tns[i])) { + out->tns[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_TNS, (union uni_ieall *)&out->tns[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_EPREF: + out->epref.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_EPREF, (union uni_ieall *)&out->epref, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_NOTIFY: + out->notify.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_NOTIFY, (union uni_ieall *)&out->notify, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_EETD: + out->eetd.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_EETD, (union uni_ieall *)&out->eetd, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_UU: + if (!(!cx->pnni)) + return (DEC_ILL); + out->uu.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UU, (union uni_ieall *)&out->uu, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_GIT: + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if (!IE_ISPRESENT(out->git[i])) { + out->git[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_GIT, (union uni_ieall *)&out->git[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_LIJ_SEQNO: + if (!(!cx->pnni)) + return (DEC_ILL); + out->lij_seqno.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_LIJ_SEQNO, (union uni_ieall *)&out->lij_seqno, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CALLING_SOFT: + if (!(cx->pnni)) + return (DEC_ILL); + out->calling_soft.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CALLING_SOFT, (union uni_ieall *)&out->calling_soft, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CALLED_SOFT: + if (!(cx->pnni)) + return (DEC_ILL); + out->called_soft.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CALLED_SOFT, (union uni_ieall *)&out->called_soft, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_DTL: + if (!(cx->pnni)) + return (DEC_ILL); + if (IE_ISPRESENT(cx->repeat)) + out->dtl_repeat = cx->repeat; + for(i = 0; i < UNI_NUM_IE_DTL; i++) + if (!IE_ISPRESENT(out->dtl[i])) { + out->dtl[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_DTL, (union uni_ieall *)&out->dtl[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_UNREC: + out->unrec.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UNREC, (union uni_ieall *)&out->unrec, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_REPEAT: + cx->repeat.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if (uni_decode_ie_body(UNI_IE_REPEAT, (union uni_ieall *)&cx->repeat, msg, ielen, cx)) + return (DEC_ERR); + break; + + default: + return (DEC_ILL); + } + return (DEC_OK); +} + +static const struct msgdecl decl_add_party = { + 0, + "add_party", + (uni_msg_print_f)print_add_party, + (uni_msg_check_f)check_add_party, + (uni_msg_encode_f)encode_add_party, + (uni_msg_decode_f)decode_add_party +}; + +static void +print_add_party_ack(struct uni_add_party_ack *msg, struct unicx *cx) +{ + u_int i; + + if(msg->epref.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_EPREF, (union uni_ieall *)&msg->epref, cx); + if(msg->aal.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_AAL, (union uni_ieall *)&msg->aal, cx); + if(msg->blli.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_BLLI, (union uni_ieall *)&msg->blli, cx); + if(msg->notify.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_NOTIFY, (union uni_ieall *)&msg->notify, cx); + if(msg->eetd.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_EETD, (union uni_ieall *)&msg->eetd, cx); + if(msg->conned.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CONNED, (union uni_ieall *)&msg->conned, cx); + if(msg->connedsub.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CONNEDSUB, (union uni_ieall *)&msg->connedsub, cx); + if(msg->uu.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UU, (union uni_ieall *)&msg->uu, cx); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if(msg->git[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_GIT, (union uni_ieall *)&msg->git[i], cx); + if(msg->called_soft.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CALLED_SOFT, (union uni_ieall *)&msg->called_soft, cx); + if(msg->unrec.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UNREC, (union uni_ieall *)&msg->unrec, cx); +} + +static int +check_add_party_ack(struct uni_add_party_ack *m, struct unicx *cx) +{ + int ret = 0; + u_int i; + + ret |= uni_check_ie(UNI_IE_EPREF, (union uni_ieall *)&m->epref, cx); + ret |= uni_check_ie(UNI_IE_AAL, (union uni_ieall *)&m->aal, cx); + ret |= uni_check_ie(UNI_IE_BLLI, (union uni_ieall *)&m->blli, cx); + ret |= uni_check_ie(UNI_IE_NOTIFY, (union uni_ieall *)&m->notify, cx); + ret |= uni_check_ie(UNI_IE_EETD, (union uni_ieall *)&m->eetd, cx); + ret |= uni_check_ie(UNI_IE_CONNED, (union uni_ieall *)&m->conned, cx); + ret |= uni_check_ie(UNI_IE_CONNEDSUB, (union uni_ieall *)&m->connedsub, cx); + if(!(!cx->pnni)) + ret |= IE_ISPRESENT(m->uu); + else + ret |= uni_check_ie(UNI_IE_UU, (union uni_ieall *)&m->uu, cx); + for(i = 0; i < UNI_NUM_IE_GIT ; i++) { + ret |= uni_check_ie(UNI_IE_GIT, (union uni_ieall *)&m->git[i], cx); + } + if(!(cx->pnni)) + ret |= IE_ISPRESENT(m->called_soft); + else + ret |= uni_check_ie(UNI_IE_CALLED_SOFT, (union uni_ieall *)&m->called_soft, cx); + ret |= uni_check_ie(UNI_IE_UNREC, (union uni_ieall *)&m->unrec, cx); + + return ret; +} + +static int +encode_add_party_ack(struct uni_msg *msg, struct uni_add_party_ack *p, struct unicx *cx) +{ + u_int mlen; + u_int i; + + if(uni_encode_msg_hdr(msg, &p->hdr, UNI_ADD_PARTY_ACK, cx, &mlen)) + return (-2); + + if((p->epref.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_EPREF, msg, (union uni_ieall *)&p->epref, cx)) + return (UNI_IE_EPREF); + if((p->aal.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_AAL, msg, (union uni_ieall *)&p->aal, cx)) + return (UNI_IE_AAL); + if((p->blli.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_BLLI, msg, (union uni_ieall *)&p->blli, cx)) + return (UNI_IE_BLLI); + if((p->notify.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_NOTIFY, msg, (union uni_ieall *)&p->notify, cx)) + return (UNI_IE_NOTIFY); + if((p->eetd.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_EETD, msg, (union uni_ieall *)&p->eetd, cx)) + return (UNI_IE_EETD); + if((p->conned.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CONNED, msg, (union uni_ieall *)&p->conned, cx)) + return (UNI_IE_CONNED); + if((p->connedsub.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CONNEDSUB, msg, (union uni_ieall *)&p->connedsub, cx)) + return (UNI_IE_CONNEDSUB); + if((p->uu.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UU, msg, (union uni_ieall *)&p->uu, cx)) + return (UNI_IE_UU); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if((p->git[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_GIT, msg, (union uni_ieall *)&p->git[i], cx)) + return ((i << 16) + UNI_IE_GIT); + if((p->called_soft.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CALLED_SOFT, msg, (union uni_ieall *)&p->called_soft, cx)) + return (UNI_IE_CALLED_SOFT); + if((p->unrec.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UNREC, msg, (union uni_ieall *)&p->unrec, cx)) + return (UNI_IE_UNREC); + + msg->b_buf[mlen+0] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 8; + msg->b_buf[mlen+1] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 0; + + return (0); +} + +static int +decode_add_party_ack(struct uni_add_party_ack *out, struct uni_msg *msg, + enum uni_ietype ie, struct uni_iehdr *hdr, u_int ielen, + struct unicx *cx) +{ + u_int i; + + switch (ie) { + + case UNI_IE_EPREF: + out->epref.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_EPREF, (union uni_ieall *)&out->epref, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_AAL: + out->aal.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_AAL, (union uni_ieall *)&out->aal, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_BLLI: + out->blli.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_BLLI, (union uni_ieall *)&out->blli, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_NOTIFY: + out->notify.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_NOTIFY, (union uni_ieall *)&out->notify, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_EETD: + out->eetd.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_EETD, (union uni_ieall *)&out->eetd, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CONNED: + out->conned.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CONNED, (union uni_ieall *)&out->conned, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CONNEDSUB: + out->connedsub.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CONNEDSUB, (union uni_ieall *)&out->connedsub, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_UU: + if (!(!cx->pnni)) + return (DEC_ILL); + out->uu.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UU, (union uni_ieall *)&out->uu, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_GIT: + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if (!IE_ISPRESENT(out->git[i])) { + out->git[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_GIT, (union uni_ieall *)&out->git[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_CALLED_SOFT: + if (!(cx->pnni)) + return (DEC_ILL); + out->called_soft.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CALLED_SOFT, (union uni_ieall *)&out->called_soft, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_UNREC: + out->unrec.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UNREC, (union uni_ieall *)&out->unrec, msg, ielen, cx)) + return (DEC_ERR); + break; + + default: + return (DEC_ILL); + } + return (DEC_OK); +} + +static const struct msgdecl decl_add_party_ack = { + 0, + "add_party_ack", + (uni_msg_print_f)print_add_party_ack, + (uni_msg_check_f)check_add_party_ack, + (uni_msg_encode_f)encode_add_party_ack, + (uni_msg_decode_f)decode_add_party_ack +}; + +static void +print_party_alerting(struct uni_party_alerting *msg, struct unicx *cx) +{ + u_int i; + + if(msg->epref.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_EPREF, (union uni_ieall *)&msg->epref, cx); + if(msg->notify.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_NOTIFY, (union uni_ieall *)&msg->notify, cx); + if(msg->uu.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UU, (union uni_ieall *)&msg->uu, cx); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if(msg->git[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_GIT, (union uni_ieall *)&msg->git[i], cx); + if(msg->unrec.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UNREC, (union uni_ieall *)&msg->unrec, cx); +} + +static int +check_party_alerting(struct uni_party_alerting *m, struct unicx *cx) +{ + int ret = 0; + u_int i; + + ret |= uni_check_ie(UNI_IE_EPREF, (union uni_ieall *)&m->epref, cx); + ret |= uni_check_ie(UNI_IE_NOTIFY, (union uni_ieall *)&m->notify, cx); + if(!(!cx->pnni)) + ret |= IE_ISPRESENT(m->uu); + else + ret |= uni_check_ie(UNI_IE_UU, (union uni_ieall *)&m->uu, cx); + for(i = 0; i < UNI_NUM_IE_GIT ; i++) { + ret |= uni_check_ie(UNI_IE_GIT, (union uni_ieall *)&m->git[i], cx); + } + ret |= uni_check_ie(UNI_IE_UNREC, (union uni_ieall *)&m->unrec, cx); + + return ret; +} + +static int +encode_party_alerting(struct uni_msg *msg, struct uni_party_alerting *p, struct unicx *cx) +{ + u_int mlen; + u_int i; + + if(uni_encode_msg_hdr(msg, &p->hdr, UNI_PARTY_ALERTING, cx, &mlen)) + return (-2); + + if((p->epref.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_EPREF, msg, (union uni_ieall *)&p->epref, cx)) + return (UNI_IE_EPREF); + if((p->notify.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_NOTIFY, msg, (union uni_ieall *)&p->notify, cx)) + return (UNI_IE_NOTIFY); + if((p->uu.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UU, msg, (union uni_ieall *)&p->uu, cx)) + return (UNI_IE_UU); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if((p->git[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_GIT, msg, (union uni_ieall *)&p->git[i], cx)) + return ((i << 16) + UNI_IE_GIT); + if((p->unrec.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UNREC, msg, (union uni_ieall *)&p->unrec, cx)) + return (UNI_IE_UNREC); + + msg->b_buf[mlen+0] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 8; + msg->b_buf[mlen+1] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 0; + + return (0); +} + +static int +decode_party_alerting(struct uni_party_alerting *out, struct uni_msg *msg, + enum uni_ietype ie, struct uni_iehdr *hdr, u_int ielen, + struct unicx *cx) +{ + u_int i; + + switch (ie) { + + case UNI_IE_EPREF: + out->epref.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_EPREF, (union uni_ieall *)&out->epref, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_NOTIFY: + out->notify.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_NOTIFY, (union uni_ieall *)&out->notify, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_UU: + if (!(!cx->pnni)) + return (DEC_ILL); + out->uu.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UU, (union uni_ieall *)&out->uu, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_GIT: + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if (!IE_ISPRESENT(out->git[i])) { + out->git[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_GIT, (union uni_ieall *)&out->git[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_UNREC: + out->unrec.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UNREC, (union uni_ieall *)&out->unrec, msg, ielen, cx)) + return (DEC_ERR); + break; + + default: + return (DEC_ILL); + } + return (DEC_OK); +} + +static const struct msgdecl decl_party_alerting = { + 0, + "party_alerting", + (uni_msg_print_f)print_party_alerting, + (uni_msg_check_f)check_party_alerting, + (uni_msg_encode_f)encode_party_alerting, + (uni_msg_decode_f)decode_party_alerting +}; + +static void +print_add_party_rej(struct uni_add_party_rej *msg, struct unicx *cx) +{ + u_int i; + + if(msg->cause.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CAUSE, (union uni_ieall *)&msg->cause, cx); + if(msg->epref.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_EPREF, (union uni_ieall *)&msg->epref, cx); + if(msg->uu.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UU, (union uni_ieall *)&msg->uu, cx); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if(msg->git[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_GIT, (union uni_ieall *)&msg->git[i], cx); + if(msg->crankback.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CRANKBACK, (union uni_ieall *)&msg->crankback, cx); + if(msg->unrec.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UNREC, (union uni_ieall *)&msg->unrec, cx); +} + +static int +check_add_party_rej(struct uni_add_party_rej *m, struct unicx *cx) +{ + int ret = 0; + u_int i; + + ret |= uni_check_ie(UNI_IE_CAUSE, (union uni_ieall *)&m->cause, cx); + ret |= uni_check_ie(UNI_IE_EPREF, (union uni_ieall *)&m->epref, cx); + if(!(!cx->pnni)) + ret |= IE_ISPRESENT(m->uu); + else + ret |= uni_check_ie(UNI_IE_UU, (union uni_ieall *)&m->uu, cx); + for(i = 0; i < UNI_NUM_IE_GIT ; i++) { + ret |= uni_check_ie(UNI_IE_GIT, (union uni_ieall *)&m->git[i], cx); + } + if(!(cx->pnni)) + ret |= IE_ISPRESENT(m->crankback); + else + ret |= uni_check_ie(UNI_IE_CRANKBACK, (union uni_ieall *)&m->crankback, cx); + ret |= uni_check_ie(UNI_IE_UNREC, (union uni_ieall *)&m->unrec, cx); + + return ret; +} + +static int +encode_add_party_rej(struct uni_msg *msg, struct uni_add_party_rej *p, struct unicx *cx) +{ + u_int mlen; + u_int i; + + if(uni_encode_msg_hdr(msg, &p->hdr, UNI_ADD_PARTY_REJ, cx, &mlen)) + return (-2); + + if((p->cause.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CAUSE, msg, (union uni_ieall *)&p->cause, cx)) + return (UNI_IE_CAUSE); + if((p->epref.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_EPREF, msg, (union uni_ieall *)&p->epref, cx)) + return (UNI_IE_EPREF); + if((p->uu.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UU, msg, (union uni_ieall *)&p->uu, cx)) + return (UNI_IE_UU); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if((p->git[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_GIT, msg, (union uni_ieall *)&p->git[i], cx)) + return ((i << 16) + UNI_IE_GIT); + if((p->crankback.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CRANKBACK, msg, (union uni_ieall *)&p->crankback, cx)) + return (UNI_IE_CRANKBACK); + if((p->unrec.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UNREC, msg, (union uni_ieall *)&p->unrec, cx)) + return (UNI_IE_UNREC); + + msg->b_buf[mlen+0] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 8; + msg->b_buf[mlen+1] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 0; + + return (0); +} + +static int +decode_add_party_rej(struct uni_add_party_rej *out, struct uni_msg *msg, + enum uni_ietype ie, struct uni_iehdr *hdr, u_int ielen, + struct unicx *cx) +{ + u_int i; + + switch (ie) { + + case UNI_IE_CAUSE: + out->cause.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CAUSE, (union uni_ieall *)&out->cause, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_EPREF: + out->epref.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_EPREF, (union uni_ieall *)&out->epref, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_UU: + if (!(!cx->pnni)) + return (DEC_ILL); + out->uu.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UU, (union uni_ieall *)&out->uu, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_GIT: + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if (!IE_ISPRESENT(out->git[i])) { + out->git[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_GIT, (union uni_ieall *)&out->git[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_CRANKBACK: + if (!(cx->pnni)) + return (DEC_ILL); + out->crankback.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CRANKBACK, (union uni_ieall *)&out->crankback, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_UNREC: + out->unrec.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UNREC, (union uni_ieall *)&out->unrec, msg, ielen, cx)) + return (DEC_ERR); + break; + + default: + return (DEC_ILL); + } + return (DEC_OK); +} + +static const struct msgdecl decl_add_party_rej = { + 0, + "add_party_rej", + (uni_msg_print_f)print_add_party_rej, + (uni_msg_check_f)check_add_party_rej, + (uni_msg_encode_f)encode_add_party_rej, + (uni_msg_decode_f)decode_add_party_rej +}; + +static void +print_drop_party(struct uni_drop_party *msg, struct unicx *cx) +{ + u_int i; + + if(msg->cause.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CAUSE, (union uni_ieall *)&msg->cause, cx); + if(msg->epref.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_EPREF, (union uni_ieall *)&msg->epref, cx); + if(msg->notify.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_NOTIFY, (union uni_ieall *)&msg->notify, cx); + if(msg->uu.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UU, (union uni_ieall *)&msg->uu, cx); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if(msg->git[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_GIT, (union uni_ieall *)&msg->git[i], cx); + if(msg->unrec.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UNREC, (union uni_ieall *)&msg->unrec, cx); +} + +static int +check_drop_party(struct uni_drop_party *m, struct unicx *cx) +{ + int ret = 0; + u_int i; + + ret |= uni_check_ie(UNI_IE_CAUSE, (union uni_ieall *)&m->cause, cx); + ret |= uni_check_ie(UNI_IE_EPREF, (union uni_ieall *)&m->epref, cx); + ret |= uni_check_ie(UNI_IE_NOTIFY, (union uni_ieall *)&m->notify, cx); + if(!(!cx->pnni)) + ret |= IE_ISPRESENT(m->uu); + else + ret |= uni_check_ie(UNI_IE_UU, (union uni_ieall *)&m->uu, cx); + for(i = 0; i < UNI_NUM_IE_GIT ; i++) { + ret |= uni_check_ie(UNI_IE_GIT, (union uni_ieall *)&m->git[i], cx); + } + ret |= uni_check_ie(UNI_IE_UNREC, (union uni_ieall *)&m->unrec, cx); + + return ret; +} + +static int +encode_drop_party(struct uni_msg *msg, struct uni_drop_party *p, struct unicx *cx) +{ + u_int mlen; + u_int i; + + if(uni_encode_msg_hdr(msg, &p->hdr, UNI_DROP_PARTY, cx, &mlen)) + return (-2); + + if((p->cause.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CAUSE, msg, (union uni_ieall *)&p->cause, cx)) + return (UNI_IE_CAUSE); + if((p->epref.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_EPREF, msg, (union uni_ieall *)&p->epref, cx)) + return (UNI_IE_EPREF); + if((p->notify.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_NOTIFY, msg, (union uni_ieall *)&p->notify, cx)) + return (UNI_IE_NOTIFY); + if((p->uu.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UU, msg, (union uni_ieall *)&p->uu, cx)) + return (UNI_IE_UU); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if((p->git[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_GIT, msg, (union uni_ieall *)&p->git[i], cx)) + return ((i << 16) + UNI_IE_GIT); + if((p->unrec.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UNREC, msg, (union uni_ieall *)&p->unrec, cx)) + return (UNI_IE_UNREC); + + msg->b_buf[mlen+0] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 8; + msg->b_buf[mlen+1] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 0; + + return (0); +} + +static int +decode_drop_party(struct uni_drop_party *out, struct uni_msg *msg, + enum uni_ietype ie, struct uni_iehdr *hdr, u_int ielen, + struct unicx *cx) +{ + u_int i; + + switch (ie) { + + case UNI_IE_CAUSE: + out->cause.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CAUSE, (union uni_ieall *)&out->cause, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_EPREF: + out->epref.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_EPREF, (union uni_ieall *)&out->epref, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_NOTIFY: + out->notify.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_NOTIFY, (union uni_ieall *)&out->notify, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_UU: + if (!(!cx->pnni)) + return (DEC_ILL); + out->uu.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UU, (union uni_ieall *)&out->uu, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_GIT: + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if (!IE_ISPRESENT(out->git[i])) { + out->git[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_GIT, (union uni_ieall *)&out->git[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_UNREC: + out->unrec.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UNREC, (union uni_ieall *)&out->unrec, msg, ielen, cx)) + return (DEC_ERR); + break; + + default: + return (DEC_ILL); + } + return (DEC_OK); +} + +static const struct msgdecl decl_drop_party = { + 0, + "drop_party", + (uni_msg_print_f)print_drop_party, + (uni_msg_check_f)check_drop_party, + (uni_msg_encode_f)encode_drop_party, + (uni_msg_decode_f)decode_drop_party +}; + +static void +print_drop_party_ack(struct uni_drop_party_ack *msg, struct unicx *cx) +{ + u_int i; + + if(msg->epref.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_EPREF, (union uni_ieall *)&msg->epref, cx); + if(msg->cause.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CAUSE, (union uni_ieall *)&msg->cause, cx); + if(msg->uu.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UU, (union uni_ieall *)&msg->uu, cx); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if(msg->git[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_GIT, (union uni_ieall *)&msg->git[i], cx); + if(msg->unrec.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UNREC, (union uni_ieall *)&msg->unrec, cx); +} + +static int +check_drop_party_ack(struct uni_drop_party_ack *m, struct unicx *cx) +{ + int ret = 0; + u_int i; + + ret |= uni_check_ie(UNI_IE_EPREF, (union uni_ieall *)&m->epref, cx); + ret |= uni_check_ie(UNI_IE_CAUSE, (union uni_ieall *)&m->cause, cx); + if(!(!cx->pnni)) + ret |= IE_ISPRESENT(m->uu); + else + ret |= uni_check_ie(UNI_IE_UU, (union uni_ieall *)&m->uu, cx); + for(i = 0; i < UNI_NUM_IE_GIT ; i++) { + ret |= uni_check_ie(UNI_IE_GIT, (union uni_ieall *)&m->git[i], cx); + } + ret |= uni_check_ie(UNI_IE_UNREC, (union uni_ieall *)&m->unrec, cx); + + return ret; +} + +static int +encode_drop_party_ack(struct uni_msg *msg, struct uni_drop_party_ack *p, struct unicx *cx) +{ + u_int mlen; + u_int i; + + if(uni_encode_msg_hdr(msg, &p->hdr, UNI_DROP_PARTY_ACK, cx, &mlen)) + return (-2); + + if((p->epref.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_EPREF, msg, (union uni_ieall *)&p->epref, cx)) + return (UNI_IE_EPREF); + if((p->cause.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CAUSE, msg, (union uni_ieall *)&p->cause, cx)) + return (UNI_IE_CAUSE); + if((p->uu.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UU, msg, (union uni_ieall *)&p->uu, cx)) + return (UNI_IE_UU); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if((p->git[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_GIT, msg, (union uni_ieall *)&p->git[i], cx)) + return ((i << 16) + UNI_IE_GIT); + if((p->unrec.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UNREC, msg, (union uni_ieall *)&p->unrec, cx)) + return (UNI_IE_UNREC); + + msg->b_buf[mlen+0] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 8; + msg->b_buf[mlen+1] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 0; + + return (0); +} + +static int +decode_drop_party_ack(struct uni_drop_party_ack *out, struct uni_msg *msg, + enum uni_ietype ie, struct uni_iehdr *hdr, u_int ielen, + struct unicx *cx) +{ + u_int i; + + switch (ie) { + + case UNI_IE_EPREF: + out->epref.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_EPREF, (union uni_ieall *)&out->epref, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CAUSE: + out->cause.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CAUSE, (union uni_ieall *)&out->cause, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_UU: + if (!(!cx->pnni)) + return (DEC_ILL); + out->uu.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UU, (union uni_ieall *)&out->uu, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_GIT: + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if (!IE_ISPRESENT(out->git[i])) { + out->git[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_GIT, (union uni_ieall *)&out->git[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_UNREC: + out->unrec.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UNREC, (union uni_ieall *)&out->unrec, msg, ielen, cx)) + return (DEC_ERR); + break; + + default: + return (DEC_ILL); + } + return (DEC_OK); +} + +static const struct msgdecl decl_drop_party_ack = { + 0, + "drop_party_ack", + (uni_msg_print_f)print_drop_party_ack, + (uni_msg_check_f)check_drop_party_ack, + (uni_msg_encode_f)encode_drop_party_ack, + (uni_msg_decode_f)decode_drop_party_ack +}; + +static void +print_leaf_setup_req(struct uni_leaf_setup_req *msg, struct unicx *cx) +{ + u_int i; + + for(i = 0; i < UNI_NUM_IE_TNS; i++) + if(msg->tns[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_TNS, (union uni_ieall *)&msg->tns[i], cx); + if(msg->calling.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CALLING, (union uni_ieall *)&msg->calling, cx); + for(i = 0; i < UNI_NUM_IE_CALLINGSUB; i++) + if(msg->callingsub[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CALLINGSUB, (union uni_ieall *)&msg->callingsub[i], cx); + if(msg->called.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CALLED, (union uni_ieall *)&msg->called, cx); + for(i = 0; i < UNI_NUM_IE_CALLEDSUB; i++) + if(msg->calledsub[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CALLEDSUB, (union uni_ieall *)&msg->calledsub[i], cx); + if(msg->lij_callid.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_LIJ_CALLID, (union uni_ieall *)&msg->lij_callid, cx); + if(msg->lij_seqno.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_LIJ_SEQNO, (union uni_ieall *)&msg->lij_seqno, cx); + if(msg->unrec.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UNREC, (union uni_ieall *)&msg->unrec, cx); +} + +static int +check_leaf_setup_req(struct uni_leaf_setup_req *m, struct unicx *cx) +{ + int ret = 0; + u_int i; + + for(i = 0; i < UNI_NUM_IE_TNS ; i++) { + ret |= uni_check_ie(UNI_IE_TNS, (union uni_ieall *)&m->tns[i], cx); + } + ret |= uni_check_ie(UNI_IE_CALLING, (union uni_ieall *)&m->calling, cx); + for(i = 0; i < UNI_NUM_IE_CALLINGSUB ; i++) { + ret |= uni_check_ie(UNI_IE_CALLINGSUB, (union uni_ieall *)&m->callingsub[i], cx); + } + ret |= uni_check_ie(UNI_IE_CALLED, (union uni_ieall *)&m->called, cx); + for(i = 0; i < UNI_NUM_IE_CALLEDSUB ; i++) { + ret |= uni_check_ie(UNI_IE_CALLEDSUB, (union uni_ieall *)&m->calledsub[i], cx); + } + ret |= uni_check_ie(UNI_IE_LIJ_CALLID, (union uni_ieall *)&m->lij_callid, cx); + ret |= uni_check_ie(UNI_IE_LIJ_SEQNO, (union uni_ieall *)&m->lij_seqno, cx); + ret |= uni_check_ie(UNI_IE_UNREC, (union uni_ieall *)&m->unrec, cx); + + return ret; +} + +static int +encode_leaf_setup_req(struct uni_msg *msg, struct uni_leaf_setup_req *p, struct unicx *cx) +{ + u_int mlen; + u_int i; + + if(uni_encode_msg_hdr(msg, &p->hdr, UNI_LEAF_SETUP_REQ, cx, &mlen)) + return (-2); + + for(i = 0; i < UNI_NUM_IE_TNS; i++) + if((p->tns[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_TNS, msg, (union uni_ieall *)&p->tns[i], cx)) + return ((i << 16) + UNI_IE_TNS); + if((p->calling.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CALLING, msg, (union uni_ieall *)&p->calling, cx)) + return (UNI_IE_CALLING); + for(i = 0; i < UNI_NUM_IE_CALLINGSUB; i++) + if((p->callingsub[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CALLINGSUB, msg, (union uni_ieall *)&p->callingsub[i], cx)) + return ((i << 16) + UNI_IE_CALLINGSUB); + if((p->called.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CALLED, msg, (union uni_ieall *)&p->called, cx)) + return (UNI_IE_CALLED); + for(i = 0; i < UNI_NUM_IE_CALLEDSUB; i++) + if((p->calledsub[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CALLEDSUB, msg, (union uni_ieall *)&p->calledsub[i], cx)) + return ((i << 16) + UNI_IE_CALLEDSUB); + if((p->lij_callid.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_LIJ_CALLID, msg, (union uni_ieall *)&p->lij_callid, cx)) + return (UNI_IE_LIJ_CALLID); + if((p->lij_seqno.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_LIJ_SEQNO, msg, (union uni_ieall *)&p->lij_seqno, cx)) + return (UNI_IE_LIJ_SEQNO); + if((p->unrec.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UNREC, msg, (union uni_ieall *)&p->unrec, cx)) + return (UNI_IE_UNREC); + + msg->b_buf[mlen+0] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 8; + msg->b_buf[mlen+1] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 0; + + return (0); +} + +static int +decode_leaf_setup_req(struct uni_leaf_setup_req *out, struct uni_msg *msg, + enum uni_ietype ie, struct uni_iehdr *hdr, u_int ielen, + struct unicx *cx) +{ + u_int i; + + switch (ie) { + + case UNI_IE_TNS: + for(i = 0; i < UNI_NUM_IE_TNS; i++) + if (!IE_ISPRESENT(out->tns[i])) { + out->tns[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_TNS, (union uni_ieall *)&out->tns[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_CALLING: + out->calling.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CALLING, (union uni_ieall *)&out->calling, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CALLINGSUB: + for(i = 0; i < UNI_NUM_IE_CALLINGSUB; i++) + if (!IE_ISPRESENT(out->callingsub[i])) { + out->callingsub[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CALLINGSUB, (union uni_ieall *)&out->callingsub[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_CALLED: + out->called.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CALLED, (union uni_ieall *)&out->called, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CALLEDSUB: + for(i = 0; i < UNI_NUM_IE_CALLEDSUB; i++) + if (!IE_ISPRESENT(out->calledsub[i])) { + out->calledsub[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CALLEDSUB, (union uni_ieall *)&out->calledsub[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_LIJ_CALLID: + out->lij_callid.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_LIJ_CALLID, (union uni_ieall *)&out->lij_callid, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_LIJ_SEQNO: + out->lij_seqno.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_LIJ_SEQNO, (union uni_ieall *)&out->lij_seqno, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_UNREC: + out->unrec.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UNREC, (union uni_ieall *)&out->unrec, msg, ielen, cx)) + return (DEC_ERR); + break; + + default: + return (DEC_ILL); + } + return (DEC_OK); +} + +static const struct msgdecl decl_leaf_setup_req = { + 0, + "leaf_setup_req", + (uni_msg_print_f)print_leaf_setup_req, + (uni_msg_check_f)check_leaf_setup_req, + (uni_msg_encode_f)encode_leaf_setup_req, + (uni_msg_decode_f)decode_leaf_setup_req +}; + +static void +print_leaf_setup_fail(struct uni_leaf_setup_fail *msg, struct unicx *cx) +{ + u_int i; + + if(msg->cause.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CAUSE, (union uni_ieall *)&msg->cause, cx); + if(msg->called.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CALLED, (union uni_ieall *)&msg->called, cx); + if(msg->calledsub.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CALLEDSUB, (union uni_ieall *)&msg->calledsub, cx); + if(msg->lij_seqno.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_LIJ_SEQNO, (union uni_ieall *)&msg->lij_seqno, cx); + for(i = 0; i < UNI_NUM_IE_TNS; i++) + if(msg->tns[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_TNS, (union uni_ieall *)&msg->tns[i], cx); + if(msg->unrec.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UNREC, (union uni_ieall *)&msg->unrec, cx); +} + +static int +check_leaf_setup_fail(struct uni_leaf_setup_fail *m, struct unicx *cx) +{ + int ret = 0; + u_int i; + + ret |= uni_check_ie(UNI_IE_CAUSE, (union uni_ieall *)&m->cause, cx); + ret |= uni_check_ie(UNI_IE_CALLED, (union uni_ieall *)&m->called, cx); + ret |= uni_check_ie(UNI_IE_CALLEDSUB, (union uni_ieall *)&m->calledsub, cx); + ret |= uni_check_ie(UNI_IE_LIJ_SEQNO, (union uni_ieall *)&m->lij_seqno, cx); + for(i = 0; i < UNI_NUM_IE_TNS ; i++) { + ret |= uni_check_ie(UNI_IE_TNS, (union uni_ieall *)&m->tns[i], cx); + } + ret |= uni_check_ie(UNI_IE_UNREC, (union uni_ieall *)&m->unrec, cx); + + return ret; +} + +static int +encode_leaf_setup_fail(struct uni_msg *msg, struct uni_leaf_setup_fail *p, struct unicx *cx) +{ + u_int mlen; + u_int i; + + if(uni_encode_msg_hdr(msg, &p->hdr, UNI_LEAF_SETUP_FAIL, cx, &mlen)) + return (-2); + + if((p->cause.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CAUSE, msg, (union uni_ieall *)&p->cause, cx)) + return (UNI_IE_CAUSE); + if((p->called.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CALLED, msg, (union uni_ieall *)&p->called, cx)) + return (UNI_IE_CALLED); + if((p->calledsub.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CALLEDSUB, msg, (union uni_ieall *)&p->calledsub, cx)) + return (UNI_IE_CALLEDSUB); + if((p->lij_seqno.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_LIJ_SEQNO, msg, (union uni_ieall *)&p->lij_seqno, cx)) + return (UNI_IE_LIJ_SEQNO); + for(i = 0; i < UNI_NUM_IE_TNS; i++) + if((p->tns[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_TNS, msg, (union uni_ieall *)&p->tns[i], cx)) + return ((i << 16) + UNI_IE_TNS); + if((p->unrec.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UNREC, msg, (union uni_ieall *)&p->unrec, cx)) + return (UNI_IE_UNREC); + + msg->b_buf[mlen+0] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 8; + msg->b_buf[mlen+1] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 0; + + return (0); +} + +static int +decode_leaf_setup_fail(struct uni_leaf_setup_fail *out, struct uni_msg *msg, + enum uni_ietype ie, struct uni_iehdr *hdr, u_int ielen, + struct unicx *cx) +{ + u_int i; + + switch (ie) { + + case UNI_IE_CAUSE: + out->cause.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CAUSE, (union uni_ieall *)&out->cause, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CALLED: + out->called.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CALLED, (union uni_ieall *)&out->called, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CALLEDSUB: + out->calledsub.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CALLEDSUB, (union uni_ieall *)&out->calledsub, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_LIJ_SEQNO: + out->lij_seqno.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_LIJ_SEQNO, (union uni_ieall *)&out->lij_seqno, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_TNS: + for(i = 0; i < UNI_NUM_IE_TNS; i++) + if (!IE_ISPRESENT(out->tns[i])) { + out->tns[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_TNS, (union uni_ieall *)&out->tns[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_UNREC: + out->unrec.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UNREC, (union uni_ieall *)&out->unrec, msg, ielen, cx)) + return (DEC_ERR); + break; + + default: + return (DEC_ILL); + } + return (DEC_OK); +} + +static const struct msgdecl decl_leaf_setup_fail = { + 0, + "leaf_setup_fail", + (uni_msg_print_f)print_leaf_setup_fail, + (uni_msg_check_f)check_leaf_setup_fail, + (uni_msg_encode_f)encode_leaf_setup_fail, + (uni_msg_decode_f)decode_leaf_setup_fail +}; + +static void +print_cobisetup(struct uni_cobisetup *msg, struct unicx *cx) +{ + if(msg->facility.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_FACILITY, (union uni_ieall *)&msg->facility, cx); + if(msg->called.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CALLED, (union uni_ieall *)&msg->called, cx); + if(msg->calledsub.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CALLEDSUB, (union uni_ieall *)&msg->calledsub, cx); + if(msg->calling.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CALLING, (union uni_ieall *)&msg->calling, cx); + if(msg->notify.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_NOTIFY, (union uni_ieall *)&msg->notify, cx); + if(msg->unrec.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UNREC, (union uni_ieall *)&msg->unrec, cx); +} + +static int +check_cobisetup(struct uni_cobisetup *m, struct unicx *cx) +{ + int ret = 0; + + ret |= uni_check_ie(UNI_IE_FACILITY, (union uni_ieall *)&m->facility, cx); + ret |= uni_check_ie(UNI_IE_CALLED, (union uni_ieall *)&m->called, cx); + ret |= uni_check_ie(UNI_IE_CALLEDSUB, (union uni_ieall *)&m->calledsub, cx); + ret |= uni_check_ie(UNI_IE_CALLING, (union uni_ieall *)&m->calling, cx); + ret |= uni_check_ie(UNI_IE_NOTIFY, (union uni_ieall *)&m->notify, cx); + ret |= uni_check_ie(UNI_IE_UNREC, (union uni_ieall *)&m->unrec, cx); + + return ret; +} + +static int +encode_cobisetup(struct uni_msg *msg, struct uni_cobisetup *p, struct unicx *cx) +{ + u_int mlen; + + if(uni_encode_msg_hdr(msg, &p->hdr, UNI_COBISETUP, cx, &mlen)) + return (-2); + + if((p->facility.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_FACILITY, msg, (union uni_ieall *)&p->facility, cx)) + return (UNI_IE_FACILITY); + if((p->called.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CALLED, msg, (union uni_ieall *)&p->called, cx)) + return (UNI_IE_CALLED); + if((p->calledsub.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CALLEDSUB, msg, (union uni_ieall *)&p->calledsub, cx)) + return (UNI_IE_CALLEDSUB); + if((p->calling.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CALLING, msg, (union uni_ieall *)&p->calling, cx)) + return (UNI_IE_CALLING); + if((p->notify.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_NOTIFY, msg, (union uni_ieall *)&p->notify, cx)) + return (UNI_IE_NOTIFY); + if((p->unrec.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UNREC, msg, (union uni_ieall *)&p->unrec, cx)) + return (UNI_IE_UNREC); + + msg->b_buf[mlen+0] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 8; + msg->b_buf[mlen+1] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 0; + + return (0); +} + +static int +decode_cobisetup(struct uni_cobisetup *out, struct uni_msg *msg, + enum uni_ietype ie, struct uni_iehdr *hdr, u_int ielen, + struct unicx *cx) +{ + switch (ie) { + + case UNI_IE_FACILITY: + out->facility.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_FACILITY, (union uni_ieall *)&out->facility, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CALLED: + out->called.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CALLED, (union uni_ieall *)&out->called, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CALLEDSUB: + out->calledsub.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CALLEDSUB, (union uni_ieall *)&out->calledsub, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CALLING: + out->calling.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CALLING, (union uni_ieall *)&out->calling, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_NOTIFY: + out->notify.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_NOTIFY, (union uni_ieall *)&out->notify, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_UNREC: + out->unrec.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UNREC, (union uni_ieall *)&out->unrec, msg, ielen, cx)) + return (DEC_ERR); + break; + + default: + return (DEC_ILL); + } + return (DEC_OK); +} + +static const struct msgdecl decl_cobisetup = { + 0, + "cobisetup", + (uni_msg_print_f)print_cobisetup, + (uni_msg_check_f)check_cobisetup, + (uni_msg_encode_f)encode_cobisetup, + (uni_msg_decode_f)decode_cobisetup +}; + +static void +print_facility(struct uni_facility *msg, struct unicx *cx) +{ + if(msg->facility.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_FACILITY, (union uni_ieall *)&msg->facility, cx); + if(msg->called.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CALLED, (union uni_ieall *)&msg->called, cx); + if(msg->calledsub.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CALLEDSUB, (union uni_ieall *)&msg->calledsub, cx); + if(msg->calling.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CALLING, (union uni_ieall *)&msg->calling, cx); + if(msg->notify.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_NOTIFY, (union uni_ieall *)&msg->notify, cx); + if(msg->unrec.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UNREC, (union uni_ieall *)&msg->unrec, cx); +} + +static int +check_facility(struct uni_facility *m, struct unicx *cx) +{ + int ret = 0; + + ret |= uni_check_ie(UNI_IE_FACILITY, (union uni_ieall *)&m->facility, cx); + ret |= uni_check_ie(UNI_IE_CALLED, (union uni_ieall *)&m->called, cx); + ret |= uni_check_ie(UNI_IE_CALLEDSUB, (union uni_ieall *)&m->calledsub, cx); + ret |= uni_check_ie(UNI_IE_CALLING, (union uni_ieall *)&m->calling, cx); + ret |= uni_check_ie(UNI_IE_NOTIFY, (union uni_ieall *)&m->notify, cx); + ret |= uni_check_ie(UNI_IE_UNREC, (union uni_ieall *)&m->unrec, cx); + + return ret; +} + +static int +encode_facility(struct uni_msg *msg, struct uni_facility *p, struct unicx *cx) +{ + u_int mlen; + + if(uni_encode_msg_hdr(msg, &p->hdr, UNI_FACILITY, cx, &mlen)) + return (-2); + + if((p->facility.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_FACILITY, msg, (union uni_ieall *)&p->facility, cx)) + return (UNI_IE_FACILITY); + if((p->called.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CALLED, msg, (union uni_ieall *)&p->called, cx)) + return (UNI_IE_CALLED); + if((p->calledsub.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CALLEDSUB, msg, (union uni_ieall *)&p->calledsub, cx)) + return (UNI_IE_CALLEDSUB); + if((p->calling.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CALLING, msg, (union uni_ieall *)&p->calling, cx)) + return (UNI_IE_CALLING); + if((p->notify.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_NOTIFY, msg, (union uni_ieall *)&p->notify, cx)) + return (UNI_IE_NOTIFY); + if((p->unrec.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UNREC, msg, (union uni_ieall *)&p->unrec, cx)) + return (UNI_IE_UNREC); + + msg->b_buf[mlen+0] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 8; + msg->b_buf[mlen+1] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 0; + + return (0); +} + +static int +decode_facility(struct uni_facility *out, struct uni_msg *msg, + enum uni_ietype ie, struct uni_iehdr *hdr, u_int ielen, + struct unicx *cx) +{ + switch (ie) { + + case UNI_IE_FACILITY: + out->facility.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_FACILITY, (union uni_ieall *)&out->facility, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CALLED: + out->called.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CALLED, (union uni_ieall *)&out->called, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CALLEDSUB: + out->calledsub.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CALLEDSUB, (union uni_ieall *)&out->calledsub, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_CALLING: + out->calling.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CALLING, (union uni_ieall *)&out->calling, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_NOTIFY: + out->notify.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_NOTIFY, (union uni_ieall *)&out->notify, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_UNREC: + out->unrec.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UNREC, (union uni_ieall *)&out->unrec, msg, ielen, cx)) + return (DEC_ERR); + break; + + default: + return (DEC_ILL); + } + return (DEC_OK); +} + +static const struct msgdecl decl_facility = { + 0, + "facility", + (uni_msg_print_f)print_facility, + (uni_msg_check_f)check_facility, + (uni_msg_encode_f)encode_facility, + (uni_msg_decode_f)decode_facility +}; + +static void +print_modify_req(struct uni_modify_req *msg, struct unicx *cx) +{ + u_int i; + + if(msg->traffic.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_TRAFFIC, (union uni_ieall *)&msg->traffic, cx); + if(msg->atraffic.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_ATRAFFIC, (union uni_ieall *)&msg->atraffic, cx); + if(msg->mintraffic.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_MINTRAFFIC, (union uni_ieall *)&msg->mintraffic, cx); + if(msg->notify.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_NOTIFY, (union uni_ieall *)&msg->notify, cx); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if(msg->git[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_GIT, (union uni_ieall *)&msg->git[i], cx); + if(msg->unrec.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UNREC, (union uni_ieall *)&msg->unrec, cx); +} + +static int +check_modify_req(struct uni_modify_req *m, struct unicx *cx) +{ + int ret = 0; + u_int i; + + ret |= uni_check_ie(UNI_IE_TRAFFIC, (union uni_ieall *)&m->traffic, cx); + ret |= uni_check_ie(UNI_IE_ATRAFFIC, (union uni_ieall *)&m->atraffic, cx); + ret |= uni_check_ie(UNI_IE_MINTRAFFIC, (union uni_ieall *)&m->mintraffic, cx); + ret |= uni_check_ie(UNI_IE_NOTIFY, (union uni_ieall *)&m->notify, cx); + for(i = 0; i < UNI_NUM_IE_GIT ; i++) { + ret |= uni_check_ie(UNI_IE_GIT, (union uni_ieall *)&m->git[i], cx); + } + ret |= uni_check_ie(UNI_IE_UNREC, (union uni_ieall *)&m->unrec, cx); + + return ret; +} + +static int +encode_modify_req(struct uni_msg *msg, struct uni_modify_req *p, struct unicx *cx) +{ + u_int mlen; + u_int i; + + if(uni_encode_msg_hdr(msg, &p->hdr, UNI_MODIFY_REQ, cx, &mlen)) + return (-2); + + if((p->traffic.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_TRAFFIC, msg, (union uni_ieall *)&p->traffic, cx)) + return (UNI_IE_TRAFFIC); + if((p->atraffic.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_ATRAFFIC, msg, (union uni_ieall *)&p->atraffic, cx)) + return (UNI_IE_ATRAFFIC); + if((p->mintraffic.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_MINTRAFFIC, msg, (union uni_ieall *)&p->mintraffic, cx)) + return (UNI_IE_MINTRAFFIC); + if((p->notify.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_NOTIFY, msg, (union uni_ieall *)&p->notify, cx)) + return (UNI_IE_NOTIFY); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if((p->git[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_GIT, msg, (union uni_ieall *)&p->git[i], cx)) + return ((i << 16) + UNI_IE_GIT); + if((p->unrec.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UNREC, msg, (union uni_ieall *)&p->unrec, cx)) + return (UNI_IE_UNREC); + + msg->b_buf[mlen+0] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 8; + msg->b_buf[mlen+1] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 0; + + return (0); +} + +static int +decode_modify_req(struct uni_modify_req *out, struct uni_msg *msg, + enum uni_ietype ie, struct uni_iehdr *hdr, u_int ielen, + struct unicx *cx) +{ + u_int i; + + switch (ie) { + + case UNI_IE_TRAFFIC: + out->traffic.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_TRAFFIC, (union uni_ieall *)&out->traffic, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_ATRAFFIC: + out->atraffic.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_ATRAFFIC, (union uni_ieall *)&out->atraffic, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_MINTRAFFIC: + out->mintraffic.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_MINTRAFFIC, (union uni_ieall *)&out->mintraffic, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_NOTIFY: + out->notify.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_NOTIFY, (union uni_ieall *)&out->notify, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_GIT: + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if (!IE_ISPRESENT(out->git[i])) { + out->git[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_GIT, (union uni_ieall *)&out->git[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_UNREC: + out->unrec.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UNREC, (union uni_ieall *)&out->unrec, msg, ielen, cx)) + return (DEC_ERR); + break; + + default: + return (DEC_ILL); + } + return (DEC_OK); +} + +static const struct msgdecl decl_modify_req = { + 0, + "modify_req", + (uni_msg_print_f)print_modify_req, + (uni_msg_check_f)check_modify_req, + (uni_msg_encode_f)encode_modify_req, + (uni_msg_decode_f)decode_modify_req +}; + +static void +print_modify_ack(struct uni_modify_ack *msg, struct unicx *cx) +{ + u_int i; + + if(msg->report.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_REPORT, (union uni_ieall *)&msg->report, cx); + if(msg->traffic.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_TRAFFIC, (union uni_ieall *)&msg->traffic, cx); + if(msg->notify.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_NOTIFY, (union uni_ieall *)&msg->notify, cx); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if(msg->git[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_GIT, (union uni_ieall *)&msg->git[i], cx); + if(msg->unrec.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UNREC, (union uni_ieall *)&msg->unrec, cx); +} + +static int +check_modify_ack(struct uni_modify_ack *m, struct unicx *cx) +{ + int ret = 0; + u_int i; + + ret |= uni_check_ie(UNI_IE_REPORT, (union uni_ieall *)&m->report, cx); + ret |= uni_check_ie(UNI_IE_TRAFFIC, (union uni_ieall *)&m->traffic, cx); + ret |= uni_check_ie(UNI_IE_NOTIFY, (union uni_ieall *)&m->notify, cx); + for(i = 0; i < UNI_NUM_IE_GIT ; i++) { + ret |= uni_check_ie(UNI_IE_GIT, (union uni_ieall *)&m->git[i], cx); + } + ret |= uni_check_ie(UNI_IE_UNREC, (union uni_ieall *)&m->unrec, cx); + + return ret; +} + +static int +encode_modify_ack(struct uni_msg *msg, struct uni_modify_ack *p, struct unicx *cx) +{ + u_int mlen; + u_int i; + + if(uni_encode_msg_hdr(msg, &p->hdr, UNI_MODIFY_ACK, cx, &mlen)) + return (-2); + + if((p->report.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_REPORT, msg, (union uni_ieall *)&p->report, cx)) + return (UNI_IE_REPORT); + if((p->traffic.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_TRAFFIC, msg, (union uni_ieall *)&p->traffic, cx)) + return (UNI_IE_TRAFFIC); + if((p->notify.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_NOTIFY, msg, (union uni_ieall *)&p->notify, cx)) + return (UNI_IE_NOTIFY); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if((p->git[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_GIT, msg, (union uni_ieall *)&p->git[i], cx)) + return ((i << 16) + UNI_IE_GIT); + if((p->unrec.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UNREC, msg, (union uni_ieall *)&p->unrec, cx)) + return (UNI_IE_UNREC); + + msg->b_buf[mlen+0] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 8; + msg->b_buf[mlen+1] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 0; + + return (0); +} + +static int +decode_modify_ack(struct uni_modify_ack *out, struct uni_msg *msg, + enum uni_ietype ie, struct uni_iehdr *hdr, u_int ielen, + struct unicx *cx) +{ + u_int i; + + switch (ie) { + + case UNI_IE_REPORT: + out->report.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_REPORT, (union uni_ieall *)&out->report, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_TRAFFIC: + out->traffic.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_TRAFFIC, (union uni_ieall *)&out->traffic, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_NOTIFY: + out->notify.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_NOTIFY, (union uni_ieall *)&out->notify, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_GIT: + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if (!IE_ISPRESENT(out->git[i])) { + out->git[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_GIT, (union uni_ieall *)&out->git[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_UNREC: + out->unrec.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UNREC, (union uni_ieall *)&out->unrec, msg, ielen, cx)) + return (DEC_ERR); + break; + + default: + return (DEC_ILL); + } + return (DEC_OK); +} + +static const struct msgdecl decl_modify_ack = { + 0, + "modify_ack", + (uni_msg_print_f)print_modify_ack, + (uni_msg_check_f)check_modify_ack, + (uni_msg_encode_f)encode_modify_ack, + (uni_msg_decode_f)decode_modify_ack +}; + +static void +print_modify_rej(struct uni_modify_rej *msg, struct unicx *cx) +{ + u_int i; + + if(msg->cause.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_CAUSE, (union uni_ieall *)&msg->cause, cx); + if(msg->notify.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_NOTIFY, (union uni_ieall *)&msg->notify, cx); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if(msg->git[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_GIT, (union uni_ieall *)&msg->git[i], cx); + if(msg->unrec.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UNREC, (union uni_ieall *)&msg->unrec, cx); +} + +static int +check_modify_rej(struct uni_modify_rej *m, struct unicx *cx) +{ + int ret = 0; + u_int i; + + ret |= uni_check_ie(UNI_IE_CAUSE, (union uni_ieall *)&m->cause, cx); + ret |= uni_check_ie(UNI_IE_NOTIFY, (union uni_ieall *)&m->notify, cx); + for(i = 0; i < UNI_NUM_IE_GIT ; i++) { + ret |= uni_check_ie(UNI_IE_GIT, (union uni_ieall *)&m->git[i], cx); + } + ret |= uni_check_ie(UNI_IE_UNREC, (union uni_ieall *)&m->unrec, cx); + + return ret; +} + +static int +encode_modify_rej(struct uni_msg *msg, struct uni_modify_rej *p, struct unicx *cx) +{ + u_int mlen; + u_int i; + + if(uni_encode_msg_hdr(msg, &p->hdr, UNI_MODIFY_REJ, cx, &mlen)) + return (-2); + + if((p->cause.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_CAUSE, msg, (union uni_ieall *)&p->cause, cx)) + return (UNI_IE_CAUSE); + if((p->notify.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_NOTIFY, msg, (union uni_ieall *)&p->notify, cx)) + return (UNI_IE_NOTIFY); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if((p->git[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_GIT, msg, (union uni_ieall *)&p->git[i], cx)) + return ((i << 16) + UNI_IE_GIT); + if((p->unrec.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UNREC, msg, (union uni_ieall *)&p->unrec, cx)) + return (UNI_IE_UNREC); + + msg->b_buf[mlen+0] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 8; + msg->b_buf[mlen+1] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 0; + + return (0); +} + +static int +decode_modify_rej(struct uni_modify_rej *out, struct uni_msg *msg, + enum uni_ietype ie, struct uni_iehdr *hdr, u_int ielen, + struct unicx *cx) +{ + u_int i; + + switch (ie) { + + case UNI_IE_CAUSE: + out->cause.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_CAUSE, (union uni_ieall *)&out->cause, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_NOTIFY: + out->notify.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_NOTIFY, (union uni_ieall *)&out->notify, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_GIT: + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if (!IE_ISPRESENT(out->git[i])) { + out->git[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_GIT, (union uni_ieall *)&out->git[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_UNREC: + out->unrec.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UNREC, (union uni_ieall *)&out->unrec, msg, ielen, cx)) + return (DEC_ERR); + break; + + default: + return (DEC_ILL); + } + return (DEC_OK); +} + +static const struct msgdecl decl_modify_rej = { + 0, + "modify_rej", + (uni_msg_print_f)print_modify_rej, + (uni_msg_check_f)check_modify_rej, + (uni_msg_encode_f)encode_modify_rej, + (uni_msg_decode_f)decode_modify_rej +}; + +static void +print_conn_avail(struct uni_conn_avail *msg, struct unicx *cx) +{ + u_int i; + + if(msg->notify.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_NOTIFY, (union uni_ieall *)&msg->notify, cx); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if(msg->git[i].h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_GIT, (union uni_ieall *)&msg->git[i], cx); + if(msg->report.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_REPORT, (union uni_ieall *)&msg->report, cx); + if(msg->unrec.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UNREC, (union uni_ieall *)&msg->unrec, cx); +} + +static int +check_conn_avail(struct uni_conn_avail *m, struct unicx *cx) +{ + int ret = 0; + u_int i; + + ret |= uni_check_ie(UNI_IE_NOTIFY, (union uni_ieall *)&m->notify, cx); + for(i = 0; i < UNI_NUM_IE_GIT ; i++) { + ret |= uni_check_ie(UNI_IE_GIT, (union uni_ieall *)&m->git[i], cx); + } + ret |= uni_check_ie(UNI_IE_REPORT, (union uni_ieall *)&m->report, cx); + ret |= uni_check_ie(UNI_IE_UNREC, (union uni_ieall *)&m->unrec, cx); + + return ret; +} + +static int +encode_conn_avail(struct uni_msg *msg, struct uni_conn_avail *p, struct unicx *cx) +{ + u_int mlen; + u_int i; + + if(uni_encode_msg_hdr(msg, &p->hdr, UNI_CONN_AVAIL, cx, &mlen)) + return (-2); + + if((p->notify.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_NOTIFY, msg, (union uni_ieall *)&p->notify, cx)) + return (UNI_IE_NOTIFY); + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if((p->git[i].h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_GIT, msg, (union uni_ieall *)&p->git[i], cx)) + return ((i << 16) + UNI_IE_GIT); + if((p->report.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_REPORT, msg, (union uni_ieall *)&p->report, cx)) + return (UNI_IE_REPORT); + if((p->unrec.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UNREC, msg, (union uni_ieall *)&p->unrec, cx)) + return (UNI_IE_UNREC); + + msg->b_buf[mlen+0] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 8; + msg->b_buf[mlen+1] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 0; + + return (0); +} + +static int +decode_conn_avail(struct uni_conn_avail *out, struct uni_msg *msg, + enum uni_ietype ie, struct uni_iehdr *hdr, u_int ielen, + struct unicx *cx) +{ + u_int i; + + switch (ie) { + + case UNI_IE_NOTIFY: + out->notify.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_NOTIFY, (union uni_ieall *)&out->notify, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_GIT: + for(i = 0; i < UNI_NUM_IE_GIT; i++) + if (!IE_ISPRESENT(out->git[i])) { + out->git[i].h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_GIT, (union uni_ieall *)&out->git[i], msg, ielen, cx)) + return (DEC_ERR); + break; + } + break; + + case UNI_IE_REPORT: + out->report.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_REPORT, (union uni_ieall *)&out->report, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_UNREC: + out->unrec.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UNREC, (union uni_ieall *)&out->unrec, msg, ielen, cx)) + return (DEC_ERR); + break; + + default: + return (DEC_ILL); + } + return (DEC_OK); +} + +static const struct msgdecl decl_conn_avail = { + 0, + "conn_avail", + (uni_msg_print_f)print_conn_avail, + (uni_msg_check_f)check_conn_avail, + (uni_msg_encode_f)encode_conn_avail, + (uni_msg_decode_f)decode_conn_avail +}; + +static void +print_unknown(struct uni_unknown *msg, struct unicx *cx) +{ + if(msg->epref.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_EPREF, (union uni_ieall *)&msg->epref, cx); + if(msg->unrec.h.present & UNI_IE_PRESENT) + uni_print_ie_internal(UNI_IE_UNREC, (union uni_ieall *)&msg->unrec, cx); +} + +static int +check_unknown(struct uni_unknown *m, struct unicx *cx) +{ + int ret = 0; + + ret |= uni_check_ie(UNI_IE_EPREF, (union uni_ieall *)&m->epref, cx); + ret |= uni_check_ie(UNI_IE_UNREC, (union uni_ieall *)&m->unrec, cx); + + return ret; +} + +static int +encode_unknown(struct uni_msg *msg, struct uni_unknown *p, struct unicx *cx) +{ + u_int mlen; + + if(uni_encode_msg_hdr(msg, &p->hdr, UNI_UNKNOWN, cx, &mlen)) + return (-2); + + if((p->epref.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_EPREF, msg, (union uni_ieall *)&p->epref, cx)) + return (UNI_IE_EPREF); + if((p->unrec.h.present & UNI_IE_PRESENT) && + uni_encode_ie(UNI_IE_UNREC, msg, (union uni_ieall *)&p->unrec, cx)) + return (UNI_IE_UNREC); + + msg->b_buf[mlen+0] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 8; + msg->b_buf[mlen+1] = ((msg->b_wptr-msg->b_rptr)-mlen-2) >> 0; + + return (0); +} + +static int +decode_unknown(struct uni_unknown *out, struct uni_msg *msg, + enum uni_ietype ie, struct uni_iehdr *hdr, u_int ielen, + struct unicx *cx) +{ + switch (ie) { + + case UNI_IE_EPREF: + out->epref.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_EPREF, (union uni_ieall *)&out->epref, msg, ielen, cx)) + return (DEC_ERR); + break; + + case UNI_IE_UNREC: + out->unrec.h = *hdr; + if (hdr->present & UNI_IE_ERROR) + return (DEC_ERR); + if(uni_decode_ie_body(UNI_IE_UNREC, (union uni_ieall *)&out->unrec, msg, ielen, cx)) + return (DEC_ERR); + break; + + default: + return (DEC_ILL); + } + return (DEC_OK); +} + +static const struct msgdecl decl_unknown = { + 0, + "unknown", + (uni_msg_print_f)print_unknown, + (uni_msg_check_f)check_unknown, + (uni_msg_encode_f)encode_unknown, + (uni_msg_decode_f)decode_unknown +}; + +const struct msgdecl *uni_msgtable[256] = { + &decl_unknown, /* 0x00 */ + &decl_alerting, /* 0x01 */ + &decl_call_proc, /* 0x02 */ + &decl_unknown, /* 0x03 */ + &decl_unknown, /* 0x04 */ + &decl_setup, /* 0x05 */ + &decl_unknown, /* 0x06 */ + &decl_connect, /* 0x07 */ + &decl_unknown, /* 0x08 */ + &decl_unknown, /* 0x09 */ + &decl_unknown, /* 0x0a */ + &decl_unknown, /* 0x0b */ + &decl_unknown, /* 0x0c */ + &decl_unknown, /* 0x0d */ + &decl_unknown, /* 0x0e */ + &decl_connect_ack, /* 0x0f */ + &decl_unknown, /* 0x10 */ + &decl_unknown, /* 0x11 */ + &decl_unknown, /* 0x12 */ + &decl_unknown, /* 0x13 */ + &decl_unknown, /* 0x14 */ + &decl_cobisetup, /* 0x15 */ + &decl_unknown, /* 0x16 */ + &decl_unknown, /* 0x17 */ + &decl_unknown, /* 0x18 */ + &decl_unknown, /* 0x19 */ + &decl_unknown, /* 0x1a */ + &decl_unknown, /* 0x1b */ + &decl_unknown, /* 0x1c */ + &decl_unknown, /* 0x1d */ + &decl_unknown, /* 0x1e */ + &decl_unknown, /* 0x1f */ + &decl_unknown, /* 0x20 */ + &decl_unknown, /* 0x21 */ + &decl_unknown, /* 0x22 */ + &decl_unknown, /* 0x23 */ + &decl_unknown, /* 0x24 */ + &decl_unknown, /* 0x25 */ + &decl_unknown, /* 0x26 */ + &decl_unknown, /* 0x27 */ + &decl_unknown, /* 0x28 */ + &decl_unknown, /* 0x29 */ + &decl_unknown, /* 0x2a */ + &decl_unknown, /* 0x2b */ + &decl_unknown, /* 0x2c */ + &decl_unknown, /* 0x2d */ + &decl_unknown, /* 0x2e */ + &decl_unknown, /* 0x2f */ + &decl_unknown, /* 0x30 */ + &decl_unknown, /* 0x31 */ + &decl_unknown, /* 0x32 */ + &decl_unknown, /* 0x33 */ + &decl_unknown, /* 0x34 */ + &decl_unknown, /* 0x35 */ + &decl_unknown, /* 0x36 */ + &decl_unknown, /* 0x37 */ + &decl_unknown, /* 0x38 */ + &decl_unknown, /* 0x39 */ + &decl_unknown, /* 0x3a */ + &decl_unknown, /* 0x3b */ + &decl_unknown, /* 0x3c */ + &decl_unknown, /* 0x3d */ + &decl_unknown, /* 0x3e */ + &decl_unknown, /* 0x3f */ + &decl_unknown, /* 0x40 */ + &decl_unknown, /* 0x41 */ + &decl_unknown, /* 0x42 */ + &decl_unknown, /* 0x43 */ + &decl_unknown, /* 0x44 */ + &decl_unknown, /* 0x45 */ + &decl_restart, /* 0x46 */ + &decl_unknown, /* 0x47 */ + &decl_unknown, /* 0x48 */ + &decl_unknown, /* 0x49 */ + &decl_unknown, /* 0x4a */ + &decl_unknown, /* 0x4b */ + &decl_unknown, /* 0x4c */ + &decl_release, /* 0x4d */ + &decl_restart_ack, /* 0x4e */ + &decl_unknown, /* 0x4f */ + &decl_unknown, /* 0x50 */ + &decl_unknown, /* 0x51 */ + &decl_unknown, /* 0x52 */ + &decl_unknown, /* 0x53 */ + &decl_unknown, /* 0x54 */ + &decl_unknown, /* 0x55 */ + &decl_unknown, /* 0x56 */ + &decl_unknown, /* 0x57 */ + &decl_unknown, /* 0x58 */ + &decl_unknown, /* 0x59 */ + &decl_release_compl, /* 0x5a */ + &decl_unknown, /* 0x5b */ + &decl_unknown, /* 0x5c */ + &decl_unknown, /* 0x5d */ + &decl_unknown, /* 0x5e */ + &decl_unknown, /* 0x5f */ + &decl_unknown, /* 0x60 */ + &decl_unknown, /* 0x61 */ + &decl_facility, /* 0x62 */ + &decl_unknown, /* 0x63 */ + &decl_unknown, /* 0x64 */ + &decl_unknown, /* 0x65 */ + &decl_unknown, /* 0x66 */ + &decl_unknown, /* 0x67 */ + &decl_unknown, /* 0x68 */ + &decl_unknown, /* 0x69 */ + &decl_unknown, /* 0x6a */ + &decl_unknown, /* 0x6b */ + &decl_unknown, /* 0x6c */ + &decl_unknown, /* 0x6d */ + &decl_notify, /* 0x6e */ + &decl_unknown, /* 0x6f */ + &decl_unknown, /* 0x70 */ + &decl_unknown, /* 0x71 */ + &decl_unknown, /* 0x72 */ + &decl_unknown, /* 0x73 */ + &decl_unknown, /* 0x74 */ + &decl_status_enq, /* 0x75 */ + &decl_unknown, /* 0x76 */ + &decl_unknown, /* 0x77 */ + &decl_unknown, /* 0x78 */ + &decl_unknown, /* 0x79 */ + &decl_unknown, /* 0x7a */ + &decl_unknown, /* 0x7b */ + &decl_unknown, /* 0x7c */ + &decl_status, /* 0x7d */ + &decl_unknown, /* 0x7e */ + &decl_unknown, /* 0x7f */ + &decl_add_party, /* 0x80 */ + &decl_add_party_ack, /* 0x81 */ + &decl_add_party_rej, /* 0x82 */ + &decl_drop_party, /* 0x83 */ + &decl_drop_party_ack, /* 0x84 */ + &decl_party_alerting, /* 0x85 */ + &decl_unknown, /* 0x86 */ + &decl_unknown, /* 0x87 */ + &decl_modify_req, /* 0x88 */ + &decl_modify_ack, /* 0x89 */ + &decl_modify_rej, /* 0x8a */ + &decl_conn_avail, /* 0x8b */ + &decl_unknown, /* 0x8c */ + &decl_unknown, /* 0x8d */ + &decl_unknown, /* 0x8e */ + &decl_unknown, /* 0x8f */ + &decl_leaf_setup_fail, /* 0x90 */ + &decl_leaf_setup_req, /* 0x91 */ + &decl_unknown, /* 0x92 */ + &decl_unknown, /* 0x93 */ + &decl_unknown, /* 0x94 */ + &decl_unknown, /* 0x95 */ + &decl_unknown, /* 0x96 */ + &decl_unknown, /* 0x97 */ + &decl_unknown, /* 0x98 */ + &decl_unknown, /* 0x99 */ + &decl_unknown, /* 0x9a */ + &decl_unknown, /* 0x9b */ + &decl_unknown, /* 0x9c */ + &decl_unknown, /* 0x9d */ + &decl_unknown, /* 0x9e */ + &decl_unknown, /* 0x9f */ + &decl_unknown, /* 0xa0 */ + &decl_unknown, /* 0xa1 */ + &decl_unknown, /* 0xa2 */ + &decl_unknown, /* 0xa3 */ + &decl_unknown, /* 0xa4 */ + &decl_unknown, /* 0xa5 */ + &decl_unknown, /* 0xa6 */ + &decl_unknown, /* 0xa7 */ + &decl_unknown, /* 0xa8 */ + &decl_unknown, /* 0xa9 */ + &decl_unknown, /* 0xaa */ + &decl_unknown, /* 0xab */ + &decl_unknown, /* 0xac */ + &decl_unknown, /* 0xad */ + &decl_unknown, /* 0xae */ + &decl_unknown, /* 0xaf */ + &decl_unknown, /* 0xb0 */ + &decl_unknown, /* 0xb1 */ + &decl_unknown, /* 0xb2 */ + &decl_unknown, /* 0xb3 */ + &decl_unknown, /* 0xb4 */ + &decl_unknown, /* 0xb5 */ + &decl_unknown, /* 0xb6 */ + &decl_unknown, /* 0xb7 */ + &decl_unknown, /* 0xb8 */ + &decl_unknown, /* 0xb9 */ + &decl_unknown, /* 0xba */ + &decl_unknown, /* 0xbb */ + &decl_unknown, /* 0xbc */ + &decl_unknown, /* 0xbd */ + &decl_unknown, /* 0xbe */ + &decl_unknown, /* 0xbf */ + &decl_unknown, /* 0xc0 */ + &decl_unknown, /* 0xc1 */ + &decl_unknown, /* 0xc2 */ + &decl_unknown, /* 0xc3 */ + &decl_unknown, /* 0xc4 */ + &decl_unknown, /* 0xc5 */ + &decl_unknown, /* 0xc6 */ + &decl_unknown, /* 0xc7 */ + &decl_unknown, /* 0xc8 */ + &decl_unknown, /* 0xc9 */ + &decl_unknown, /* 0xca */ + &decl_unknown, /* 0xcb */ + &decl_unknown, /* 0xcc */ + &decl_unknown, /* 0xcd */ + &decl_unknown, /* 0xce */ + &decl_unknown, /* 0xcf */ + &decl_unknown, /* 0xd0 */ + &decl_unknown, /* 0xd1 */ + &decl_unknown, /* 0xd2 */ + &decl_unknown, /* 0xd3 */ + &decl_unknown, /* 0xd4 */ + &decl_unknown, /* 0xd5 */ + &decl_unknown, /* 0xd6 */ + &decl_unknown, /* 0xd7 */ + &decl_unknown, /* 0xd8 */ + &decl_unknown, /* 0xd9 */ + &decl_unknown, /* 0xda */ + &decl_unknown, /* 0xdb */ + &decl_unknown, /* 0xdc */ + &decl_unknown, /* 0xdd */ + &decl_unknown, /* 0xde */ + &decl_unknown, /* 0xdf */ + &decl_unknown, /* 0xe0 */ + &decl_unknown, /* 0xe1 */ + &decl_unknown, /* 0xe2 */ + &decl_unknown, /* 0xe3 */ + &decl_unknown, /* 0xe4 */ + &decl_unknown, /* 0xe5 */ + &decl_unknown, /* 0xe6 */ + &decl_unknown, /* 0xe7 */ + &decl_unknown, /* 0xe8 */ + &decl_unknown, /* 0xe9 */ + &decl_unknown, /* 0xea */ + &decl_unknown, /* 0xeb */ + &decl_unknown, /* 0xec */ + &decl_unknown, /* 0xed */ + &decl_unknown, /* 0xee */ + &decl_unknown, /* 0xef */ + &decl_unknown, /* 0xf0 */ + &decl_unknown, /* 0xf1 */ + &decl_unknown, /* 0xf2 */ + &decl_unknown, /* 0xf3 */ + &decl_unknown, /* 0xf4 */ + &decl_unknown, /* 0xf5 */ + &decl_unknown, /* 0xf6 */ + &decl_unknown, /* 0xf7 */ + &decl_unknown, /* 0xf8 */ + &decl_unknown, /* 0xf9 */ + &decl_unknown, /* 0xfa */ + &decl_unknown, /* 0xfb */ + &decl_unknown, /* 0xfc */ + &decl_unknown, /* 0xfd */ + &decl_unknown, /* 0xfe */ + &decl_unknown, /* 0xff */ +}; diff --git a/sys/contrib/ngatm/netnatm/msg/uni_msg.h b/sys/contrib/ngatm/netnatm/msg/uni_msg.h new file mode 100644 index 0000000..ddb095b --- /dev/null +++ b/sys/contrib/ngatm/netnatm/msg/uni_msg.h @@ -0,0 +1,342 @@ +/* This file was created automatically + * Source file: $Begemot: libunimsg/atm/msg/msg.def,v 1.3 2003/09/19 11:58:15 hbb Exp $ + * $FreeBSD$ + */ + +#ifndef _NETNATM_MSG_UNI_MSG_H_ +#define _NETNATM_MSG_UNI_MSG_H_ + +struct uni_alerting { + struct uni_msghdr hdr; + struct uni_ie_connid connid; + struct uni_ie_epref epref; + struct uni_ie_notify notify; + struct uni_ie_git git[UNI_NUM_IE_GIT]; + struct uni_ie_uu uu; + struct uni_ie_report report; + struct uni_ie_unrec unrec; +}; + +struct uni_call_proc { + struct uni_msghdr hdr; + struct uni_ie_connid connid; + struct uni_ie_epref epref; + struct uni_ie_notify notify; + struct uni_ie_unrec unrec; +}; + +struct uni_connect { + struct uni_msghdr hdr; + struct uni_ie_aal aal; + struct uni_ie_blli blli; + struct uni_ie_connid connid; + struct uni_ie_epref epref; + struct uni_ie_notify notify; + struct uni_ie_conned conned; + struct uni_ie_connedsub connedsub; + struct uni_ie_eetd eetd; + struct uni_ie_git git[UNI_NUM_IE_GIT]; + struct uni_ie_uu uu; + struct uni_ie_traffic traffic; + struct uni_ie_exqos exqos; + struct uni_ie_facility facility; + struct uni_ie_abrsetup abrsetup; + struct uni_ie_abradd abradd; + struct uni_ie_called_soft called_soft; + struct uni_ie_report report; + struct uni_ie_unrec unrec; +}; + +struct uni_connect_ack { + struct uni_msghdr hdr; + struct uni_ie_notify notify; + struct uni_ie_unrec unrec; +}; + +struct uni_release { + struct uni_msghdr hdr; + struct uni_ie_cause cause[2]; + struct uni_ie_notify notify; + struct uni_ie_git git[UNI_NUM_IE_GIT]; + struct uni_ie_uu uu; + struct uni_ie_facility facility; + struct uni_ie_crankback crankback; + struct uni_ie_unrec unrec; +}; + +struct uni_release_compl { + struct uni_msghdr hdr; + struct uni_ie_cause cause[2]; + struct uni_ie_git git[UNI_NUM_IE_GIT]; + struct uni_ie_uu uu; + struct uni_ie_crankback crankback; + struct uni_ie_unrec unrec; +}; + +struct uni_setup { + struct uni_msghdr hdr; + struct uni_ie_aal aal; + struct uni_ie_traffic traffic; + struct uni_ie_bearer bearer; + struct uni_ie_bhli bhli; + struct uni_ie_repeat blli_repeat; + struct uni_ie_blli blli[UNI_NUM_IE_BLLI]; + struct uni_ie_called called; + struct uni_ie_calledsub calledsub[UNI_NUM_IE_CALLEDSUB]; + struct uni_ie_calling calling; + struct uni_ie_callingsub callingsub[UNI_NUM_IE_CALLINGSUB]; + struct uni_ie_connid connid; + struct uni_ie_qos qos; + struct uni_ie_eetd eetd; + struct uni_ie_notify notify; + struct uni_ie_scompl scompl; + struct uni_ie_tns tns[UNI_NUM_IE_TNS]; + struct uni_ie_epref epref; + struct uni_ie_atraffic atraffic; + struct uni_ie_mintraffic mintraffic; + struct uni_ie_uu uu; + struct uni_ie_git git[UNI_NUM_IE_GIT]; + struct uni_ie_lij_callid lij_callid; + struct uni_ie_lij_param lij_param; + struct uni_ie_lij_seqno lij_seqno; + struct uni_ie_exqos exqos; + struct uni_ie_abrsetup abrsetup; + struct uni_ie_abradd abradd; + struct uni_ie_cscope cscope; + struct uni_ie_calling_soft calling_soft; + struct uni_ie_called_soft called_soft; + struct uni_ie_repeat dtl_repeat; + struct uni_ie_dtl dtl[UNI_NUM_IE_DTL]; + struct uni_ie_report report; + struct uni_ie_mdcr mdcr; + struct uni_ie_unrec unrec; +}; + +struct uni_status { + struct uni_msghdr hdr; + struct uni_ie_callstate callstate; + struct uni_ie_cause cause; + struct uni_ie_epref epref; + struct uni_ie_epstate epstate; + struct uni_ie_unrec unrec; +}; + +struct uni_status_enq { + struct uni_msghdr hdr; + struct uni_ie_epref epref; + struct uni_ie_unrec unrec; +}; + +struct uni_notify { + struct uni_msghdr hdr; + struct uni_ie_notify notify; + struct uni_ie_epref epref; + struct uni_ie_unrec unrec; +}; + +struct uni_restart { + struct uni_msghdr hdr; + struct uni_ie_connid connid; + struct uni_ie_restart restart; + struct uni_ie_unrec unrec; +}; + +struct uni_restart_ack { + struct uni_msghdr hdr; + struct uni_ie_connid connid; + struct uni_ie_restart restart; + struct uni_ie_unrec unrec; +}; + +struct uni_add_party { + struct uni_msghdr hdr; + struct uni_ie_aal aal; + struct uni_ie_bhli bhli; + struct uni_ie_blli blli; + struct uni_ie_called called; + struct uni_ie_calledsub calledsub[UNI_NUM_IE_CALLEDSUB]; + struct uni_ie_calling calling; + struct uni_ie_callingsub callingsub[UNI_NUM_IE_CALLINGSUB]; + struct uni_ie_scompl scompl; + struct uni_ie_tns tns[UNI_NUM_IE_TNS]; + struct uni_ie_epref epref; + struct uni_ie_notify notify; + struct uni_ie_eetd eetd; + struct uni_ie_uu uu; + struct uni_ie_git git[UNI_NUM_IE_GIT]; + struct uni_ie_lij_seqno lij_seqno; + struct uni_ie_calling_soft calling_soft; + struct uni_ie_called_soft called_soft; + struct uni_ie_repeat dtl_repeat; + struct uni_ie_dtl dtl[UNI_NUM_IE_DTL]; + struct uni_ie_unrec unrec; +}; + +struct uni_add_party_ack { + struct uni_msghdr hdr; + struct uni_ie_epref epref; + struct uni_ie_aal aal; + struct uni_ie_blli blli; + struct uni_ie_notify notify; + struct uni_ie_eetd eetd; + struct uni_ie_conned conned; + struct uni_ie_connedsub connedsub; + struct uni_ie_uu uu; + struct uni_ie_git git[UNI_NUM_IE_GIT]; + struct uni_ie_called_soft called_soft; + struct uni_ie_unrec unrec; +}; + +struct uni_party_alerting { + struct uni_msghdr hdr; + struct uni_ie_epref epref; + struct uni_ie_notify notify; + struct uni_ie_uu uu; + struct uni_ie_git git[UNI_NUM_IE_GIT]; + struct uni_ie_unrec unrec; +}; + +struct uni_add_party_rej { + struct uni_msghdr hdr; + struct uni_ie_cause cause; + struct uni_ie_epref epref; + struct uni_ie_uu uu; + struct uni_ie_git git[UNI_NUM_IE_GIT]; + struct uni_ie_crankback crankback; + struct uni_ie_unrec unrec; +}; + +struct uni_drop_party { + struct uni_msghdr hdr; + struct uni_ie_cause cause; + struct uni_ie_epref epref; + struct uni_ie_notify notify; + struct uni_ie_uu uu; + struct uni_ie_git git[UNI_NUM_IE_GIT]; + struct uni_ie_unrec unrec; +}; + +struct uni_drop_party_ack { + struct uni_msghdr hdr; + struct uni_ie_epref epref; + struct uni_ie_cause cause; + struct uni_ie_uu uu; + struct uni_ie_git git[UNI_NUM_IE_GIT]; + struct uni_ie_unrec unrec; +}; + +struct uni_leaf_setup_req { + struct uni_msghdr hdr; + struct uni_ie_tns tns[UNI_NUM_IE_TNS]; + struct uni_ie_calling calling; + struct uni_ie_callingsub callingsub[UNI_NUM_IE_CALLINGSUB]; + struct uni_ie_called called; + struct uni_ie_calledsub calledsub[UNI_NUM_IE_CALLEDSUB]; + struct uni_ie_lij_callid lij_callid; + struct uni_ie_lij_seqno lij_seqno; + struct uni_ie_unrec unrec; +}; + +struct uni_leaf_setup_fail { + struct uni_msghdr hdr; + struct uni_ie_cause cause; + struct uni_ie_called called; + struct uni_ie_calledsub calledsub; + struct uni_ie_lij_seqno lij_seqno; + struct uni_ie_tns tns[UNI_NUM_IE_TNS]; + struct uni_ie_unrec unrec; +}; + +struct uni_cobisetup { + struct uni_msghdr hdr; + struct uni_ie_facility facility; + struct uni_ie_called called; + struct uni_ie_calledsub calledsub; + struct uni_ie_calling calling; + struct uni_ie_notify notify; + struct uni_ie_unrec unrec; +}; + +struct uni_facility { + struct uni_msghdr hdr; + struct uni_ie_facility facility; + struct uni_ie_called called; + struct uni_ie_calledsub calledsub; + struct uni_ie_calling calling; + struct uni_ie_notify notify; + struct uni_ie_unrec unrec; +}; + +struct uni_modify_req { + struct uni_msghdr hdr; + struct uni_ie_traffic traffic; + struct uni_ie_atraffic atraffic; + struct uni_ie_mintraffic mintraffic; + struct uni_ie_notify notify; + struct uni_ie_git git[UNI_NUM_IE_GIT]; + struct uni_ie_unrec unrec; +}; + +struct uni_modify_ack { + struct uni_msghdr hdr; + struct uni_ie_report report; + struct uni_ie_traffic traffic; + struct uni_ie_notify notify; + struct uni_ie_git git[UNI_NUM_IE_GIT]; + struct uni_ie_unrec unrec; +}; + +struct uni_modify_rej { + struct uni_msghdr hdr; + struct uni_ie_cause cause; + struct uni_ie_notify notify; + struct uni_ie_git git[UNI_NUM_IE_GIT]; + struct uni_ie_unrec unrec; +}; + +struct uni_conn_avail { + struct uni_msghdr hdr; + struct uni_ie_notify notify; + struct uni_ie_git git[UNI_NUM_IE_GIT]; + struct uni_ie_report report; + struct uni_ie_unrec unrec; +}; + +struct uni_unknown { + struct uni_msghdr hdr; + struct uni_ie_epref epref; + struct uni_ie_unrec unrec; +}; + +union uni_msgall { + struct uni_msghdr hdr; + struct uni_alerting alerting; + struct uni_call_proc call_proc; + struct uni_connect connect; + struct uni_connect_ack connect_ack; /* !pnni */ + struct uni_release release; + struct uni_release_compl release_compl; + struct uni_setup setup; + struct uni_status status; + struct uni_status_enq status_enq; + struct uni_notify notify; + struct uni_restart restart; + struct uni_restart_ack restart_ack; + struct uni_add_party add_party; + struct uni_add_party_ack add_party_ack; + struct uni_party_alerting party_alerting; + struct uni_add_party_rej add_party_rej; + struct uni_drop_party drop_party; + struct uni_drop_party_ack drop_party_ack; + struct uni_leaf_setup_req leaf_setup_req; /* !pnni */ + struct uni_leaf_setup_fail leaf_setup_fail; /* !pnni */ + struct uni_cobisetup cobisetup; /* !pnni&&q2932 */ + struct uni_facility facility; /* !pnni&&q2932 */ + struct uni_modify_req modify_req; /* !pnni */ + struct uni_modify_ack modify_ack; /* !pnni */ + struct uni_modify_rej modify_rej; /* !pnni */ + struct uni_conn_avail conn_avail; /* !pnni */ + struct uni_unknown unknown; +}; + +#endif -- cgit v1.1