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
Post a Comment