|
USBIP C library 0.7.0
Virtual USB devices & host drivers over USB/IP
|
The wire under every host/device call. More...
Files | |
| file | usbip.h |
| Shared, role-neutral types and the transport seam. | |
Typedefs | |
| typedef struct usb_transport | usb_transport |
| Opaque handle to a USB/IP transport (the wire under host/device calls). | |
Functions | |
| usb_transport * | usbip_transport (const char *host, int port) |
| Create a real USB/IP transport over TCP. | |
| usb_transport * | usbip_loopback (void) |
| Create an in-process transport for tests - no sockets, no kernel, no root. | |
| void | usbip_transport_free (usb_transport *transport) |
| Release a transport created by usbip_transport() / usbip_loopback(). | |
The wire under every host/device call.
Only this module knows about USB/IP. Every host and device entry point takes an optional usb_transport *; NULL selects the default local transport, and usbip_transport() serves or connects over TCP. The device side listens on the handle and the host side connects to it (roles).
| typedef struct usb_transport usb_transport |
Opaque handle to a USB/IP transport (the wire under host/device calls).
| usb_transport * usbip_transport | ( | const char * | host, |
| int | port | ||
| ) |
Create a real USB/IP transport over TCP.
Hand the result to usbip_device_plug() (device side) or usbip_host_set_transport() (host side). Ownership stays with the caller: release it with usbip_transport_free() once the device is unplugged / the host context is exited.
| host | Peer/bind address. On the host side, the USB/IP server to connect to; on the device side, the local address to serve on. Pass NULL for the local default (connect to 127.0.0.1, serve on 0.0.0.0). |
| port | TCP port; the USB/IP well-known port is 3240. |
NULL on allocation failure. | usb_transport * usbip_loopback | ( | void | ) |
Create an in-process transport for tests - no sockets, no kernel, no root.
A device plugged onto a loopback transport can be driven by a host built on the same handle, entirely within one process; the test suite uses this for cross-language verification.
NULL on allocation failure. | void usbip_transport_free | ( | usb_transport * | transport | ) |
Release a transport created by usbip_transport() / usbip_loopback().
The transport must no longer be in use - unplug the device (usbip_device_unplug()) and exit any host context (usbip_host_exit()) first.
| transport | the transport to free. |