---------------------------------------------------------------------- * STATE MACHINE CODE * ---------------------------------------------------------------------- */ @addtogroup state_machine * * The SCTP NAT State Machine functions will: * - Process an already parsed packet * - Use the existing NAT Hash Tables * - Determine the next state for the association
| 1712 | * @return SN_DROP_PKT | SN_NAT_PKT | SN_REPLY_ABORT | SN_REPLY_ERROR | SN_PROCESSING_ERROR |
| 1713 | */ |
| 1714 | static int |
| 1715 | ProcessSctpMsg(struct libalias *la, int direction, struct sctp_nat_msg *sm, struct sctp_nat_assoc *assoc) |
| 1716 | { |
| 1717 | int rtnval; |
| 1718 | |
| 1719 | switch (assoc->state) { |
| 1720 | case SN_ID: /* Idle */ |
| 1721 | rtnval = ID_process(la, direction, assoc, sm); |
| 1722 | if (rtnval != SN_NAT_PKT) { |
| 1723 | assoc->state = SN_RM;/* Mark for removal*/ |
| 1724 | } |
| 1725 | return (rtnval); |
| 1726 | case SN_INi: /* Initialising - Init */ |
| 1727 | return (INi_process(la, direction, assoc, sm)); |
| 1728 | case SN_INa: /* Initialising - AddIP */ |
| 1729 | return (INa_process(la, direction, assoc, sm)); |
| 1730 | case SN_UP: /* Association UP */ |
| 1731 | return (UP_process(la, direction, assoc, sm)); |
| 1732 | case SN_CL: /* Association Closing */ |
| 1733 | return (CL_process(la, direction, assoc, sm)); |
| 1734 | } |
| 1735 | return (SN_PROCESSING_ERROR); |
| 1736 | } |
| 1737 | |
| 1738 | /** @ingroup state_machine |
| 1739 | * @brief Process SCTP message while in the Idle state |
no test coverage detected