[aspectc-user] Error with nested classes

Guilherme . guibufolo at gmail.com
Mon Jun 27 18:14:56 CEST 2011


Hi!

The code i am trying to weave uses following construct:

namespace{
class A{};

class A::B{};
};

which the ac++ compilere quits with:

error: `A' is not a member of `::'

This is a simplified example. I was not able to reproduce this with a
minimal example. That is why i am attaching the whole source at the end.

Best regards,
Guilherme


The exact message is:
elements/ip6/addresstranslator.hh:139: error: `AddressTranslator' is not a
member of `::'

The macros CLICK_DECLS and CLICK_ENDDECLS map to "namespace Click {" and
"};" respectively.

Code:
  1 #ifndef CLICK_ADDRESSTRANSLATOR_HH
  2 #define CLICK_ADDRESSTRANSLATOR_HH
  3 #include <click/ip6address.hh>
  4 #include <click/ipaddress.hh>
  5 #include <click/vector.hh>
  6 #include <click/element.hh>
  7 #include <click/bighashmap.hh>
  8 #include <click/ip6flowid.hh>
  9 CLICK_DECLS
 10
 11 //#include <time.h>
 12
 13
 14 /*
 15  * =c
 16  * AddressTranslator(number_of_static_Mapping,
 17  *                   StaticPortMapping,
 18  *                   StaticMapping1,...
 19  *                   StaticMappingm,
 20  *                   DynamicMapping,
 21  *                   DynamicPortMapping,
 22  *                   AddressAllocationDirection,
 23  *                   Mapped_IP6Address Port_start Port_end)
 24  *
 25  *
 26  * =s ip6
 27  * translates IPv6/ICMPv6, TCP, and UDP packets' addresses and ports
 28  *
 29  * =d
 30  * Translates IPv6/ICMPv6, TCP, and UDP packets by changing their source
address,
 31  * source port, destination address, and/or destination port.
 32  *
 33  * Has one or more inputs and one or more outputs. Input packets must
have
 34  * their IP6 header annotations set. Output packets are valid IP6
packets; for
 35  * instance, translated packets have their checksums updated.
 36  *
 37  * AddressTranslator maintains a table of mappings for static address
and port
 38  * mapping and dynamic address mapping.  It contains fields such
 39  * as _iai, _ipi, _mai, _mpi, _ea, _ep, _t, _binding, _state, _static.
 40  * For static mapping, the addresses (and ports) are mapped when the
AddressTranslator
 41  * is initiated. For dynamic mapping, mappings are created on the fly as
new flows
 42  * arrives from the direction that can be allocate new mapped
address/port.
 43  *
 44  * For dynamic address and port configuration, the AddressTranslator
maintains two tables
 45  * _in_map and _out_map to map flow ID for outward packet and inward
packet respectively.
 46  *
 47  * If the AddressTranslator is configured as static mapping or dynamic
address mapping,
 48  * when a packet arrives, the AddressTranslator will first check entries
in the
 49  * address-mapping * table, see if there exists an entry for the flow
that the packet
 50  * belongs to.  If there's such an entry,then the packet's source
address (and port)
 51  * will be replaced with the mapped address (and port) of the entry for
the outward packet
 52  * and the packet's destination address (and port) will be replaced with
the inner host's
 53  * address (and port) for the inward packet.
 54  *
 55  * If there is no such an entry and it is configured for dynamic address
mapping, then the
 56  * translator will create a binding for the new mapping if the flow
comes from the right direction (the direction that allocates a new mapping
is allowed). Otherwise, the packet is disca    rded.
 57  *
 58  * If the AddressTranslator is configured for dynamic address and port
mapping,the
 59  * AddressTranslator will first check entries in the _in_map or _out_map
table, depending on
 60  * packet's direction. It checks if the table has an entry whose flowID
is the same as the packet.
 61  * If there is,  use the mapped flowID of that entry for the packet.
Otherwise, it will try to
 62  * find an unsed port and create a mapped flowID for the flow and insert
the entry, if the packet
 63  * comes from the right direction.
 64
 65  *
 66  * =a ProtocolTranslator64, ProtocolTranslator46 */
 67
 68 class AddressTranslator : public Element {
 69
 70  public:
 71
 72   class Mapping;
 73
 74   AddressTranslator();
 75   ~AddressTranslator();
 76
 77   const char *class_name() const    { return "AddressTranslator"; }
 78   const char *port_count() const    { return "2/2"; }
 79   const char *processing() const  { return AGNOSTIC; }
 80   int configure(Vector<String> &, ErrorHandler *);
 81   void push(int port, Packet *p);
 82   void add_map(IP6Address &mai,  bool binding);
 83   void add_map(IP6Address &iai, unsigned short ipi, IP6Address &mai,
unsigned short mpi, IP6Address &ea, unsigned short ep, bool binding);
 84   void handle_outward(Packet *p);
 85   void handle_inward(Packet *p);
 86
 87   bool lookup(IP6Address &, unsigned short &, IP6Address &, unsigned
short &, IP6Address &, unsigned short &, bool);
 88   void cleanup(CleanupStage);
 89
 90 protected:
 91
 92  struct EntryMap {
 93     IP6Address _iai;
 94     unsigned short _ipi;
 95     IP6Address _mai;
 96     unsigned short _mpi;
 97     IP6Address _ea;
 98     unsigned short _ep;
 99     //long unsigned int _t;
100      //time_t  _t;  //the last time that the packet passed the address
translator
101                  //later: the time when FIN received from both direction
for TCP
102                  //the time that the UDP packet has been sent for this
session.
103    //unsigned char _state;
104     bool _binding;
105     bool _static;
106 };
107   Vector<EntryMap> _v;
108
109
110   int _number_of_smap; // number of static-mapping entry
111   bool _static_portmapping;
112   bool _dynamic_mapping;
113   bool _dynamic_portmapping;
114   bool _dynamic_mapping_allocation_direction;
115
116
117   //the index of the following bool array corresponds to the colums of
118   //_iai, _ipi, _mai, _mpi, _ea, _ep
119   bool _static_mapping[6];
120
121
122   //using new approach
123   typedef HashMap<IP6FlowID, Mapping *> Map6;
124   void clean_map(Map6 &, bool);
125   unsigned short find_mport( );
126   void mapping_freed(Mapping *, bool);
127
128   Map6 _in_map;
129   Map6 _out_map;
130   IP6Address _maddr;
131   unsigned short _mportl, _mporth;
132   Mapping *_rover;
133   Mapping *_rover2;
134   int _nmappings;
135   int _nmappings2;
136
137 };
138
139 class Click::AddressTranslator::Mapping {
140
141  public:
142
143   Mapping();
144   void initialize(const IP6FlowID & new_flow) { _mapto = new_flow;     }
145   const IP6FlowID &flow_id() const    {  return _mapto;        }
146   unsigned short sport() const        { return _mapto.sport(); }
147   unsigned short dport() const        { return _mapto.dport(); }
148   //String s() const                  { return " ";    }
149   Mapping * get_next()                { return _next; }
150   Mapping * get_prev()                { return _prev; }
151   void set_next(Mapping * next)       { _next = next; }
152   void set_prev(Mapping * prev)       { _prev = prev; }
153   Mapping *free_next() const    { return _free_next; }
154   void set_free_next(Mapping *m)      {_free_next = m;}
155
156
157  protected:
158   //long unsigned int _t;
159   IP6FlowID _mapto;
160   Mapping *_prev;
161   Mapping *_next;
162   Mapping *_free_next;
163
164   friend class AddressTranslator;
165 };
166
167 CLICK_ENDDECLS
168 #endif
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.aspectc.org/pipermail/aspectc-user/attachments/20110627/0d8b539a/attachment.html>


More information about the aspectc-user mailing list