View | Details | Raw Unified | Return to bug 671
Collapse All | Expand All

(-)a/src/node/node.cc (+5 lines)
 Lines 30-35    Link Here 
30
#include "ns3/assert.h"
30
#include "ns3/assert.h"
31
#include "ns3/global-value.h"
31
#include "ns3/global-value.h"
32
#include "ns3/boolean.h"
32
#include "ns3/boolean.h"
33
#include "ns3/socket.h"
33
34
34
NS_LOG_COMPONENT_DEFINE ("Node");
35
NS_LOG_COMPONENT_DEFINE ("Node");
35
36
 Lines 251-256    Link Here 
251
               << ") Packet UID " << packet->GetUid ());
252
               << ") Packet UID " << packet->GetUid ());
252
  bool found = false;
253
  bool found = false;
253
254
255
  SocketRecvIfTag tag;
256
  tag.SetRecvIf (device->GetIfIndex());
257
  packet->AddPacketTag (tag);
258
254
  for (ProtocolHandlerList::iterator i = m_handlers.begin ();
259
  for (ProtocolHandlerList::iterator i = m_handlers.begin ();
255
       i != m_handlers.end (); i++)
260
       i != m_handlers.end (); i++)
256
    {
261
    {
(-)a/src/node/socket.cc (+54 lines)
 Lines 428-431    Link Here 
428
  os << (m_dontFragment?"true":"false");
428
  os << (m_dontFragment?"true":"false");
429
}
429
}
430
430
431
432
SocketRecvIfTag::SocketRecvIfTag ()  
433
{
434
}
435
436
void 
437
SocketRecvIfTag::SetRecvIf (uint32_t ifindex)
438
{
439
  m_ifindex = ifindex;
440
}
441
442
uint32_t 
443
SocketRecvIfTag::GetRecvIf (void) const
444
{
445
  return m_ifindex;
446
}
447
448
449
TypeId
450
SocketRecvIfTag::GetTypeId (void)
451
{
452
  static TypeId tid = TypeId ("ns3::SocketRecvIfTag")
453
    .SetParent<Tag> ()
454
    .AddConstructor<SocketRecvIfTag> ()
455
    ;
456
  return tid;
457
}
458
TypeId
459
SocketRecvIfTag::GetInstanceTypeId (void) const
460
{
461
  return GetTypeId ();
462
}
463
464
uint32_t 
465
SocketRecvIfTag::GetSerializedSize (void) const
466
{ 
467
  return sizeof(uint32_t);
468
}
469
void 
470
SocketRecvIfTag::Serialize (TagBuffer i) const
471
{ 
472
  i.WriteU32 (m_ifindex);
473
}
474
void 
475
SocketRecvIfTag::Deserialize (TagBuffer i)
476
{ 
477
  m_ifindex = i.ReadU32 ();
478
}
479
void
480
SocketRecvIfTag::Print (std::ostream &os) const
481
{
482
  os << "RecvIf=" << (uint32_t) m_ifindex;
483
}
484
431
}//namespace ns3
485
}//namespace ns3
(-)a/src/node/socket.h (+25 lines)
 Lines 79-84    Link Here 
79
    ERROR_INVAL,
79
    ERROR_INVAL,
80
    ERROR_BADF,
80
    ERROR_BADF,
81
    ERROR_NOROUTETOHOST,
81
    ERROR_NOROUTETOHOST,
82
    ERROR_NODEV,
83
    ERROR_ADDRNOTAVAIL,
82
    SOCKET_ERRNO_LAST
84
    SOCKET_ERRNO_LAST
83
  };
85
  };
84
86
 Lines 579-584    Link Here 
579
  bool m_dontFragment;
581
  bool m_dontFragment;
580
};
582
};
581
583
584
/**
585
 * \brief This class implements a tag that carries the information of
586
 * received interface of a packet to the socket layer
587
 */
588
class SocketRecvIfTag : public Tag
589
{
590
public:
591
  SocketRecvIfTag ();
592
  void SetRecvIf (uint32_t ifindex);
593
  uint32_t GetRecvIf (void) const;
594
595
  static TypeId GetTypeId (void);  
596
  virtual TypeId GetInstanceTypeId (void) const;
597
  virtual uint32_t GetSerializedSize (void) const;
598
  virtual void Serialize (TagBuffer i) const;
599
  virtual void Deserialize (TagBuffer i);
600
  virtual void Print (std::ostream &os) const;
601
602
private:
603
  uint8_t m_ifindex;
604
};
605
606
582
} //namespace ns3
607
} //namespace ns3
583
608
584
#endif /* SOCKET_H */
609
#endif /* SOCKET_H */

Return to bug 671