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

don radick dradick at mindspring.com
Thu Aug 26 12:12:23 CEST 2004


I agree - while any "good" agent should only set an IP address to
integer 255 - 0 , if you have a "valid" flag in the class, the stored
value should be range-checked.

-Don



Karl Abicht wrote:

>Hi,
>
>setting "0.0.0.0" and 'valid' as default is good.
>
>But, if a value is set by [] you should check all values and set the
>'valid'-flag according to this.
>
>If I do ip[0]=300 the flag should be false.
>
>
>Regards,
>
>Karl
>
>
>  
>
>>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
>>_______________________________________________
>>AGENTPP mailing list
>>AGENTPP at agentpp.org
>>http://agentpp.org/mailman/listinfo/agentpp
>>
>>    
>>
>
>  
>




More information about the AGENTPP mailing list