Lines Matching refs:uni

38 #include <netnatm/sig/uni.h>
43 static void response_restart(struct uni *, struct uni_msg *, struct uni_all *);
44 static void response_status(struct uni *, struct uni_msg *, struct uni_all *);
46 static void response_t317(struct uni *);
48 static void response_error(struct uni *, struct uniapi_reset_error_response *,
50 static void response_response(struct uni *, struct uniapi_reset_response *,
53 static void start_request(struct uni *, struct uniapi_reset_request *,
56 static void start_t316(struct uni *);
58 static void start_restart_ack(struct uni *, struct uni_msg *, struct uni_all *);
59 static void start_status(struct uni *, struct uni_msg *, struct uni_all *);
61 static int restart_forward(struct uni *, const struct uni_all *);
82 uni_sig_start(struct uni *uni, u_int sig, uint32_t cookie,
86 VERBOSE(uni, UNI_FAC_ERR, 1, "Signal %d outside of range to "
95 VERBOSE(uni, UNI_FAC_RESTART, 1,
97 start_sigs[sig], uni->glob_start, cookie);
105 start_request(uni,
114 start_t316(uni);
121 start_restart_ack(uni, m, u);
127 start_status(uni, m, u);
143 start_request(struct uni *uni, struct uniapi_reset_request *req, uint32_t cookie)
148 if (uni->glob_start != UNI_CALLSTATE_REST0) {
149 uniapi_uni_error(uni, UNIAPI_ERROR_BAD_CALLSTATE, cookie, 0);
154 uniapi_uni_error(uni, UNIAPI_ERROR_NOMEM, cookie, 0);
162 if (restart_forward(uni, resp))
165 uni->connid_start = req->connid;
166 uni->restart_start = req->restart;
168 if ((err = uni_send_output(resp, uni)) != 0)
169 uniapi_uni_error(uni, UNIAPI_ERROR_ENCODING, cookie, 0);
174 uni->cnt316 = 0;
175 TIMER_START_UNI(uni, t316, uni->timer316);
176 uni->glob_start = UNI_CALLSTATE_REST1;
178 VERBOSE(uni, UNI_FAC_RESTART, 1, "Reset-Start state := 1");
181 uniapi_uni_error(uni, UNIAPI_OK, cookie, 0);
188 t316_func(struct uni *uni)
190 uni_enq_start(uni, SIGS_T316, 0, NULL, NULL);
197 start_t316(struct uni *uni)
199 if (uni->glob_start != UNI_CALLSTATE_REST1) {
200 VERBOSE0(uni, UNI_FAC_ERR, "T316 in state %d",
201 uni->glob_start);
205 if (++uni->cnt316 == uni->init316) {
209 VERBOSE(uni, UNI_FAC_RESTART, 1, "Reset-Start error");
216 uni->funcs->uni_output(uni, uni->arg,
220 uni->glob_start = UNI_CALLSTATE_REST0;
221 VERBOSE(uni, UNI_FAC_RESTART, 1, "Reset-Start state := 0");
229 resp->u.restart.restart = uni->restart_start;
230 resp->u.restart.connid = uni->connid_start;
232 (void)uni_send_output(resp, uni);
236 TIMER_START_UNI(uni, t316, uni->timer316);
244 start_restart_ack(struct uni *uni, struct uni_msg *m, struct uni_all *u)
250 if (uni->glob_start == UNI_CALLSTATE_REST0) {
251 uni_respond_status_mtype(uni, &u->u.hdr.cref, uni->glob_start,
256 if (uni->glob_start != UNI_CALLSTATE_REST1) {
264 (void)uni_decode_body(m, u, &uni->cx);
265 MANDATE_IE(uni, u->u.restart_ack.restart, UNI_IE_RESTART);
273 (void)UNI_SAVE_IERR(&uni->cx, UNI_IE_CONNID,
278 MANDATE_IE(uni, u->u.restart_ack.connid, UNI_IE_CONNID);
289 IE_ISGOOD(uni->restart_start) &&
290 u->u.restart_ack.restart.rclass == uni->restart_start.rclass &&
291 !IE_ISGOOD(u->u.restart_ack.connid) == !IE_ISGOOD(uni->connid_start) &&
292 (!IE_ISGOOD(uni->connid_start) ||
293 (u->u.restart_ack.connid.vpci == uni->connid_start.vpci &&
294 u->u.restart_ack.connid.vci == uni->connid_start.vci)))
297 switch (uni_verify(uni, u->u.hdr.act)) {
300 uni_respond_status_verify(uni, &u->u.hdr.cref,
306 uni->glob_start = UNI_CALLSTATE_REST0;
307 VERBOSE(uni, UNI_FAC_RESTART, 1,
313 uni_respond_status_verify(uni, &u->u.hdr.cref,
337 TIMER_STOP_UNI(uni, t316);
339 uni->funcs->uni_output(uni, uni->arg, UNIAPI_RESET_confirm, 0, app);
341 uni->glob_start = UNI_CALLSTATE_REST0;
342 VERBOSE(uni, UNI_FAC_RESTART, 1, "Reset-Start state := 0");
366 start_status(struct uni *uni, struct uni_msg *m, struct uni_all *u)
368 (void)uni_decode_body(m, u, &uni->cx);
369 MANDATE_IE(uni, u->u.status.callstate, UNI_IE_CALLSTATE);
370 MANDATE_IE(uni, u->u.status.cause, UNI_IE_CAUSE);
371 switch (uni_verify(uni, u->u.hdr.act)) {
373 uni->glob_start = UNI_CALLSTATE_REST0;
374 VERBOSE(uni, UNI_FAC_RESTART, 1, "Reset-Start state := 0");
381 uni_respond_status_verify(uni, &u->u.hdr.cref, uni->glob_start,
395 uni->glob_start == UNI_CALLSTATE_REST0) ||
397 uni->glob_start == UNI_CALLSTATE_REST1) ||
399 uni->glob_start == UNI_CALLSTATE_REST1)) {
415 uni->funcs->uni_output(uni, uni->arg,
427 uni->funcs->uni_output(uni, uni->arg,
438 uni_sig_respond(struct uni *uni, u_int sig, uint32_t cookie,
442 VERBOSE(uni, UNI_FAC_ERR, 1, "Signal %d outside of range to "
451 VERBOSE(uni, UNI_FAC_RESTART, 1,
453 respond_sigs[sig], uni->glob_respond, cookie);
461 response_restart(uni, m, u);
467 response_status(uni, m, u);
476 response_error(uni,
483 response_response(uni,
492 response_t317(uni);
505 restart_forward(struct uni *uni, const struct uni_all *u)
513 TAILQ_FOREACH(c, &uni->calls, link) {
533 response_restart(struct uni *uni, struct uni_msg *m, struct uni_all *u)
538 if (uni->glob_respond == UNI_CALLSTATE_REST0) {
542 (void)uni_decode_body(m, u, &uni->cx);
543 MANDATE_IE(uni, u->u.restart.restart, UNI_IE_RESTART);
550 (void)UNI_SAVE_IERR(&uni->cx, UNI_IE_CONNID,
555 MANDATE_IE(uni, u->u.restart.connid, UNI_IE_CONNID);
558 switch (uni_verify(uni, u->u.hdr.act)) {
561 uni_respond_status_verify(uni, &u->u.hdr.cref,
569 uni_respond_status_verify(uni, &u->u.hdr.cref,
581 if (restart_forward(uni, u))
593 uni_enq_coord(uni, SIGO_RESET_indication, 0, app);
595 TIMER_START_UNI(uni, t317, uni->timer317);
596 uni->glob_respond = UNI_CALLSTATE_REST2;
598 VERBOSE(uni, UNI_FAC_RESTART, 1, "Reset-Respond state := 2");
601 } else if (uni->glob_respond == UNI_CALLSTATE_REST2) {
606 uni_respond_status_mtype(uni, &u->u.hdr.cref, uni->glob_respond,
615 response_t317(struct uni *uni)
620 if (uni->glob_respond != UNI_CALLSTATE_REST2) {
621 VERBOSE0(uni, UNI_FAC_ERR, "T317 in state %d",
622 uni->glob_respond);
626 VERBOSE(uni, UNI_FAC_RESTART, 1, "Reset-Respond error");
632 uni->funcs->uni_output(uni, uni->arg,
636 uni->glob_respond = UNI_CALLSTATE_REST0;
637 VERBOSE(uni, UNI_FAC_RESTART, 1, "Reset-Respond state := 0");
644 response_error(struct uni *uni, struct uniapi_reset_error_response *c,
649 if (uni->glob_respond != UNI_CALLSTATE_REST2) {
650 uniapi_uni_error(uni, UNIAPI_ERROR_BAD_CALLSTATE, cookie, 0);
655 uniapi_uni_error(uni, UNIAPI_ERROR_NOMEM, cookie, 0);
667 if (IE_ISGOOD(uni->connid_respond))
669 uni->connid_respond.vpci,
670 uni->connid_respond.vci);
673 if (uni_send_output(resp, uni) != 0) {
674 uniapi_uni_error(uni, UNIAPI_ERROR_ENCODING, cookie, 0);
679 uniapi_uni_error(uni, UNIAPI_OK, cookie, 0);
686 response_response(struct uni *uni, struct uniapi_reset_response *arg,
691 if (uni->glob_respond != UNI_CALLSTATE_REST2) {
692 uniapi_uni_error(uni, UNIAPI_ERROR_BAD_CALLSTATE, cookie, 0);
697 uniapi_uni_error(uni, UNIAPI_ERROR_MISSING_IE, cookie, 0);
702 uniapi_uni_error(uni, UNIAPI_ERROR_NOMEM, cookie, 0);
706 TIMER_STOP_UNI(uni, t317);
713 if (uni_send_output(resp, uni) != 0) {
714 uniapi_uni_error(uni, UNIAPI_ERROR_ENCODING, cookie, 0);
721 uni->glob_respond = UNI_CALLSTATE_REST0;
722 VERBOSE(uni, UNI_FAC_RESTART, 1, "Reset-Respond state := 0");
724 uniapi_uni_error(uni, UNIAPI_OK, cookie, 0);
748 response_status(struct uni *uni, struct uni_msg *m, struct uni_all *u)
750 (void)uni_decode_body(m, u, &uni->cx);
751 MANDATE_IE(uni, u->u.status.callstate, UNI_IE_CALLSTATE);
752 MANDATE_IE(uni, u->u.status.cause, UNI_IE_CAUSE);
753 switch (uni_verify(uni, u->u.hdr.act)) {
755 if (uni->proto == UNIPROTO_UNI40U) {
756 uni->glob_respond = UNI_CALLSTATE_REST0;
757 VERBOSE(uni, UNI_FAC_RESTART, 1,
767 uni_respond_status_verify(uni, &u->u.hdr.cref,
768 uni->glob_respond, NULL, 0);
781 uni->glob_respond == UNI_CALLSTATE_REST0) ||
783 uni->glob_respond == UNI_CALLSTATE_REST0) ||
785 uni->glob_respond == UNI_CALLSTATE_REST2)) {
802 uni->funcs->uni_output(uni, uni->arg,
814 uni->funcs->uni_output(uni, uni->arg,
824 t317_func(struct uni *uni)
826 uni_enq_resp(uni, SIGR_T317, 0, NULL, NULL);