inet.hh (5484:dc6a459769a1) inet.hh (5761:94d56a48d7e3)
1/*
2 * Copyright (c) 2002-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 148 unchanged lines hidden (view full) ---

157 uint16_t frag_off() const { return ntohs(ip_off) & 0x1fff; }
158 uint8_t ttl() const { return ip_ttl; }
159 uint8_t proto() const { return ip_p; }
160 uint16_t sum() const { return ip_sum; }
161 uint32_t src() const { return ntohl(ip_src); }
162 uint32_t dst() const { return ntohl(ip_dst); }
163
164 void sum(uint16_t sum) { ip_sum = sum; }
1/*
2 * Copyright (c) 2002-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 148 unchanged lines hidden (view full) ---

157 uint16_t frag_off() const { return ntohs(ip_off) & 0x1fff; }
158 uint8_t ttl() const { return ip_ttl; }
159 uint8_t proto() const { return ip_p; }
160 uint16_t sum() const { return ip_sum; }
161 uint32_t src() const { return ntohl(ip_src); }
162 uint32_t dst() const { return ntohl(ip_dst); }
163
164 void sum(uint16_t sum) { ip_sum = sum; }
165 void id(uint16_t _id) { ip_id = htons(_id); }
166 void len(uint16_t _len) { ip_len = htons(_len); }
165
167
168
166 bool options(std::vector<const IpOpt *> &vec) const;
167
168 int size() const { return hlen(); }
169 const uint8_t *bytes() const { return (const uint8_t *)this; }
170 const uint8_t *payload() const { return bytes() + size(); }
171 uint8_t *bytes() { return (uint8_t *)this; }
172 uint8_t *payload() { return bytes() + size(); }
173};

--- 81 unchanged lines hidden (view full) ---

255 uint32_t ack() const { return ntohl(th_ack); }
256 uint8_t off() const { return th_off; }
257 uint8_t flags() const { return th_flags & 0x3f; }
258 uint16_t win() const { return ntohs(th_win); }
259 uint16_t sum() const { return th_sum; }
260 uint16_t urp() const { return ntohs(th_urp); }
261
262 void sum(uint16_t sum) { th_sum = sum; }
169 bool options(std::vector<const IpOpt *> &vec) const;
170
171 int size() const { return hlen(); }
172 const uint8_t *bytes() const { return (const uint8_t *)this; }
173 const uint8_t *payload() const { return bytes() + size(); }
174 uint8_t *bytes() { return (uint8_t *)this; }
175 uint8_t *payload() { return bytes() + size(); }
176};

--- 81 unchanged lines hidden (view full) ---

258 uint32_t ack() const { return ntohl(th_ack); }
259 uint8_t off() const { return th_off; }
260 uint8_t flags() const { return th_flags & 0x3f; }
261 uint16_t win() const { return ntohs(th_win); }
262 uint16_t sum() const { return th_sum; }
263 uint16_t urp() const { return ntohs(th_urp); }
264
265 void sum(uint16_t sum) { th_sum = sum; }
266 void seq(uint32_t _seq) { th_seq = htonl(_seq); }
267 void flags(uint8_t _flags) { th_flags = _flags; }
263
264 bool options(std::vector<const TcpOpt *> &vec) const;
265
266 int size() const { return off(); }
267 const uint8_t *bytes() const { return (const uint8_t *)this; }
268 const uint8_t *payload() const { return bytes() + size(); }
269 uint8_t *bytes() { return (uint8_t *)this; }
270 uint8_t *payload() { return bytes() + size(); }

--- 72 unchanged lines hidden (view full) ---

343struct UdpHdr : public udp_hdr
344{
345 uint16_t sport() const { return ntohs(uh_sport); }
346 uint16_t dport() const { return ntohs(uh_dport); }
347 uint16_t len() const { return ntohs(uh_ulen); }
348 uint16_t sum() const { return uh_sum; }
349
350 void sum(uint16_t sum) { uh_sum = sum; }
268
269 bool options(std::vector<const TcpOpt *> &vec) const;
270
271 int size() const { return off(); }
272 const uint8_t *bytes() const { return (const uint8_t *)this; }
273 const uint8_t *payload() const { return bytes() + size(); }
274 uint8_t *bytes() { return (uint8_t *)this; }
275 uint8_t *payload() { return bytes() + size(); }

--- 72 unchanged lines hidden (view full) ---

348struct UdpHdr : public udp_hdr
349{
350 uint16_t sport() const { return ntohs(uh_sport); }
351 uint16_t dport() const { return ntohs(uh_dport); }
352 uint16_t len() const { return ntohs(uh_ulen); }
353 uint16_t sum() const { return uh_sum; }
354
355 void sum(uint16_t sum) { uh_sum = sum; }
356 void len(uint16_t _len) { uh_ulen = htons(_len); }
351
352 int size() const { return sizeof(udp_hdr); }
353 const uint8_t *bytes() const { return (const uint8_t *)this; }
354 const uint8_t *payload() const { return bytes() + size(); }
355 uint8_t *bytes() { return (uint8_t *)this; }
356 uint8_t *payload() { return bytes() + size(); }
357};
358

--- 42 unchanged lines hidden ---
357
358 int size() const { return sizeof(udp_hdr); }
359 const uint8_t *bytes() const { return (const uint8_t *)this; }
360 const uint8_t *payload() const { return bytes() + size(); }
361 uint8_t *bytes() { return (uint8_t *)this; }
362 uint8_t *payload() { return bytes() + size(); }
363};
364

--- 42 unchanged lines hidden ---