Lines Matching refs:header
68 arphdr header;
69 if (packet.GetLength() < sizeof(header)) {
71 << " is too short to contain ARP header.";
75 memcpy(&header, packet.GetConstData(), sizeof(header));
77 const uint16_t hardware_type = ntohs(header.ar_hrd);
83 const uint16_t protocol = ntohs(header.ar_pro);
94 if (header.ar_hln != ETH_ALEN) {
96 << static_cast<int>(header.ar_hln) << "; expected " << ETH_ALEN;
100 if (header.ar_pln != ip_address_length) {
102 << static_cast<int>(header.ar_hln) << "; expected "
106 const uint16_t operation = ntohs(header.ar_op);
113 sizeof(header) + 2 * ip_address_length + 2 * ETH_ALEN;
123 local_mac_address_ = packet.GetSubstring(sizeof(header), ETH_ALEN);
125 sizeof(header) + ETH_ALEN, ip_address_length));
127 sizeof(header) + ETH_ALEN + ip_address_length, ETH_ALEN);
129 sizeof(header) + ETH_ALEN * 2 + ip_address_length, ip_address_length));
163 arphdr header;
164 header.ar_hrd = htons(ARPHRD_ETHER);
165 header.ar_pro = htons(protocol);
166 header.ar_hln = ETH_ALEN;
167 header.ar_pln = ip_address_length;
168 header.ar_op = htons(ARPOP_REQUEST);
170 *packet = ByteString(reinterpret_cast<const unsigned char*>(&header),
171 sizeof(header));