Debian Codegraph @

src/transport-private.h

raw symbols SCIP
1 /* librist. Copyright © 2024 SipRadius LLC. All right reserved.
2 *
3 * SPDX-License-Identifier: BSD-2-Clause
4 */
5
6 #ifndef RIST_TRANSPORT_PRIVATE_H
7 #define RIST_TRANSPORT_PRIVATE_H
8
9 /* struct pollfd for the rist_transport_poll() prototype below, gated on
10 * _WIN32_WINNT >= 0x0600 in mingw-w64. Mirrors src/libevsocket.c. */
11 #ifdef _WIN32
12 # if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600
13 # undef _WIN32_WINNT
14 # define _WIN32_WINNT 0x0600
15 # endif
16 # include <winsock2.h>
17 #else
18 # include <poll.h>
19 #endif
20
21 #include "common/attributes.h"
22 #include "librist/transport.h"
23
24 #include <stddef.h>
25
26 struct rist_peer;
27 struct rist_common_ctx;
28
29 /**
30 * Wrappers that route through the transport ops vtable when one is
31 * installed, falling back to the real POSIX syscalls otherwise.
32 * These are the ONLY functions that should touch the wire in the
33 * library hot-path — raw sendto/recvfrom/poll/sendmsg calls must
34 * not appear anywhere else.
35 */
36
37 RIST_PRIV ssize_t rist_transport_sendto(struct rist_peer *peer,
38 const void *buf, size_t len,
39 int flags);
40
41 RIST_PRIV ssize_t rist_transport_recvfrom(struct rist_peer *peer,
42 void *buf, size_t len,
43 int flags,
44 struct sockaddr *addr,
45 socklen_t *addrlen);
46
47 RIST_PRIV int rist_transport_poll(struct rist_common_ctx *ctx,
48 struct pollfd *fds, int nfds,
49 int timeout_ms);
50
51 #ifndef _WIN32
52 RIST_PRIV ssize_t rist_transport_sendmsg(struct rist_peer *peer,
53 const struct msghdr *msg,
54 int flags);
55 #endif
56
57 #endif /* RIST_TRANSPORT_PRIVATE_H */