table of contents
|libvdeplug(3)||Linux Programmer's Manual||libvdeplug(3)|
vde_open, vde_recv, vde_send, vde_send, vde_recv, vde_close - connect clients to a VDE (virtual distributed ethernet) network
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.
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://220.127.116.11. The default module is libvdeplug_vde(1) (connection to a vde_switch(1)) 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) or select(2) (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.
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.
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").
Bug reports should be addressed to <email@example.com>
Renzo Davoli <firstname.lastname@example.org>