From 2dfc0526eed03250aa0d0fa34076befcd5cc146c Mon Sep 17 00:00:00 2001 From: Sam Hartman Date: Wed, 20 Mar 2013 12:55:14 -0400 Subject: [PATCH] libtr_di: new library Default visibility to hidden for components Set up TR_EXPORT as an API marker Add build glue --- Makefile.am | 34 ++++++++++++++++------------------ gsscon/Makefile.am | 1 + include/tid.h | 15 ++++++++------- include/tr_versioning.h | 40 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 65 insertions(+), 25 deletions(-) create mode 100644 include/tr_versioning.h diff --git a/Makefile.am b/Makefile.am index 746eaf1..218ddf0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,33 +1,31 @@ bin_PROGRAMS= tr/tr tid/example/tidc tid/example/tids common/dh_test/dh_test AM_CPPFLAGS=-I$(srcdir)/include SUBDIRS = gsscon +common_srcs = common/tr_name.c \ +common/tr_msg.c \ +common/tr_dh.c + +lib_LTLIBRARIES = libtr_tid.la tr_tr_SOURCES = tr/tr_main.c \ -tid/tidc.c \ -tid/tids.c \ -common/tr_name.c \ -common/tr_msg.c \ -common/tr_dh.c \ common/tr_config.c -tr_tr_LDADD = gsscon/libgsscon.la +tr_tr_LDADD = gsscon/libgsscon.la libtr_tid.la -tid_example_tidc_SOURCES = tid/example/tidc_main.c \ -tid/tidc.c \ -common/tr_name.c \ -common/tr_msg.c \ -common/tr_dh.c +tid_example_tidc_SOURCES = tid/example/tidc_main.c -tid_example_tidc_LDADD = gsscon/libgsscon.la +tid_example_tidc_LDADD = gsscon/libgsscon.la libtr_tid.la -tid_example_tids_SOURCES = tid/example/tids_main.c \ -tid/tids.c \ -common/tr_name.c \ -common/tr_msg.c \ -common/tr_dh.c +tid_example_tids_SOURCES = tid/example/tids_main.c -tid_example_tids_LDADD = gsscon/libgsscon.la +tid_example_tids_LDADD = gsscon/libgsscon.la libtr_tid.la common_dh_test_dh_test_SOURCES = common/tr_dh.c \ common/dh_test/dh_test.c +libtr_tid_la_SOURCES = tid/tids.c tid/tidc.c \ +$(common_srcs) + +libtr_tid_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden +libtr_tid_la_LIBADD = gsscon/libgsscon.la +libtr_tid_la_LDFLAGS = $(AM_LDFLAGS) -version-info 0 -no-undefined diff --git a/gsscon/Makefile.am b/gsscon/Makefile.am index f39b06e..0ffcb25 100644 --- a/gsscon/Makefile.am +++ b/gsscon/Makefile.am @@ -1,4 +1,5 @@ AM_CPPFLAGS=-I$(top_srcdir)/include +AM_CFLAGS = -fvisibility=hidden noinst_LTLIBRARIES = libgsscon.la noinst_PROGRAMS=test/gsscon_client test/gsscon_server diff --git a/include/tid.h b/include/tid.h index 69aa32a..8e923e9 100644 --- a/include/tid.h +++ b/include/tid.h @@ -40,6 +40,7 @@ #include #include +#include #define TID_PORT 12309 @@ -89,13 +90,13 @@ typedef struct tids_instance { typedef void (TIDC_RESP_FUNC)(TIDC_INSTANCE *, TID_RESP *, void *); typedef int (TIDS_REQ_FUNC)(TIDS_INSTANCE *, TID_REQ *, TID_RESP *, void *); -TIDC_INSTANCE *tidc_create (void); -int tidc_open_connection (TIDC_INSTANCE *tidc, char *server, gss_ctx_id_t *gssctx); -int tidc_send_request (TIDC_INSTANCE *tidc, int conn, gss_ctx_id_t gssctx, char *rp_realm, char *realm, char *coi, TIDC_RESP_FUNC *resp_handler, void *cookie); -void tidc_destroy (TIDC_INSTANCE *tidc); +TR_EXPORT TIDC_INSTANCE *tidc_create (void); +TR_EXPORT int tidc_open_connection (TIDC_INSTANCE *tidc, char *server, gss_ctx_id_t *gssctx); +TR_EXPORT int tidc_send_request (TIDC_INSTANCE *tidc, int conn, gss_ctx_id_t gssctx, char *rp_realm, char *realm, char *coi, TIDC_RESP_FUNC *resp_handler, void *cookie); +TR_EXPORT void tidc_destroy (TIDC_INSTANCE *tidc); -TIDS_INSTANCE *tids_create (); -int tids_start (TIDS_INSTANCE *tids, TIDS_REQ_FUNC *req_handler, void *cookie); -void tids_destroy (TIDS_INSTANCE *tids); +TR_EXPORT TIDS_INSTANCE *tids_create (); +TR_EXPORT int tids_start (TIDS_INSTANCE *tids, TIDS_REQ_FUNC *req_handler, void *cookie); +TR_EXPORT void tids_destroy (TIDS_INSTANCE *tids); #endif diff --git a/include/tr_versioning.h b/include/tr_versioning.h new file mode 100644 index 0000000..7c3bfd5 --- /dev/null +++ b/include/tr_versioning.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2012, 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. + * + */ + +#ifndef TR_VERSIONING_H +#define TR_VERSIONING_H + +#define TR_EXPORT __attribute__((visibility("default"))) + +#endif /*TR_VERSIONING_h*/ -- 2.1.4