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

# ioth\_iplink\_del(3)

Internet of Threads (IoTh) library

Part of [ioth(3)](/ioth/3.md).

## NAME

ioth\_newstack, ioth\_newstackl, ioth\_newstackv, ioth\_delstack, ioth\_msocket, ioth\_set\_defstack, ioth\_get\_defstack, ioth\_socket, ioth\_close, ioth\_bind, ioth\_connect, ioth\_listen, ioth\_accept, ioth\_getsockname, ioth\_getpeername, ioth\_setsockopt, ioth\_getsockopt, ioth\_shutdown, ioth\_ioctl, ioth\_fcntl, ioth\_read, ioth\_readv, ioth\_recv, ioth\_recvfrom, ioth\_recvmsg, ioth\_write, ioth\_writev, ioth\_send, ioth\_sendto ioth\_sendmsg, ioth\_if\_nametoindex, ioth\_linksetupdown, ioth\_ipaddr\_add, ioth\_ipaddr\_del, ioth\_iproute\_add, ioth\_iproute\_del, ioth\_iplink\_add, ioth\_iplink\_del, ioth\_linksetaddr, ioth\_linkgetaddr - Internet of Threads (IoTh) library

## SYNOPSIS

**#include \<ioth.h\>**

**struct ioth \*ioth\_newstack(const char \****stack***, const char \****vnl***);**

**struct ioth \*ioth\_newstackl(const char \****stack***, const char \****vnl***, ... );**

**struct ioth \*ioth\_newstackv(const char \****stack***, const char \****vnlv***\[\]);**

**int ioth\_delstack(struct ioth \****iothstack***);**

**int ioth\_msocket(struct ioth \****iothstack***, int** *domain***, int** *type***, int** *protocol***);**

**void ioth\_set\_defstack(struct ioth \****iothstack***);**

**struct ioth \*ioth\_get\_defstack(void);**

**int ioth\_socket(int** *domain***, int** *type***, int** *protocol***);**

- •

  Berkeley Sockets API

**int ioth\_close(int** *fd***);**

**int ioth\_bind(int** *sockfd***, const struct sockaddr \****addr***, socklen\_t** *addrlen***);**

**int ioth\_connect(int** *sockfd***, const struct sockaddr \****addr***, socklen\_t** *addrlen***);**

**int ioth\_listen(int** *sockfd***, int** *backlog***);**

**int ioth\_accept(int** *sockfd***, struct sockaddr \*restrict** *addr***, socklen\_t \*restrict** *addrlen***);**

**int ioth\_getsockname(int** *sockfd***, struct sockaddr \*restrict** *addr***, socklen\_t \*restrict** *addrlen***);**

**int ioth\_getpeername(int** *sockfd***, struct sockaddr \*restrict** *addr***, socklen\_t \*restrict** *addrlen***);**

**int ioth\_getsockopt(int** *sockfd***, int** *level***, int** *optname***, void \*restrict** *optval***, socklen\_t \*restrict** *optlen***);**

**int ioth\_setsockopt(int** *sockfd***, int** *level***, int** *optname***, const void \****optval***, socklen\_t** *optlen***);**

**int ioth\_shutdown(int** *sockfd***, int** *how***);**

**int ioth\_ioctl(int** *fd***, unsigned long** *request***, ...);**

**int ioth\_fcntl(int** *fd***, int** *cmd***, ... /\* arg \*/ );**

**ssize\_t ioth\_read(int** *fd***, void \****buf***, size\_t** *count***);**

**ssize\_t ioth\_readv(int** *fd***, const struct iovec \****iov***, int** *iovcnt***);**

**ssize\_t ioth\_recv(int** *sockfd***, void \****buf***, size\_t** *len***, int** *flags***);**

**ssize\_t ioth\_recvfrom(int** *sockfd***, void \*restrict** *buf***, size\_t** *len***, int** *flags***, struct sockaddr \*restrict** *src\_addr***, socklen\_t \*restrict** *addrlen***);**

**ssize\_t ioth\_recvmsg(int** *sockfd***, struct msghdr \****msg***, int** *flags***);**

**ssize\_t ioth\_write(int** *fd***, const void \****buf***, size\_t** *count***);**

**ssize\_t ioth\_writev(int** *fd***, const struct iovec \****iov***, int** *iovcnt***);**

**ssize\_t ioth\_send(int** *sockfd***, const void \****buf***, size\_t** *len***, int** *flags***);**

**ssize\_t ioth\_sendto(int** *sockfd***, const void \****buf***, size\_t** *len***, int** *flags***, const struct sockaddr \****dest\_addr***, socklen\_t** *addrlen***);**

**ssize\_t ioth\_sendmsg(int** *sockfd***, const struct msghdr \****msg***, int** *flags***);**

- •

  nlinline+ API

**int ioth\_if\_nametoindex(const char \****ifname***);**

**int ioth\_linksetupdown(unsigned int** *ifindex***, int** *updown***);**

**int ioth\_ipaddr\_add(int** *family***, void \****addr***, int** *prefixlen***, unsigned int** *ifindex***);**

**int ioth\_ipaddr\_del(int** *family***, void \****addr***, int** *prefixlen***, unsigned int** *ifindex***);**

