From fbf9147b807cd06a9b0af65a9d39f00c9efaefa6 Mon Sep 17 00:00:00 2001 From: Jennifer Richards Date: Mon, 11 Sep 2017 17:45:35 -0400 Subject: [PATCH] Remove Jansson dependence in tr_name.h * Move Jansson references out of tr_name.h into tr_name_internal.h * Move non-public API functions to tr_name_internal.h * Use tr_name_internal.h instead of tr_name.h except in public headers --- Makefile.am | 3 ++- common/tr_apc.c | 2 +- common/tr_comm.c | 2 +- common/tr_idp.c | 2 +- common/tr_msg.c | 2 +- common/tr_name.c | 2 +- common/tr_rp.c | 2 +- include/tr.h | 1 - include/tr_apc.h | 2 +- include/tr_filter.h | 2 +- include/tr_gss.h | 2 +- include/tr_idp.h | 2 +- include/tr_name_internal.h | 54 ++++++++++++++++++++++++++++++++++++++++++ include/trp_ptable.h | 2 +- include/trust_router/tr_name.h | 4 ---- trp/trp_ptable.c | 2 +- trp/trp_req.c | 2 +- trp/trp_rtable.c | 2 +- trp/trp_upd.c | 2 +- trp/trps.c | 2 +- 20 files changed, 72 insertions(+), 22 deletions(-) create mode 100644 include/tr_name_internal.h diff --git a/Makefile.am b/Makefile.am index 259faa3..de442b0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -179,7 +179,8 @@ noinst_HEADERS = include/gsscon.h include/tr_config.h \ include/tid_internal.h include/trp_internal.h \ include/tr_cfgwatch.h include/tr_event.h \ include/tr_mq.h include/trp_ptable.h \ - include/trp_rtable.h include/tr_util.h + include/trp_rtable.h include/tr_util.h \ + include/tr_name_internal.h pkgdata_DATA=schema.sql nobase_dist_pkgdata_DATA=redhat/init redhat/sysconfig redhat/organizations.cfg redhat/tidc-wrapper redhat/trust_router-wrapper redhat/tr-test-internal.cfg redhat/default-internal.cfg redhat/tids-wrapper redhat/sysconfig.tids diff --git a/common/tr_apc.c b/common/tr_apc.c index 9fa9294..8f590e8 100644 --- a/common/tr_apc.c +++ b/common/tr_apc.c @@ -34,7 +34,7 @@ #include -#include +#include #include #include diff --git a/common/tr_comm.c b/common/tr_comm.c index 4fb890c..6212b5d 100644 --- a/common/tr_comm.c +++ b/common/tr_comm.c @@ -39,7 +39,7 @@ #include #include -#include +#include #include #include diff --git a/common/tr_idp.c b/common/tr_idp.c index fc91c62..984e6b5 100644 --- a/common/tr_idp.c +++ b/common/tr_idp.c @@ -35,7 +35,7 @@ #include #include -#include +#include #include #include #include diff --git a/common/tr_msg.c b/common/tr_msg.c index 043fa97..59a2efd 100644 --- a/common/tr_msg.c +++ b/common/tr_msg.c @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/common/tr_name.c b/common/tr_name.c index 83d1db0..84f0c1f 100644 --- a/common/tr_name.c +++ b/common/tr_name.c @@ -36,7 +36,7 @@ #include #include -#include +#include void tr_free_name (TR_NAME *name) { diff --git a/common/tr_rp.c b/common/tr_rp.c index f54a5a5..495c77e 100644 --- a/common/tr_rp.c +++ b/common/tr_rp.c @@ -35,7 +35,7 @@ #include #include -#include +#include #include #include #include diff --git a/include/tr.h b/include/tr.h index bd55176..0c2b37d 100644 --- a/include/tr.h +++ b/include/tr.h @@ -38,7 +38,6 @@ #include #include -#include #include #include #include diff --git a/include/tr_apc.h b/include/tr_apc.h index 2919f86..0821477 100644 --- a/include/tr_apc.h +++ b/include/tr_apc.h @@ -37,7 +37,7 @@ #include -#include +#include /* Used to hold lists of APC names in cfg. */ typedef struct tr_apc { diff --git a/include/tr_filter.h b/include/tr_filter.h index 63b23dd..a7704d7 100644 --- a/include/tr_filter.h +++ b/include/tr_filter.h @@ -38,7 +38,7 @@ #include #include -#include +#include #include #include #include diff --git a/include/tr_gss.h b/include/tr_gss.h index 575636d..676c8e4 100644 --- a/include/tr_gss.h +++ b/include/tr_gss.h @@ -36,7 +36,7 @@ #define __TR_GSS_H__ #include -#include +#include #define TR_MAX_GSS_NAMES 5 diff --git a/include/tr_idp.h b/include/tr_idp.h index dbcb472..951f7d7 100644 --- a/include/tr_idp.h +++ b/include/tr_idp.h @@ -38,7 +38,7 @@ #include #include -#include +#include #include typedef struct tr_aaa_server { diff --git a/include/tr_name_internal.h b/include/tr_name_internal.h new file mode 100644 index 0000000..02c78f8 --- /dev/null +++ b/include/tr_name_internal.h @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2017, JANET(UK) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of JANET(UK) nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/** This is the internal version of the trust_router/tr_name.h header. + * That one is used for the public API provided by libtr-tid. Declarations + * that should not be included in the public API, dependencies on headers + * that are not needed for the API, etc., belong here. Anything needed + * in order to use the library should go in trust_router/tr_name.h. + */ + +#ifndef TR_NAME_INTERNAL_H + +#include +#include + +/** Prototypes */ +json_t *tr_name_to_json_string(TR_NAME *src); +int tr_name_cmp_str(TR_NAME *one, const char *two_str); +int tr_name_prefix_wildcard_match(TR_NAME *str, TR_NAME *wc_str); + +#define TR_NAME_INTERNAL_H + +#endif //TRUST_ROUTER_TR_NAME_INTERNAL_H diff --git a/include/trp_ptable.h b/include/trp_ptable.h index 7171952..186f77a 100644 --- a/include/trp_ptable.h +++ b/include/trp_ptable.h @@ -38,7 +38,7 @@ #include #include -#include +#include #include #include #include diff --git a/include/trust_router/tr_name.h b/include/trust_router/tr_name.h index 1f392a8..052d291 100644 --- a/include/trust_router/tr_name.h +++ b/include/trust_router/tr_name.h @@ -35,7 +35,6 @@ #ifndef TR_NAME_H #define TR_NAME_H #include -#include #include typedef const char *tr_const_string; @@ -49,11 +48,8 @@ TR_EXPORT TR_NAME *tr_new_name (const char *name); TR_EXPORT TR_NAME *tr_dup_name (TR_NAME *from); TR_EXPORT void tr_free_name (TR_NAME *name); TR_EXPORT int tr_name_cmp (TR_NAME *one, TR_NAME *two); -int tr_name_cmp_str(TR_NAME *one, const char *two_str); -int tr_name_prefix_wildcard_match(TR_NAME *str, TR_NAME *wc_str); TR_EXPORT void tr_name_strlcat(char *dest, const TR_NAME *src, size_t len); TR_EXPORT char *tr_name_strdup(TR_NAME *); -TR_EXPORT json_t *tr_name_to_json_string(TR_NAME *src); TR_EXPORT TR_NAME *tr_name_cat(TR_NAME *n1, TR_NAME *n2); #endif diff --git a/trp/trp_ptable.c b/trp/trp_ptable.c index b954584..e47846e 100644 --- a/trp/trp_ptable.c +++ b/trp/trp_ptable.c @@ -35,7 +35,7 @@ #include #include -#include +#include #include #include #include diff --git a/trp/trp_req.c b/trp/trp_req.c index de3d297..be84310 100644 --- a/trp/trp_req.c +++ b/trp/trp_req.c @@ -35,7 +35,7 @@ #include #include -#include +#include #include #include diff --git a/trp/trp_rtable.c b/trp/trp_rtable.c index ab693c5..e2ea5bb 100644 --- a/trp/trp_rtable.c +++ b/trp/trp_rtable.c @@ -38,7 +38,7 @@ #include #include -#include +#include #include #include #include diff --git a/trp/trp_upd.c b/trp/trp_upd.c index 7079f22..e1057f1 100644 --- a/trp/trp_upd.c +++ b/trp/trp_upd.c @@ -36,7 +36,7 @@ #include #include -#include +#include #include #include #include diff --git a/trp/trps.c b/trp/trps.c index 9d217f2..94ff111 100644 --- a/trp/trps.c +++ b/trp/trps.c @@ -44,7 +44,7 @@ #include #include #include -#include +#include #include #include #include -- 2.1.4