ClientCollectors/ARODataCollector/external/libpcap-1.1.1/gencode.c
static struct slist *
gen_load_ppi_llprefixlen()
{
	struct slist *s1, *s2;
	
	/*
	 * Generate code to load the length of the radiotap header
	 * into the register assigned to hold that length, if one has
	 * been assigned.
	 */
	if (reg_off_ll != -1) {
		/*
		 * The 2 bytes at offsets of 2 and 3 from the beginning
		 * of the radiotap header are the length of the radiotap
		 * header; unfortunately, it's little-endian, so we have
		 * to load it a byte at a time and construct the value.
		 */

		/*
		 * Load the high-order byte, at an offset of 3, shift it
		 * left a byte, and put the result in the X register.
		 */
		s1 = new_stmt(BPF_LD|BPF_B|BPF_ABS);
		s1->s.k = 3;
		s2 = new_stmt(BPF_ALU|BPF_LSH|BPF_K);
		sappend(s1, s2);
		s2->s.k = 8;
		s2 = new_stmt(BPF_MISC|BPF_TAX);
		sappend(s1, s2);

		/*
		 * Load the next byte, at an offset of 2, and OR the
		 * value from the X register into it.
		 */
		s2 = new_stmt(BPF_LD|BPF_B|BPF_ABS);
		sappend(s1, s2);
		s2->s.k = 2;
		s2 = new_stmt(BPF_ALU|BPF_OR|BPF_X);
		sappend(s1, s2);

		/*
		 * Now allocate a register to hold that value and store
		 * it.
		 */
		s2 = new_stmt(BPF_ST);
		s2->s.k = reg_off_ll;
		sappend(s1, s2);

		/*
		 * Now move it into the X register.
		 */
		s2 = new_stmt(BPF_MISC|BPF_TAX);
		sappend(s1, s2);

		return (s1);
	} else
		return (NULL);
}
/* 
 * At the moment we treat PPI as normal Radiotap encoded
 * packets. The difference is in the function that generates
 * the code at the beginning to compute the header length.
 * Since this code generator of PPI supports bare 802.11
 * encapsulation only (i.e. the encapsulated DLT should be
 * DLT_IEEE802_11) we generate code to check for this too;
 * that's done in finish_parse().
 */
At the moment we treat PPI as normal Radiotap encoded
packets. The difference is in the function that generates
the code at the beginning to compute the header length.
Since this code generator of PPI supports bare 802.11
encapsulation only  we generate code to check for this too;
that's done in finish_parse().
At the moment we treat PPI as normal Radiotap encoded packets . The difference is in the function that generates the code at the beginning to compute the header length . Since this code generator of PPI supports bare 802 . 11 encapsulation only we generate code to check for this too ; that ' s done in finish_parse () .
static struct slist *
gen_load_ppi_llprefixlen()
{
	struct slist *s1, *s2;
	if (reg_off_ll != -1) {
		s1 = new_stmt(BPF_LD|BPF_B|BPF_ABS);
		s1->s.k = 3;
		s2 = new_stmt(BPF_ALU|BPF_LSH|BPF_K);
		sappend(s1, s2);
		s2->s.k = 8;
		s2 = new_stmt(BPF_MISC|BPF_TAX);
		sappend(s1, s2);
		s2 = new_stmt(BPF_LD|BPF_B|BPF_ABS);
		sappend(s1, s2);
		s2->s.k = 2;
		s2 = new_stmt(BPF_ALU|BPF_OR|BPF_X);
		sappend(s1, s2);
		s2 = new_stmt(BPF_ST);
		s2->s.k = reg_off_ll;
		sappend(s1, s2);
		s2 = new_stmt(BPF_MISC|BPF_TAX);
		sappend(s1, s2);
		return (s1);
	} else
		return (NULL);
}
static struct slist * gen_load_ppi_llprefixlen ( ) { struct slist * s1 , * s2 ; if ( reg_off_ll != -1 ) { s1 = new_stmt ( BPF_LD | BPF_B | BPF_ABS ) ; s1 -> s . k = 3 ; s2 = new_stmt ( BPF_ALU | BPF_LSH | BPF_K ) ; sappend ( s1 , s2 ) ; s2 -> s . k = 8 ; s2 = new_stmt ( BPF_MISC | BPF_TAX ) ; sappend ( s1 , s2 ) ; s2 = new_stmt ( BPF_LD | BPF_B | BPF_ABS ) ; sappend ( s1 , s2 ) ; s2 -> s . k = 2 ; s2 = new_stmt ( BPF_ALU | BPF_OR | BPF_X ) ; sappend ( s1 , s2 ) ; s2 = new_stmt ( BPF_ST ) ; s2 -> s . k = reg_off_ll ; sappend ( s1 , s2 ) ; s2 = new_stmt ( BPF_MISC | BPF_TAX ) ; sappend ( s1 , s2 ) ; return ( s1 ) ; } else return ( NULL ) ; }
At the moment we treat PPI as normal Radiotap encoded
 packets.
At the moment we treat PPI as normal Radiotap encoded packets .
/*
	 * Generate code to load the length of the radiotap header
	 * into the register assigned to hold that length, if one has
	 * been assigned.
	 */ /*
		 * The 2 bytes at offsets of 2 and 3 from the beginning
		 * of the radiotap header are the length of the radiotap
		 * header; unfortunately, it's little-endian, so we have
		 * to load it a byte at a time and construct the value.
		 */ /*
		 * Load the high-order byte, at an offset of 3, shift it
		 * left a byte, and put the result in the X register.
		 */ /*
		 * Load the next byte, at an offset of 2, and OR the
		 * value from the X register into it.
		 */ /*
		 * Now allocate a register to hold that value and store
		 * it.
		 */ /*
		 * Now move it into the X register.
		 */