[Kea-users] Parsing Option 82

Gokulakrishnan Gopalakrishnan ggopalakrishnan at salesforce.com
Wed Jul 5 07:55:51 UTC 2017


Thanks Christian, Itay. It helps!

On Tue, Jul 4, 2017 at 8:21 PM, Itay Rozenberg <Itay.Rozenberg at partner.co.il
> wrote:

> For the other one (remote_id) use getOption(RAI_OPTION_AGENT_REMOTE_ID).
>
>
>
>
>
> *From:* Kea-users [mailto:kea-users-bounces at lists.isc.org] *On Behalf Of *Itay
> Rozenberg
> *Sent:* Tuesday, July 4, 2017 5:23 PM
> *To:* 'Gokulakrishnan Gopalakrishnan'
> *Cc:* 'kea-users at lists.isc.org'
> *Subject:* Re: [Kea-users] Parsing Option 82
>
>
>
>
>
> Greetings
>
>
>
>
>
> Type 001 – circuit_id - hex, you need to convert it to ascii. (try it on
> this web site: http://www.rapidtables.com/convert/number/hex-to-ascii.htm
> )
>
> Type 002 – remote_id - Mac address
>
> Each of them can be hex or mac address.
>
>
>
> Try this:
>
> std::string hexToAscii(std::string c) {
>
>         int length = c.length();
>
>         std::string newString;
>
>         for (int i = 0; i < length; i+=2) {
>
>                 std::string byte = c.substr(i, 2);
>
>                 char chr = (char)(int)strtol(byte.c_str(), NULL, 16);
>
>                 newString.push_back(chr);
>
>         }
>
>         return newString;
>
> }
>
>
>
>
>
>
>
> OptionPtr rai = query4_ptr->getOption(DHO_DHCP_AGENT_OPTIONS);
>
>         if (rai) {
>
>                 OptionPtr circuit_id_opt = rai->getOption(RAI_OPTION_
> AGENT_CIRCUIT_ID);
>
>                 if (circuit_id_opt) {
>
>                         string cid = hexToAscii(circuit_id_opt->
> toHexString().substr(2));
>
>                 }
>
>         }
>
>
>
> For the other one (remote_id) use getOption(RAI_OPTION_AGENT_CIRCUIT_ID).
>
>
>
> itay
>
>
>
> *From:* Kea-users [mailto:kea-users-bounces at lists.isc.org
> <kea-users-bounces at lists.isc.org>] *On Behalf Of *Gokulakrishnan
> Gopalakrishnan
> *Sent:* Tuesday, July 4, 2017 2:20 PM
> *To:* kea-users at lists.isc.org
> *Subject:* [Kea-users] Parsing Option 82
>
>
>
> I'm trying to print and parse Option 82 but I couldn't understand the
> format in which it is received. My 'option->toText()' print this
>
> type=082, len=024:,
> options:
>   type=001, len=014: 01:0c:45:74:68:65:72:6e:65:74:31:2f:32:39
>   type=002, len=006: 04:62:73:56:13:bc
>
>
>
> Can someone help me to understand this value?
>
>
>
> Thanks,
>
> Gokul
>
> [image: Banner] <https://www.partner.co.il/partnertvfa>
> Powered by U‑BTech *XTRA*BANNER
> <http://www.u-btech.com/products/xtrabanner/poweredby>
>
> Please do not enrich emails sent to me
> <XBanner at Orange.co.il?subject=Please%20do%20not%20enrich%20emails%20sent%20to%20me%20%5BRemoval%20Code%3A%20DNE420000%5D&body=Please%20do%20not%20enrich%20emails%20sent%20to%20me>
>
> ------------------------------------------------------------
> This message contains information that may be confidential or privileged.
> If you are not the intended recipient, you may not use, copy or disclose
> to anyone any of the information in this message. If you have received
> this message and are not the intended recipient, kindly notify the sender
> and delete this message from your computer.
>
> ------------------------------------------------------------
> This message contains information that may be confidential or privileged.
> If you are not the intended recipient, you may not use, copy or disclose
> to anyone any of the information in this message. If you have received
> this message and are not the intended recipient, kindly notify the sender
> and delete this message from your computer.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/kea-users/attachments/20170705/834e3869/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 25948 bytes
Desc: not available
URL: <https://lists.isc.org/pipermail/kea-users/attachments/20170705/834e3869/attachment.jpg>


More information about the Kea-users mailing list