/* SPDX-License-Identifier: BSD-3-Clause */ #ifndef LIBSLIRP_H #define LIBSLIRP_H #include #include #include #ifdef _WIN32 #include #include #else #include #include #endif #include "libslirp-version.h" #ifdef __cplusplus extern "C" { #endif /* Opaque structure containing the slirp state */ typedef struct Slirp Slirp; /* Flags passed to SlirpAddPollCb and to be returned by SlirpGetREventsCb. */ enum { SLIRP_POLL_IN = 1 << 0, SLIRP_POLL_OUT = 1 << 1, SLIRP_POLL_PRI = 1 << 2, SLIRP_POLL_ERR = 1 << 3, SLIRP_POLL_HUP = 1 << 4, }; typedef ssize_t (*SlirpReadCb)(void *buf, size_t len, void *opaque); typedef ssize_t (*SlirpWriteCb)(const void *buf, size_t len, void *opaque); typedef void (*SlirpTimerCb)(void *opaque); typedef int (*SlirpAddPollCb)(int fd, int events, void *opaque); typedef int (*SlirpGetREventsCb)(int idx, void *opaque); /* * Callbacks from slirp, to be set by the application. * * The opaque parameter is set to the opaque pointer given in the slirp_new / * slirp_init call. */ typedef struct SlirpCb { /* * Send an ethernet frame to the guest network. The opaque * parameter is the one given to slirp_init(). The function * doesn't need to send all the data and may return