OLD | NEW |
(Empty) | |
| 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 /* |
| 3 * Copyright (c) 2010 Hajime Tazaki |
| 4 * |
| 5 * This program is free software; you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 2 as |
| 7 * published by the Free Software Foundation; |
| 8 * |
| 9 * This program is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. |
| 13 * |
| 14 * You should have received a copy of the GNU General Public License |
| 15 * along with this program; if not, write to the Free Software |
| 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 * |
| 18 * Authors: Hajime Tazaki <tazaki@sfc.wide.ad.jp> |
| 19 */ |
| 20 |
| 21 #ifndef __IPV4_PACKET_INFO_TAG_H__ |
| 22 #define __IPV4_PACKET_INFO_TAG_H__ |
| 23 |
| 24 #include "ns3/tag.h" |
| 25 |
| 26 namespace ns3 { |
| 27 |
| 28 |
| 29 class Node; |
| 30 class Packet; |
| 31 |
| 32 /** |
| 33 * \brief This class implements Linux struct pktinfo· |
| 34 * in order to deliver ancillary information to the socket interface. |
| 35 * This is used with socket option such as IP_PKTINFO, IP_RECVTTL,· |
| 36 * IP_RECVTOS. See linux manpage ip(7). |
| 37 * |
| 38 * This tag in the send direction is presently not enabled but we |
| 39 * would accept a patch along those lines in the future. |
| 40 */ |
| 41 class Ipv4PacketInfoTag : public Tag |
| 42 { |
| 43 public: |
| 44 Ipv4PacketInfoTag (); |
| 45 // Implemented, but not used in the stack yet |
| 46 void SetAddress (Ipv4Address addr); |
| 47 // Implemented, but not used in the stack yet |
| 48 Ipv4Address GetAddress (void) const; |
| 49 // This corresponds to "ipi_spec_dst" in struct in_pktinfo. |
| 50 // Implemented, but not used in the stack yet |
| 51 void SetLocalAddress (Ipv4Address addr); |
| 52 // This corresponds to "ipi_spec_dst" in struct in_pktinfo. |
| 53 // Implemented, but not used in the stack yet |
| 54 Ipv4Address GetLocalAddress (void) const; |
| 55 void SetRecvIf (uint32_t ifindex); |
| 56 uint32_t GetRecvIf (void) const; |
| 57 // Implemented, but not used in the stack yet |
| 58 void SetTtl (uint8_t ttl); |
| 59 // Implemented, but not used in the stack yet |
| 60 uint8_t GetTtl (void) const; |
| 61 |
| 62 static TypeId GetTypeId (void);·· |
| 63 virtual TypeId GetInstanceTypeId (void) const; |
| 64 virtual uint32_t GetSerializedSize (void) const; |
| 65 virtual void Serialize (TagBuffer i) const; |
| 66 virtual void Deserialize (TagBuffer i); |
| 67 virtual void Print (std::ostream &os) const; |
| 68 |
| 69 private: |
| 70 // Linux IP_PKTINFO ip(7) implementation |
| 71 //· |
| 72 // struct in_pktinfo { |
| 73 // unsigned int ipi_ifindex; /* Interface index */ |
| 74 // struct in_addr ipi_spec_dst; /* Local address */ |
| 75 // struct in_addr ipi_addr; /* Header Destination |
| 76 // address */ |
| 77 // }; |
| 78 |
| 79 Ipv4Address m_addr; |
| 80 Ipv4Address m_spec_dst; |
| 81 uint32_t m_ifindex; |
| 82 |
| 83 // Uset for IP_RECVTTL, though not implemented yet. |
| 84 uint8_t m_ttl; |
| 85 }; |
| 86 } //namespace ns3 |
| 87 |
| 88 #endif /* __IPV4_PACKET_INFO_TAG_H__ */ |
| 89 |
OLD | NEW |