pespin has submitted this change. (
https://gerrit.osmocom.org/c/libosmo-pfcp/+/38612?usp=email )
Change subject: pfcp: Make struct osmo_pfcp_cp_peer private
......................................................................
pfcp: Make struct osmo_pfcp_cp_peer private
Only user of this lib so far, osmo-hnbgw, will get patches so that
it doesn't access the struct.
Make it private before anybody else starts using it.
Change-Id: I7f79ce239cb3c57bae2cf5846edf71e1aa03fa95
---
M TODO-RELEASE
M include/osmocom/pfcp/Makefile.am
M include/osmocom/pfcp/pfcp_cp_peer.h
A include/osmocom/pfcp/pfcp_cp_peer_private.h
M src/libosmo-pfcp/pfcp_cp_peer.c
5 files changed, 57 insertions(+), 18 deletions(-)
Approvals:
pespin: Looks good to me, approved
Jenkins Builder: Verified
osmith: Looks good to me, but someone else must approve
diff --git a/TODO-RELEASE b/TODO-RELEASE
index a73a0e0..d705483 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -10,3 +10,4 @@
libosmo-pfcp add API osmo_pfcp_cp_peer_set_associated_cb()
libosmo-pfcp add API osmo_pfcp_cp_peer_get_remote_addr(), osmo_pfcp_cp_peer_next_seid()
osmo_pfcp_cp_peer_get_priv(), osmo_pfcp_cp_peer_set_priv()
+libosmo-pfcp API break struct osmo_pfcp_cp_peer fields become private
diff --git a/include/osmocom/pfcp/Makefile.am b/include/osmocom/pfcp/Makefile.am
index 898113f..2693be5 100644
--- a/include/osmocom/pfcp/Makefile.am
+++ b/include/osmocom/pfcp/Makefile.am
@@ -1,3 +1,7 @@
+noinst_HEADERS = \
+ pfcp_cp_peer_private.h \
+ $(NULL)
+
pfcp_HEADERS = \
pfcp_endpoint.h \
pfcp_ies_custom.h \
diff --git a/include/osmocom/pfcp/pfcp_cp_peer.h b/include/osmocom/pfcp/pfcp_cp_peer.h
index 01f0838..739526e 100644
--- a/include/osmocom/pfcp/pfcp_cp_peer.h
+++ b/include/osmocom/pfcp/pfcp_cp_peer.h
@@ -36,23 +36,6 @@
typedef void (*osmo_pfcp_cp_peer_assoc_cb)(struct osmo_pfcp_cp_peer *cp_peer, bool
associated);
-struct osmo_pfcp_cp_peer {
- struct osmo_fsm_inst *fi;
- struct osmo_pfcp_endpoint *ep;
- struct osmo_sockaddr remote_addr;
- uint64_t next_seid_state;
-
- /* If non-NULL, called whenever the peer completes a PFCP Association, and when it loses
association.
- * Argument associated == true means the peer has just associated;
- * associated == false means the association has been lost. */
- osmo_pfcp_cp_peer_assoc_cb assoc_cb;
- /* Application private data for assoc_cb, in case ep->priv does not suffice. */
- void *priv;
-
- struct osmo_use_count use_count;
- struct osmo_use_count_entry use_count_buf[128];
-};
-
struct osmo_pfcp_cp_peer *osmo_pfcp_cp_peer_alloc(void *ctx,
struct osmo_pfcp_endpoint *ep,
const struct osmo_sockaddr *remote_addr);
diff --git a/include/osmocom/pfcp/pfcp_cp_peer_private.h
b/include/osmocom/pfcp/pfcp_cp_peer_private.h
new file mode 100644
index 0000000..b8b0af7
--- /dev/null
+++ b/include/osmocom/pfcp/pfcp_cp_peer_private.h
@@ -0,0 +1,51 @@
+/*
+ * (C) 2021-2022 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de>
+ * All Rights Reserved.
+ *
+ * Author: Neels Janosch Hofmeyr <nhofmeyr(a)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 <stdbool.h>
+
+#include <osmocom/core/socket.h>
+#include <osmocom/core/use_count.h>
+#include <osmocom/pfcp/pfcp_cp_peer.h>
+
+struct osmo_fsm_inst;
+struct osmo_pfcp_endpoint;
+
+struct osmo_pfcp_cp_peer {
+ struct osmo_fsm_inst *fi;
+ struct osmo_pfcp_endpoint *ep;
+ struct osmo_sockaddr remote_addr;
+ uint64_t next_seid_state;
+
+ /* If non-NULL, called whenever the peer completes a PFCP Association, and when it loses
association.
+ * Argument associated == true means the peer has just associated;
+ * associated == false means the association has been lost. */
+ osmo_pfcp_cp_peer_assoc_cb assoc_cb;
+ /* Application private data for assoc_cb, in case ep->priv does not suffice. */
+ void *priv;
+
+ struct osmo_use_count use_count;
+ struct osmo_use_count_entry use_count_buf[128];
+};
diff --git a/src/libosmo-pfcp/pfcp_cp_peer.c b/src/libosmo-pfcp/pfcp_cp_peer.c
index b146dad..c88c6d1 100644
--- a/src/libosmo-pfcp/pfcp_cp_peer.c
+++ b/src/libosmo-pfcp/pfcp_cp_peer.c
@@ -28,7 +28,7 @@
#include <osmocom/core/tdef.h>
#include <osmocom/pfcp/pfcp_endpoint.h>
-#include <osmocom/pfcp/pfcp_cp_peer.h>
+#include <osmocom/pfcp/pfcp_cp_peer_private.h>
#define LOG_CP_PEER(CP_PEER, LOGLEVEL, FMT, ARGS...) \
LOGPFSML((CP_PEER)->fi, LOGLEVEL, FMT, ##ARGS)
--
To view, visit
https://gerrit.osmocom.org/c/libosmo-pfcp/+/38612?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmo-pfcp
Gerrit-Branch: master
Gerrit-Change-Id: I7f79ce239cb3c57bae2cf5846edf71e1aa03fa95
Gerrit-Change-Number: 38612
Gerrit-PatchSet: 5
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>