* Examine our list of fragments, and determine if there is a * complete and deliverable packet at the head of the list. * Return 1 if so, zero otherwise. */
| 1670 | * Return 1 if so, zero otherwise. |
| 1671 | */ |
| 1672 | static int |
| 1673 | ng_ppp_check_packet(node_p node) |
| 1674 | { |
| 1675 | const priv_p priv = NG_NODE_PRIVATE(node); |
| 1676 | struct ng_ppp_frag *qent, *qnext; |
| 1677 | |
| 1678 | /* Check for empty queue */ |
| 1679 | if (TAILQ_EMPTY(&priv->frags)) |
| 1680 | return (0); |
| 1681 | |
| 1682 | /* Check first fragment is the start of a deliverable packet */ |
| 1683 | qent = TAILQ_FIRST(&priv->frags); |
| 1684 | if (!qent->first || MP_RECV_SEQ_DIFF(priv, qent->seq, priv->mseq) > 1) |
| 1685 | return (0); |
| 1686 | |
| 1687 | /* Check that all the fragments are there */ |
| 1688 | while (!qent->last) { |
| 1689 | qnext = TAILQ_NEXT(qent, f_qent); |
| 1690 | if (qnext == NULL) /* end of queue */ |
| 1691 | return (0); |
| 1692 | if (qnext->seq != MP_NEXT_RECV_SEQ(priv, qent->seq)) |
| 1693 | return (0); |
| 1694 | qent = qnext; |
| 1695 | } |
| 1696 | |
| 1697 | /* Got one */ |
| 1698 | return (1); |
| 1699 | } |
| 1700 | |
| 1701 | /* |
| 1702 | * Pull a completed packet off the head of the incoming fragment queue. |
no outgoing calls
no test coverage detected