<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">We went through a similar discussion as C++ is not a preferred language in our company. I ended up modifying the example script hook to call another executable and it works very well. As a bonus, you don’t have to touch the hook code once you have it doing what you need.<div><br></div><div>I think you will be better off from an ongoing support perspective to do a thin piece of hook code and call a Rust binary from there.</div><div><br></div><div>Scott<br><div><br><blockquote type="cite"><div>On Dec 9, 2022, at 09:01, Eric Graham <eric.graham@vantagepnt.com> wrote:</div><br class="Apple-interchange-newline"><div><meta charset="UTF-8"><div class="elementToProof" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span class="ContentPasted0 ContentPasted1" style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; background-color: rgb(255, 255, 255);">Thanks for the link! I have gone through that page and the instructions are thorough. There are projects like CXX (<a href="https://cxx.rs/" id="LPNoLPOWALinkPreview">https://cxx.rs/</a>) that help with the Rust <--> C++ stuff, but to be honest, I am new to Rust (Python is one I'm more familiar with, but I am not interested in writing the hook in Python at this stage - speed<span class="Apple-converted-space"> </span><a href="https://stackoverflow.com/questions/801657/is-python-faster-and-lighter-than-c" id="LPNoLPOWALinkPreview_1">https://stackoverflow.com/questions/801657/is-python-faster-and-lighter-than-c</a><span class="Apple-converted-space"> </span>and type safety). I assume something is wrong with how I'm linking against Kea, but I don't know. Unfortunately, the debug log during hook loading is not terribly helpful. I am confident it's possible, though.<br></span></div><div class="_Entity _EType_OWALinkPreview _EId_OWALinkPreview_1 _EReadonly_1" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"></div><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><div class="_Entity _EType_OWALinkPreview _EId_OWALinkPreview _EReadonly_1" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"></div><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><div style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><div id="appendonsend"></div><div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;"><br></div><hr tabindex="-1" style="display: inline-block; width: 983.90625px;"><div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size: 11pt;"><b>From:</b><span class="Apple-converted-space"> </span>Darren Ankney <darren.ankney@gmail.com><br><b>Sent:</b><span class="Apple-converted-space"> </span>Friday, December 9, 2022 9:49 AM<br><b>To:</b><span class="Apple-converted-space"> </span>Eric Graham <eric.graham@vantagepnt.com><br><b>Cc:</b><span class="Apple-converted-space"> </span>kea-users@lists.isc.org <kea-users@lists.isc.org><br><b>Subject:</b><span class="Apple-converted-space"> </span>Re: [Kea-users] Hook Development - Rust</font><div> </div></div><div class="BodyFragment"><font size="2"><span style="font-size: 11pt;"><div class="PlainText">Apologies if you've already found this guide, but here is a link to<br>the hook developers guide:<br><br><a href="https://reports.kea.isc.org/dev_guide/df/d46/hooksdgDevelopersGuide.html" data-auth="NotApplicable">https://reports.kea.isc.org/dev_guide/df/d46/hooksdgDevelopersGuide.html</a><br><br>I'm not super familiar with rust myself (though I have played around<br>with it) but you can't just include header files that were meant for<br>'c' or 'c++' right? At least from what little i've done, it didn't<br>seem so... it seemed they had their own API and an application to<br>search user created extensions for such. The developer's guide I<br>linked says it should be possible to create hooks in other languages.<br>They mention Python. I'd say Rust is way closer to C++ the Python<br>is... so it should be possible?<br><br>On Fri, Dec 9, 2022 at 10:32 AM Eric Graham <eric.graham@vantagepnt.com> wrote:<br>><br>> Hi Darren,<br>><br>> Thanks for the link! I actually have already done so, but for a few reasons (I believe it is slower than a hook, and it's limited) I would prefer to write a "native" one.<br>><br>> I sure wish it would have been implemented differently, as something like gRPC + protobuf!<br>><br>><br>> ________________________________<br>> From: Darren Ankney <darren.ankney@gmail.com><br>> Sent: Thursday, December 8, 2022 7:34 PM<br>> To: kea-users@lists.isc.org <kea-users@lists.isc.org><br>> Subject: Re: [Kea-users] Hook Development - Rust<br>><br>> If nothing else, perhaps you could make use of the run_script hook:<br>><span class="Apple-converted-space"> </span><a href="https://kea.readthedocs.io/en/kea-2.2.0/arm/hooks.html#run-script-run-script-support-for-external-hook-scripts" data-auth="NotApplicable">https://kea.readthedocs.io/en/kea-2.2.0/arm/hooks.html#run-script-run-script-support-for-external-hook-scripts</a><br>> You could probably write the "script" in whatever language you want,<br>> including rust, or at least that's the way I interpret it.<br>><br>> On Thu, Dec 8, 2022 at 2:16 PM Eric Graham <eric.graham@vantagepnt.com> wrote:<br>> ><br>> > Hello! First time using this / any mailing list, so critiques welcome.<br>> ><br>> > I am looking into the possibility of writing a Rust hook. I understand that using C++ is likely the simplest alternative, but Rust is attractive for its memory safety and speed. I have not had luck finding any Kea hook in Rust to use as a starting point. The C FFI is a complicating factor. In fact, I have not had luck getting a very basic PoC to register with Kea, just implementing version(). Does anyone know of a hook even partially implemented in Rust, or have interest in doing so?<br>> ><br>> > Thank you,<br>> > Eric<br>> ><br>> > If this email belongs in the dev list, please correct me. Thanks.<br>> > This message is intended solely for the use of the individual and entity to whom it is addressed and may contain information that is privileged, confidential, and exempt from disclosure under applicable state and federal laws. If you are not the addressee or are not authorized to receive for the intended addressee you are hereby notified that you may not use, copy, distribute, or disclose to anyone this message or the information contained herein. If you have received this message in error, immediately advise the sender by reply email and destroy this message.<br>> > --<br>> > ISC funds the development of this software with paid support subscriptions. Contact us at<span class="Apple-converted-space"> </span><a href="https://www.isc.org/contact/" data-auth="NotApplicable">https://www.isc.org/contact/</a><span class="Apple-converted-space"> </span>for more information.<br>> ><br>> > To unsubscribe visit<span class="Apple-converted-space"> </span><a href="https://lists.isc.org/mailman/listinfo/kea-users" data-auth="NotApplicable">https://lists.isc.org/mailman/listinfo/kea-users</a>.<br>> ><br>> > Kea-users mailing list<br>> > Kea-users@lists.isc.org<br>> ><span class="Apple-converted-space"> </span><a href="https://lists.isc.org/mailman/listinfo/kea-users" data-auth="NotApplicable">https://lists.isc.org/mailman/listinfo/kea-users</a><br>><br>> --<br>> ISC funds the development of this software with paid support subscriptions. Contact us at<span class="Apple-converted-space"> </span><a href="https://www.isc.org/contact/" data-auth="NotApplicable">https://www.isc.org/contact/</a><span class="Apple-converted-space"> </span>for more information.<br>><br>> To unsubscribe visit<span class="Apple-converted-space"> </span><a href="https://lists.isc.org/mailman/listinfo/kea-users" data-auth="NotApplicable">https://lists.isc.org/mailman/listinfo/kea-users</a>.<br>><br>> Kea-users mailing list<br>> Kea-users@lists.isc.org<br>><span class="Apple-converted-space"> </span><a href="https://lists.isc.org/mailman/listinfo/kea-users" data-auth="NotApplicable">https://lists.isc.org/mailman/listinfo/kea-users</a><br><br></div></span></font></div></div><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">--<span class="Apple-converted-space"> </span></span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">ISC funds the development of this software with paid support subscriptions. Contact us at https://www.isc.org/contact/ for more information.</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">Kea-users mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">Kea-users@lists.isc.org</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">https://lists.isc.org/mailman/listinfo/kea-users</span></div></blockquote></div><br></div></body></html>