**int ioth\_iproute\_add(int** *family***, void \****dst\_addr***, int** *dst\_prefixlen***, void \****gw\_addr***, unsigned int** *ifindex***);**

**int ioth\_iproute\_del(int** *family***, void \****dst\_addr***, int** *dst\_prefixlen***, void \****gw\_addr***, unsigned int** *ifindex***);**

**int ioth\_iplink\_add(const char \****ifname***, unsigned int** *ifindex***, const char \****type***, const char \****data***);**

**int ioth\_iplink\_del(const char \****ifname***, unsigned int** *ifindex*\`);

**int ioth\_linksetaddr(unsigned int** *ifindex***, void \****macaddr*\`);

**int ioth\_linkgetaddr(unsigned int** *ifindex***, void \****macaddr*\`);

## DESCRIPTION

**libioth** is the API for the Internet of Threads. TCP-IP networking stacks can be loaded as dynamic libraries at run time.

- •

  the API is minimal: Berkeley Sockets + msocket + newstack/delstack.

- •

  the stack implementation can be chosen as a plugin at run time.

- •

  netlink based stack/interface/ip configuration via nlinline.

- •

  ioth sockets are real file descriptors, poll/select/ppoll/pselect/epoll friendly

- •

  plug-ins can be loaded in private address namespaces: libioth supports several stacks of the same type (same plugin) even if the stack implementation library was designed to provide just one stack.

**libioth** provides the following functions:

- **ioth\_newstack**

  **ioth\_newstack** creates a new stack without any interface if **vnl** is NULL, otherwise the new stack has a virtual interface connected to the vde network identified by the VNL (Virtual Network Locator, see [vde\_open(3)](/vde_open/3.md) ).

- **ioth\_newstackl**, **ioth\_newstackv**

  ioth\_newstackl**and**ioth\_newstackv\` (l = list, v = vector) support the creation of a new stack with several interfaces. It is possible to provide the VNLs as a sequence of arguments (as in [execl(3)](/execl/3.md)) or as a NULL terminated array of VNLs (as the arguments in [execv(3)](/execv/3.md)).

- **ioth\_delstack**

  This function terminates/deletes a stack.

- **ioth\_msocket**

  This is the multi-stack supporting extension of [socket(2)](/socket/2.md). It behaves exactly as socket except for the added heading argument that allows the choice of the stack among those currently available (previously created by a **ioth\_newstack\***).

- **ioth\_set\_defstack**, **ioth\_get\_defstack**

  These functions define and retrieve the default stack, respectively. The default stack is implicitly used by ioth\_msocket when its first argument iothstack is NULL. The default stack is initially defined as the native stack provided by the kernel. Use ioth\_set\_defstack(mystack) to define mystack as the current default stack. ioth\_set\_defstack(NULL) to revert the default stack to the native stack.

- **ioth\_socket**

  **ioth\_socket** opens a socket using the default stack: **ioth\_socket(d, t, p)** is an alias for **ioth\_msocket(NULL, d, t, p)**

- **ioth\_close**, **ioth\_bind**, **ioth\_connect**, **ioth\_listen**, **ioth\_accept**, **ioth\_getsockname**, **ioth\_getpeername**, **ioth\_setsockopt**, **ioth\_getsockopt**, **ioth\_shutdown**, **ioth\_ioctl**, **ioth\_fcntl**, **ioth\_read**, **ioth\_readv**, **ioth\_recv**, **ioth\_recvfrom**, **ioth\_recvmsg**, **ioth\_write**, **ioth\_writev**, **ioth\_send**, **ioth\_sendto**, **ioth\_sendmsg**

  these functions have the same signature and functionalities of their counterpart in (2) and (3) without the **ioth\_** prefix.

- **ioth\_if\_nametoindex**, **ioth\_linksetupdown**, **ioth\_ipaddr\_add**, **ioth\_ipaddr\_del**, **ioth\_iproute\_add**, **ioth\_iproute\_del**, **ioth\_iplink\_add**, **ioth\_iplink\_del**, **ioth\_linksetaddr**, **ioth\_linkgetaddr**

  these functions have the same signature and functionnalities described in [**nlinline**(3)](/nlinline/3.md).

## RETURN VALUE

**ioth\_newstack**, **ioth\_newstackl**, **ioth\_newstackv** return a **struct stack** pointer, NULL in case of error. This address is used as a descriptor of the newly created stack and is later passed as parameter to **ioth\_msocket**, **ioth\_set\_defstack** or **ioth\_delstack**.

**ioth\_msocket** and **ioth\_socket** return the file descriptor of the new socket, -1 in case of errore.

**ioth\_delstack** returns -1 in case of error, 0 otherwise. If there are file descriptors already in use, this function fails and errno is EBUSY.

**ioth\_get\_defstack** returns the stack descriptor of the default stack.

The return values of all the other functions are defined in the man pages of the corresponding functions provided by the GNU C library or [nlinline(3)](/nlinline/3.md)

## SEE ALSO

[vde\_plug(1)](/vde_plug/1.md), vdeplug\_open(3), [nlinline(3)](/nlinline/3.md)

## AUTHOR

VirtualSquare. Project leader: Renzo Davoli
