From 11c4bec9e8752a0856b41fffcd9f8df430cabc85 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Fri, 29 Aug 2008 23:07:21 +0200 Subject: [PATCH] ipv4-end-point-demux: add method to fetch list of all endpoints GetAllEndPoints() will be used by the network simulation cradle. After a wakeup event, all sockets (Endpoints) have to be checked for state changes. --- src/internet-stack/ipv4-end-point-demux.cc | 18 ++++++++++++++++++ src/internet-stack/ipv4-end-point-demux.h | 1 + 2 files changed, 19 insertions(+) diff --git a/src/internet-stack/ipv4-end-point-demux.cc b/src/internet-stack/ipv4-end-point-demux.cc index 3d3f779be..54ed3fbbe 100644 --- a/src/internet-stack/ipv4-end-point-demux.cc +++ b/src/internet-stack/ipv4-end-point-demux.cc @@ -168,6 +168,24 @@ Ipv4EndPointDemux::DeAllocate (Ipv4EndPoint *endPoint) } } +/* + * return list of all available Endpoints + */ +Ipv4EndPointDemux::EndPoints +Ipv4EndPointDemux::GetAllEndPoints (void) +{ + NS_LOG_FUNCTION_NOARGS (); + EndPoints ret; + + for (EndPointsI i = m_endPoints.begin (); i != m_endPoints.end (); i++) + { + Ipv4EndPoint* endP = *i; + ret.push_back(endP); + } + return ret; +} + + /* * If we have an exact match, we return it. * Otherwise, if we find a generic match, we return it. diff --git a/src/internet-stack/ipv4-end-point-demux.h b/src/internet-stack/ipv4-end-point-demux.h index 61e580e3c..58a417264 100644 --- a/src/internet-stack/ipv4-end-point-demux.h +++ b/src/internet-stack/ipv4-end-point-demux.h @@ -48,6 +48,7 @@ public: Ipv4EndPointDemux (); ~Ipv4EndPointDemux (); + EndPoints GetAllEndPoints (void); bool LookupPortLocal (uint16_t port); bool LookupLocal (Ipv4Address addr, uint16_t port); EndPoints Lookup (Ipv4Address daddr,