---
name: "libvdeplug"
section: "3"
platform: "linux"
package: "libvdeplug-dev"
version: "4.0.1-5.1+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/libvdeplug"
---

# libvdeplug(3)

connect clients to a VDE (virtual distributed ethernet) network

## NAME

vde\_open, vde\_recv, vde\_send, vde\_send, vde\_recv, vde\_close - connect clients to a VDE (virtual distributed ethernet) network

## 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*.

## DESCRIPTION

Libvdeplug is the library used by clients to join a VDE network. It is a generic library which can use several different implementations for virtual distributed networks. In fact *vde\_url*  has the syntax *module***://***specific\_address*. e.g. **vde:///home/user/myswitch** or **vxvde://239.0.0.1**. The default module is **[libvdeplug\_vde(1)](/libvdeplug_vde/1.md)** (connection to a **[vde\_switch(1)](/vde_switch/1.md)**) and can be omitted. e.g. **/home/user/myswitch** means **vde:///home/user/myswitch**

**vde\_open** opens a VDE connection: *vde\_url* is the vde network identifier as described here above and *descr* is a description of this connection (it can be useful to identify this connection in the port list of a switch). open\_args has been left for backwards compatibility but can be safely set to NULL as all the options previosly defined as fields of *struct vde\_open\_args* are now  parameters of the VDE modules (can be defined using a module specific syntax in 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)](/poll/2.md)** or **[select(2)](/select/2.md)** (or similar) system calls. When this descriptor signals data available for reading **vde\_recv** will not block.

**vde\_ctlfd** returns the control file descriptor of the connection. Not all the modules support control descritors, but when it is valid descriptor (greater or equal than 0) can be used to check if the remote  endpoint (switch or peer) hanged up. No data can be sent or received using the control file descriptor,  it returns an end-of-file condition when the connection get closed (zero length on reading).

**vde\_close** closes a vde connections.

## RETURN VALUE

**vde\_open** returns the descriptor of the VDE connection which is 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 then 14 bytes (the length of\
 		an ethernet header). It returns -1 in case of error, 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.

## 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").

## SEE ALSO

[**vde\_plug**(1)](/vde_plug/1.md), [**vde\_switch**(1)](/vde_switch/1.md)

## BUGS

Bug reports should be addressed to \<info@virtualsquare.org\>

## AUTHOR

Renzo Davoli \<renzo@cs.unibo.it\>
