[AGENT++] Vb::get_value(...) and IP-address

Jochen Katz katz at agentpp.com
Wed Aug 25 23:07:34 CEST 2004


Hi,

you hit a bug in address classes.

> But, I have another problem using IpAddress.

>             IpAddress ipa;

The "valid" flag for a Address object created this way is "false"

>             ipa[0] = buffer[0];
>             ipa[1] = buffer[1];
>             ipa[2] = buffer[2];
>             ipa[3] = buffer[3];

These set-functions don't change the "valid" flag, as they cannot know 
when the address is valid.

>             vb.set_value(ipa);

So an invalid address is added to the Vb, which therefore hasn't a valid 
value and returns a zero string for get_value().

The solution would be to define that an Address created like above 
defaults to "0.0.0.0" which is a "valid" address. Additionally the valid 
flag should be set to true whenever operator[] is called.

Any objections against these two changes? If yes, provide a better 
solution ;-)

Regards,
   Jochen



More information about the AGENTPP mailing list