ClientCollectors/ARODataCollector/external/libpcap-1.1.1/gencode.c
static struct slist *
gen_loadx_iphdrlen()
{
	struct slist *s, *s2;

	s = gen_off_macpl();
	if (s != NULL) {
		/*
		 * There's a variable-length prefix preceding the
		 * link-layer header, or the link-layer header is itself
		 * variable-length.  "s" points to a list of statements
		 * that put the offset of the MAC-layer payload into
		 * the X register.
		 *
		 * The 4*([k]&0xf) addressing mode can't be used, as we
		 * don't have a constant offset, so we have to load the
		 * value in question into the A register and add to it
		 * the value from the X register.
		 */
		s2 = new_stmt(BPF_LD|BPF_IND|BPF_B);
		s2->s.k = off_nl;
		sappend(s, s2);
		s2 = new_stmt(BPF_ALU|BPF_AND|BPF_K);
		s2->s.k = 0xf;
		sappend(s, s2);
		s2 = new_stmt(BPF_ALU|BPF_LSH|BPF_K);
		s2->s.k = 2;
		sappend(s, s2);

		/*
		 * The A register now contains the length of the
		 * IP header.  We need to add to it the offset of
		 * the MAC-layer payload, which is still in the X
		 * register, and move the result into the X register.
		 */
		sappend(s, new_stmt(BPF_ALU|BPF_ADD|BPF_X));
		sappend(s, new_stmt(BPF_MISC|BPF_TAX));
	} else {
		/*
		 * There is no variable-length header preceding the
		 * link-layer header, and the link-layer header is
		 * fixed-length; load the length of the IPv4 header,
		 * which is at an offset of off_nl from the beginning
		 * of the MAC-layer payload, and thus at an offset
		 * of off_mac_pl + off_nl from the beginning of the
		 * raw packet data.
		 */
		s = new_stmt(BPF_LDX|BPF_MSH|BPF_B);
		s->s.k = off_macpl + off_nl;
	}
	return s;
}
/*
 * Generate code to load into the X register the sum of the length of
 * the IPv4 header and any variable-length header preceding the link-layer
 * header.
 */
Generate code to load into the X register the sum of the length of
the IPv4 header and any variable-length header preceding the link-layer
header.
Generate code to load into the X register the sum of the length of the IPv4 header and any variable - length header preceding the link - layer header .
static struct slist *
gen_loadx_iphdrlen()
{
	struct slist *s, *s2;
	s = gen_off_macpl();
	if (s != NULL) {
		s2 = new_stmt(BPF_LD|BPF_IND|BPF_B);
		s2->s.k = off_nl;
		sappend(s, s2);
		s2 = new_stmt(BPF_ALU|BPF_AND|BPF_K);
		s2->s.k = 0xf;
		sappend(s, s2);
		s2 = new_stmt(BPF_ALU|BPF_LSH|BPF_K);
		s2->s.k = 2;
		sappend(s, s2);
		sappend(s, new_stmt(BPF_ALU|BPF_ADD|BPF_X));
		sappend(s, new_stmt(BPF_MISC|BPF_TAX));
	} else {
		s = new_stmt(BPF_LDX|BPF_MSH|BPF_B);
		s->s.k = off_macpl + off_nl;
	}
	return s;
}
static struct slist * gen_loadx_iphdrlen ( ) { struct slist * s , * s2 ; s = gen_off_macpl ( ) ; if ( s != NULL ) { s2 = new_stmt ( BPF_LD | BPF_IND | BPF_B ) ; s2 -> s . k = off_nl ; sappend ( s , s2 ) ; s2 = new_stmt ( BPF_ALU | BPF_AND | BPF_K ) ; s2 -> s . k = 0xf ; sappend ( s , s2 ) ; s2 = new_stmt ( BPF_ALU | BPF_LSH | BPF_K ) ; s2 -> s . k = 2 ; sappend ( s , s2 ) ; sappend ( s , new_stmt ( BPF_ALU | BPF_ADD | BPF_X ) ) ; sappend ( s , new_stmt ( BPF_MISC | BPF_TAX ) ) ; } else { s = new_stmt ( BPF_LDX | BPF_MSH | BPF_B ) ; s -> s . k = off_macpl + off_nl ; } return s ; }
Generate code to load into the X register the sum of the length of
 the IPv4 header and any variable-length header preceding the link-layer
 header.
Generate code to load into the X register the sum of the length of the IPv4 header and any variable - length header preceding the link - layer header .
/*
		 * There's a variable-length prefix preceding the
		 * link-layer header, or the link-layer header is itself
		 * variable-length.  "s" points to a list of statements
		 * that put the offset of the MAC-layer payload into
		 * the X register.
		 *
		 * The 4*([k]&0xf) addressing mode can't be used, as we
		 * don't have a constant offset, so we have to load the
		 * value in question into the A register and add to it
		 * the value from the X register.
		 */ /*
		 * The A register now contains the length of the
		 * IP header.  We need to add to it the offset of
		 * the MAC-layer payload, which is still in the X
		 * register, and move the result into the X register.
		 */ /*
		 * There is no variable-length header preceding the
		 * link-layer header, and the link-layer header is
		 * fixed-length; load the length of the IPv4 header,
		 * which is at an offset of off_nl from the beginning
		 * of the MAC-layer payload, and thus at an offset
		 * of off_mac_pl + off_nl from the beginning of the
		 * raw packet data.
		 */