pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-pfcp/+/42125?usp=email )
Change subject: Move struct osmo_pfcp_endpoint to pfcp_endpoint_private.h ......................................................................
Move struct osmo_pfcp_endpoint to pfcp_endpoint_private.h
Similar to what we have with pfcp_cp_peer_private.h.
Change-Id: Id3dcd1c2e086d40bbc7060d5e89aed5ee18249e1 --- M include/osmocom/pfcp/Makefile.am A include/osmocom/pfcp/pfcp_endpoint_private.h M src/libosmo-pfcp/pfcp_cp_peer.c M src/libosmo-pfcp/pfcp_endpoint.c 4 files changed, 60 insertions(+), 25 deletions(-)
Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved osmith: Looks good to me, but someone else must approve laforge: Looks good to me, but someone else must approve
diff --git a/include/osmocom/pfcp/Makefile.am b/include/osmocom/pfcp/Makefile.am index 21b3aeb..b4a2305 100644 --- a/include/osmocom/pfcp/Makefile.am +++ b/include/osmocom/pfcp/Makefile.am @@ -1,4 +1,5 @@ noinst_HEADERS = \ + pfcp_endpoint_private.h \ pfcp_cp_peer_private.h \ $(NULL)
diff --git a/include/osmocom/pfcp/pfcp_endpoint_private.h b/include/osmocom/pfcp/pfcp_endpoint_private.h new file mode 100644 index 0000000..2b1b52b --- /dev/null +++ b/include/osmocom/pfcp/pfcp_endpoint_private.h @@ -0,0 +1,57 @@ +/* + * (C) 2021-2025 by sysmocom - s.f.m.c. GmbH info@sysmocom.de + * All Rights Reserved. + * + * Author: Neels Janosch Hofmeyr nhofmeyr@sysmocom.de + * + * SPDX-License-Identifier: GPL-2.0+ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + * + */ + +#pragma once + +#include <stdint.h> + +#include <osmocom/core/hashtable.h> +#include <osmocom/core/linuxlist.h> +#include <osmocom/core/osmo_io.h> +#include <osmocom/pfcp/pfcp_endpoint.h> + + +/* Send/receive PFCP messages to/from remote PFCP endpoints. */ +struct osmo_pfcp_endpoint { + struct osmo_pfcp_endpoint_cfg cfg; + + /* PFCP socket */ + struct osmo_io_fd *iofd; + + /* The time at which this endpoint last restarted, as seconds since unix epoch. */ + uint32_t recovery_time_stamp; + + /* State for determining the next sequence number for transmitting a request message */ + uint32_t seq_nr_state; + + /* All transmitted PFCP Request messages, list of osmo_pfcp_queue_entry. + * For a transmitted Request message, wait for a matching Response from a remote peer; if none arrives, + * retransmit (see n1 and t1_ms). */ + struct llist_head sent_requests; + DECLARE_HASHTABLE(sent_requests_by_seq_nr, 12); + /* All transmitted PFCP Response messages, list of osmo_pfcp_queue_entry. + * For a transmitted Response message, keep it in the queue for a fixed amount of time. If the peer retransmits + * the original Request, do not dispatch the Request, but respond with the queued message directly. */ + struct llist_head sent_responses; + DECLARE_HASHTABLE(sent_responses_by_seq_nr, 12); +}; diff --git a/src/libosmo-pfcp/pfcp_cp_peer.c b/src/libosmo-pfcp/pfcp_cp_peer.c index 403a474..0c29df7 100644 --- a/src/libosmo-pfcp/pfcp_cp_peer.c +++ b/src/libosmo-pfcp/pfcp_cp_peer.c @@ -27,7 +27,7 @@ #include <osmocom/core/fsm.h> #include <osmocom/core/tdef.h>
-#include <osmocom/pfcp/pfcp_endpoint.h> +#include <osmocom/pfcp/pfcp_endpoint_private.h> #include <osmocom/pfcp/pfcp_cp_peer_private.h>
#define LOG_CP_PEER(CP_PEER, LOGLEVEL, FMT, ARGS...) \ diff --git a/src/libosmo-pfcp/pfcp_endpoint.c b/src/libosmo-pfcp/pfcp_endpoint.c index 64ea347..bb7fbf3 100644 --- a/src/libosmo-pfcp/pfcp_endpoint.c +++ b/src/libosmo-pfcp/pfcp_endpoint.c @@ -33,32 +33,9 @@ #include <osmocom/core/osmo_io.h>
#include <osmocom/pfcp/pfcp_endpoint.h> +#include <osmocom/pfcp/pfcp_endpoint_private.h> #include <osmocom/pfcp/pfcp_msg.h>
-/* Send/receive PFCP messages to/from remote PFCP endpoints. */ -struct osmo_pfcp_endpoint { - struct osmo_pfcp_endpoint_cfg cfg; - - /* PFCP socket */ - struct osmo_io_fd *iofd; - - /* The time at which this endpoint last restarted, as seconds since unix epoch. */ - uint32_t recovery_time_stamp; - - /* State for determining the next sequence number for transmitting a request message */ - uint32_t seq_nr_state; - - /* All transmitted PFCP Request messages, list of osmo_pfcp_queue_entry. - * For a transmitted Request message, wait for a matching Response from a remote peer; if none arrives, - * retransmit (see n1 and t1_ms). */ - struct llist_head sent_requests; - DECLARE_HASHTABLE(sent_requests_by_seq_nr, 12); - /* All transmitted PFCP Response messages, list of osmo_pfcp_queue_entry. - * For a transmitted Response message, keep it in the queue for a fixed amount of time. If the peer retransmits - * the original Request, do not dispatch the Request, but respond with the queued message directly. */ - struct llist_head sent_responses; - DECLARE_HASHTABLE(sent_responses_by_seq_nr, 12); -};
/*! Entry of pfcp_endpoint message queue of PFCP messages, for re-transsions. */ struct osmo_pfcp_queue_entry {