API Code Examples? #487
-
Hello! I'm developing some C code that will use LLDP to query neighbors and specific information about them (interface, MAC, and IP). I've used the documentation in lldpctl.h to write the code below, which seems to work well. Right now it's just printing the IP and interfaces, but eventually I'll update it to probably push that info into a structure. Next I'd like to register a callback to basically reset all the gathered information and re-query whenever any neighbor change is detected. I've read the documentation on lldpctl_watch_callback2 and lldpctl_change_callback2, but I'm still having some trouble implementing it. I'm probably not as proficient with C as I ought to be. Is there any example code out there you can point me to that I can use as a template? If it exists, I couldn't find it. Thanks in advance for any help you can provide.
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
|
Beta Was this translation helpful? Give feedback.
-
We are using this API to gather info on POE status, and to reconfigure POE. However, we have a problem that during boot, lldpd is reconfigured twice with added device name and (it seems) port filtering. When this happens, it seems like the lldpd API freezes, and may give bad responses. I am thinking of the time between these prints:
We have been discussing that maybe if we control everything from the process that uses the lldpd API, we may get rid of these problems since we can control when it is done. But this will cause a bit of work which we haven't started on yet. What is your proposal for these cases @vincentbernat? |
Beta Was this translation helpful? Give feedback.
lldpcli
uses the same API. So, you can look at its code to see how it is implemented.lldpctl_watch_callback2()
is used inlldpcli
.