c++ - prefix length calculation for ipv6 addresses -


i want calculate prefix length ipv4 , ipv6 addresses . subnet mask can in form of string(1 , 32 ,97 etc) or in dotted format(255.255.0.0) . want impose following conditions. 1)for ipv4 , both formats should allowed . when cast string unsigned , prefix length should not more 31 2)for ipv6 prefix length allowed . should not more 127

although can above calculations pretty passing sub routine , have been asked use boost defined classes , methods same .

can suggest appropriate boost methods above . i've tried searching , unable so.

the paramaters can mask in prefix length string format (16 , 97) or in dotted format , , maybe address(string) . boost methods should able determine prefix length unsigned based on restrictions mentioned.

useful boost parts regex, analyze got, , lexical_cast turn string number.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -