libvdeplug(3)

🌈 libvdeplug β€” the manual, but make it cute 🌈

okay so bestie, you know that library that lets clients join a VDE network? Yeah. That's this one. It's from the Linux Programmer's Manual, and it's literally the friendliest way to plug yourself into a virtual distributed ethernet. Let's get into it πŸ’…


✨ NAME ✨

vde_open, vde_recv, vde_send, vde_send, vde_recv, vde_close β€” connect clients to a VDE (virtual distributed ethernet) network.

no bc the way vde_send and vde_recv are each listed twice in here… iconic, we don't question it, we just vibe 😭

πŸ¦‹ SYNOPSIS πŸ¦‹

#include <libvdeplug.h>
VDECONN *vde_open(char *vde_url,char *descr, struct vde_open_args *open_args);
ssize_t vde_recv(VDECONN *conn,void *buf,size_t len,int flags);
ssize_t vde_send(VDECONN *conn,const void *buf,size_t len,int flags);
int vde_datafd(VDECONN *conn);
int vde_ctlfd(VDECONN *conn);
int vde_close(VDECONN *conn);

These functions are provided by libvdeplug. Link with -lvdeplug.

Link with -lvdeplug or you're just out here calling ghosts, fr fr πŸ‘»


πŸ’– DESCRIPTION πŸ’–

Libvdeplug is the library clients use to join a VDE network. It's a generic library, which means it can use several different implementations for virtual distributed networks. Like, it's not locked into one vibe, it's flexible ✨

In fact, vde_url has the syntax:

module://specific_address

for example vde:///home/user/myswitch or vxvde://239.0.0.1.

The default module is libvdeplug_vde(1) (connection to a vde_switch(1)) and it can be omitted β€” so for example /home/user/myswitch means vde:///home/user/myswitch. Slay, drop the module name, it's fine πŸ’…

  • vde_open β€” opens a VDE connection. vde_url is the vde network identifier as described right up there, and descr is a description of this connection (which is genuinely useful for identifying this connection in the port list of a switch, bestie, use it). open_args has been left in for backwards compatibility but can safely be set to NULL, because all the options that used to be fields of struct vde_open_args are now parameters of the VDE modules (and you can define them using a module-specific syntax inside vde_url).
  • vde_recv β€” receives a packet from the VDE connection. πŸ“₯
  • vde_send β€” sends a packet to the VDE connection. πŸ“€
  • vde_datafd β€” returns the data file descriptor of the connection. This descriptor can be used in poll(2) or select(2) (or similar) system calls. When this descriptor signals that data is available for reading, vde_recv will not block. chef's kiss, that's the whole point 🫢
  • vde_ctlfd β€” returns the control file descriptor of the connection. Not all the modules support control descriptors, but when it is a valid descriptor (greater or equal than 0) it can be used to check if the remote endpoint (switch or peer) hung up. You can't send or receive any data using the control file descriptor β€” it returns an end-of-file condition when the connection gets closed (zero length on reading).
  • vde_close β€” closes a vde connection. bye bestie πŸ‘‹

πŸ”₯ RETURN VALUE πŸ”₯

  • vde_open returns the descriptor of the VDE connection, which is then used as a parameter of all the other functions. NULL is returned in case of error.
  • vde_recv returns the length of the packet received. It should never be less than 14 bytes (the length of an ethernet header). It returns -1 in case of error, and it may return 1 to notify that a packet has been received but it must be dropped (e.g. the sender was not allowed to send that packet). πŸ’€
  • vde_send returns the number of bytes sent. It returns -1 in case of error.
  • vde_datafd and vde_ctlfd returns a file descriptor and -1 in case of error.
  • vde_datafd returns 0 in case of success and -1 in case of error.
⚠️ okay so yes, vde_datafd is the star of the last two bullets and the second one lowkey reads like it was meant for somebody else, but that's literally what the page says so I'm not touching it. Not me editorializing, I'm just the messenger πŸ™ˆ

πŸ‘‘ NOTICE πŸ‘‘

Virtual Distributed Ethernet is not related in any way with www.vde.com ("Verband der Elektrotechnik, Elektronik und Informationstechnik" i.e. the German "Association for Electrical, Electronic & Information Technologies").

Like, completely different thing. Do not mix them up. Periodt. βœ‹


🌸 SEE ALSO 🌸

go read those too, iykyk πŸ“š


πŸ› BUGS πŸ›

Bug reports should be addressed to <info@virtualsquare.org> β€” they're literally asking, so if you found something, tell them 🫢


⭐ AUTHOR ⭐

Renzo Davoli <renzo@cs.unibo.it> β€” the main character of this whole library, we love to see it πŸ‘‘


and that's the whole page, bestie πŸŽ€ this little slice of the <b>VirtualSquare</b> world is dated <b>2017-05-21</b>, and if you ever need to look it up again it lives as <b>libvdeplug(3)</b> in the Linux Programmer's Manual. mwah πŸ’‹