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