FreeBSD/sys/netinet/tcp_input.c
/*
 * Pull out of band byte out of a segment so
 * it doesn't appear in the user's data queue.
 * It is still reflected in the segment length for
 * sequencing purposes.
 */
Pull out of band byte out of a segment so
it doesn't appear in the user's data queue.
It is still reflected in the segment length for
sequencing purposes.
Pull out of band byte out of a segment so it doesn ' t appear in the user ' s data queue . It is still reflected in the segment length for sequencing purposes .
void
tcp_pulloutofband(struct socket *so, struct tcphdr *th, struct mbuf *m,
    int off)
{
	int cnt = off + th->th_urp - 1;
	while (cnt >= 0) {
		if (m->m_len > cnt) {
			char *cp = mtod(m, caddr_t) + cnt;
			struct tcpcb *tp = sototcpcb(so);
			INP_WLOCK_ASSERT(tp->t_inpcb);
			tp->t_iobc = *cp;
			tp->t_oobflags |= TCPOOB_HAVEDATA;
			bcopy(cp+1, cp, (unsigned)(m->m_len - cnt - 1));
			m->m_len--;
			if (m->m_flags & M_PKTHDR)
				m->m_pkthdr.len--;
			return;
		}
		cnt -= m->m_len;
		m = m->m_next;
		if (m == NULL)
			break;
	}
	panic("tcp_pulloutofband");
}
void tcp_pulloutofband ( struct socket * so , struct tcphdr * th , struct mbuf * m , int off ) { int cnt = off + th -> th_urp - 1 ; while ( cnt >= 0 ) { if ( m -> m_len > cnt ) { char * cp = mtod ( m , caddr_t ) + cnt ; struct tcpcb * tp = sototcpcb ( so ) ; INP_WLOCK_ASSERT ( tp -> t_inpcb ) ; tp -> t_iobc = * cp ; tp -> t_oobflags |= TCPOOB_HAVEDATA ; bcopy ( cp + 1 , cp , ( unsigned ) ( m -> m_len - cnt - 1 ) ) ; m -> m_len -- ; if ( m -> m_flags & M_PKTHDR ) m -> m_pkthdr . len -- ; return ; } cnt -= m -> m_len ; m = m -> m_next ; if ( m == NULL ) break ; } panic ( " " ) ; }
Pull out of band byte out of a segment so
 it doesn't appear in the user's data queue.
Pull out of band byte out of a segment so it doesn ' t appear in the user ' s data queue .