[S] Change in libosmo-netif[master]: stream: make SCTP usage conditional on HAVE_LIBSCTP
Timur Davydov has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/41952?usp=email ) Change subject: stream: make SCTP usage conditional on HAVE_LIBSCTP ...................................................................... stream: make SCTP usage conditional on HAVE_LIBSCTP Guard SCTP-specific includes and code paths with HAVE_LIBSCTP to allow building libosmo-netif without libsctp support. This avoids unconditional inclusion of <osmocom/netif/sctp.h> and ensures that SCTP-specific variables and send paths are only compiled when SCTP support is enabled. No functional change when HAVE_LIBSCTP is defined. Change-Id: I07ef25f3fcc39f9bee023d9264a72c4381b82b65 --- M src/stream.c M src/stream_cli.c M src/stream_srv.c 3 files changed, 18 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/52/41952/1 diff --git a/src/stream.c b/src/stream.c index e2aaf59..923b5b4 100644 --- a/src/stream.c +++ b/src/stream.c @@ -49,7 +49,9 @@ #include "config.h" +#ifdef HAVE_LIBSCTP #include <osmocom/netif/sctp.h> +#endif /*! \cond private */ diff --git a/src/stream_cli.c b/src/stream_cli.c index b098e4a..09e53a0 100644 --- a/src/stream_cli.c +++ b/src/stream_cli.c @@ -49,7 +49,9 @@ #include "config.h" +#ifdef HAVE_LIBSCTP #include <osmocom/netif/sctp.h> +#endif /*! \file stream_cli.c */ @@ -1243,9 +1245,12 @@ * \return negative on error, 0 on success */ int osmo_stream_cli_open(struct osmo_stream_cli *cli) { - int ret, flags; + int ret; int fd = -1; +#ifdef HAVE_LIBSCTP + int flags; unsigned int local_addrcnt; +#endif /* we are reconfiguring this socket, close existing first. */ if ((cli->flags & OSMO_STREAM_CLI_F_RECONF) && osmo_stream_cli_get_fd(cli) >= 0) { @@ -1402,9 +1407,11 @@ case OSMO_STREAM_MODE_OSMO_IO: /* whenever osmo_stream_cli_is_connected() [see above check], we should have an iofd */ OSMO_ASSERT(cli->iofd); +#ifdef HAVE_LIBSCTP if (cli->proto == IPPROTO_SCTP) rc = stream_iofd_sctp_send_msgb(cli->iofd, msg, MSG_NOSIGNAL); else +#endif rc = osmo_iofd_write_msgb(cli->iofd, msg); if (rc < 0) msgb_free(msg); diff --git a/src/stream_srv.c b/src/stream_srv.c index 3abc55a..c516211 100644 --- a/src/stream_srv.c +++ b/src/stream_srv.c @@ -50,7 +50,9 @@ #include "config.h" +#ifdef HAVE_LIBSCTP #include <osmocom/netif/sctp.h> +#endif /*! \file stream_srv.c */ @@ -1045,12 +1047,16 @@ osmo_sock_get_name_buf(conn->sockname, sizeof(conn->sockname), fd); +#ifdef HAVE_LIBSCTP if (link->proto == IPPROTO_SCTP) { conn->iofd = osmo_iofd_setup(conn, fd, conn->sockname, OSMO_IO_FD_MODE_RECVMSG_SENDMSG, &srv_ioops_sctp, conn); if (conn->iofd) osmo_iofd_set_cmsg_size(conn->iofd, CMSG_SPACE(sizeof(struct sctp_sndrcvinfo))); } else { +#else + if (true) { +#endif conn->iofd = osmo_iofd_setup(conn, fd, conn->sockname, OSMO_IO_FD_MODE_READ_WRITE, &srv_ioops, conn); } @@ -1379,9 +1385,11 @@ osmo_fd_write_enable(&conn->ofd); break; case OSMO_STREAM_MODE_OSMO_IO: +#ifdef HAVE_LIBSCTP if (conn->srv->proto == IPPROTO_SCTP) rc = stream_iofd_sctp_send_msgb(conn->iofd, msg, MSG_NOSIGNAL); else +#endif rc = osmo_iofd_write_msgb(conn->iofd, msg); if (rc < 0) msgb_free(msg); -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/41952?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I07ef25f3fcc39f9bee023d9264a72c4381b82b65 Gerrit-Change-Number: 41952 Gerrit-PatchSet: 1 Gerrit-Owner: Timur Davydov <dtv.comp@gmail.com>
participants (1)
-
Timur Davydov