-bin_PROGRAMS= tr/tr tid/example/tidc tid/example/tids common/dh_test/dh_test
+bin_PROGRAMS= tr/tr tid/example/tidc tid/example/tids common/dh_test/tr_dh_test
AM_CPPFLAGS=-I$(srcdir)/include
+AM_CFLAGS = -Wall -Werror=missing-prototypes -Werror=strict-prototypes -Wno-parentheses
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_tr_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
+
+pkginclude_HEADERS = include/trust_router/tid.h include/trust_router/tr_name.h \
+include/trust_router/tr_versioning.h
+
+noinst_HEADERS = include/gsscon.h include/tr_config.h \
+include/tr_msg.h \
+include/tr.h \
+include/tr_dh.h
+
*/
#include <openssl/dh.h>
+#include <tr_dh.h>
unsigned char tr_2048_dhprime[2048/8] = {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
#include <jansson.h>
#include <tr_msg.h>
-#include <tr_name.h>
-#include <tid.h>
+#include <trust_router/tr_name.h>
+#include <trust_router/tid.h>
static json_t *tr_msg_encode_dh(DH *dh)
{
return dh;
}
-json_t *tr_msg_encode_tidreq(TID_REQ *req)
+static json_t * tr_msg_encode_tidreq(TID_REQ *req)
{
json_t *jreq = NULL;
json_t *jstr = NULL;
return jreq;
}
-TID_REQ *tr_msg_decode_tidreq(json_t *jreq)
+static TID_REQ *tr_msg_decode_tidreq(json_t *jreq)
{
TID_REQ *treq = NULL;
json_error_t rc;
return treq;
}
-json_t *tr_msg_encode_tidresp(TID_RESP *resp)
+static json_t * tr_msg_encode_tidresp(TID_RESP *resp)
{
json_t *jresp = NULL;
json_t *jstr = NULL;
return jresp;
}
-TID_RESP *tr_msg_decode_tidresp(json_t *jresp)
+static TID_RESP *tr_msg_decode_tidresp(json_t *jresp)
{
TID_RESP *tresp = NULL;
json_error_t rc;
#include <stdlib.h>
#include <string.h>
-#include <tr_name.h>
+#include <trust_router/tr_name.h>
TR_NAME *tr_new_name (char *name)
{
AM_CPPFLAGS=-I$(top_srcdir)/include
+AM_CFLAGS = -fvisibility=hidden
noinst_LTLIBRARIES = libgsscon.la
noinst_PROGRAMS=test/gsscon_client test/gsscon_server
#define TR_H
#include <tr_msg.h>
-#include <tr_name.h>
+#include <trust_router/tr_name.h>
#include <tr_config.h>
-#include <tid.h>
+#include <trust_router/tid.h>
#define TRUST_ROUTER_PORT 12308
DH *tr_create_dh_params(char *key, size_t len);
DH *tr_create_matching_dh(char *key, size_t len, DH *in_dh);
void tr_destroy_dh_params(DH *dh);
-int tr_compute_dh_key(char *buf, size_t buflen, BIGNUM *pub_key, DH *priv_dh);
+int tr_compute_dh_key(unsigned char *buf, size_t buflen, BIGNUM *pub_key, DH *priv_dh);
#endif
#ifndef TR_MSG_H
#define TR_MSG_H
-#include <tid.h>
+#include <trust_router/tid.h>
#include <jansson.h>
enum msg_type {
#include <arpa/inet.h>
#include <openssl/dh.h>
-#include <gsscon.h>
-#include <tr_name.h>
+#include <trust_router/tr_name.h>
+#include <trust_router/tr_versioning.h>
#define TID_PORT 12309
+typedef struct gss_ctx_id_struct *gss_ctx_id_t;
+
typedef struct tid_req {
struct tid_req *next_req;
int conn;
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 (void);
+TR_EXPORT int tids_start (TIDS_INSTANCE *tids, TIDS_REQ_FUNC *req_handler, void *cookie);
+TR_EXPORT void tids_destroy (TIDS_INSTANCE *tids);
#endif
#ifndef TR_NAME_H
#define TR_NAME_H
+#include <trust_router/tr_versioning.h>
typedef struct tr__name {
char *buf;
int len;
} TR_NAME;
-TR_NAME *tr_new_name (char *name);
-TR_NAME *tr_dup_name (TR_NAME *from);
+TR_EXPORT TR_NAME *tr_new_name (char *name);
+TR_EXPORT TR_NAME *tr_dup_name (TR_NAME *from);
#endif
--- /dev/null
+/*
+ * 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*/
#include <stdio.h>
#include <gsscon.h>
-#include <tid.h>
+#include <trust_router/tid.h>
static int tidc_response_received = 0;
-void tidc_print_usage (const char *name)
+void static tidc_print_usage (const char *name)
{
printf("Usage: %s <server> <RP-realm> <target-realm> <community>\n", name);
}
-void tidc_resp_handler (TIDC_INSTANCE * tidc,
+static void tidc_resp_handler (TIDC_INSTANCE * tidc,
TID_RESP *resp,
void *cookie)
{
#include <stdio.h>
-#include <tid.h>
+#include <trust_router/tid.h>
-int tids_req_handler (TIDS_INSTANCE * tids,
+static int tids_req_handler (TIDS_INSTANCE * tids,
TID_REQ *req,
TID_RESP *resp,
void *cookie)
#include <gsscon.h>
#include <tr_dh.h>
-#include <tid.h>
+#include <trust_router/tid.h>
#include <tr_msg.h>
+#include <gsscon.h>
/* char tmp_key[32] =
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
return -1;
}
- fprintf(stdout, "Response Received, %d bytes.\n", resp_buflen);
+ fprintf(stdout, "Response Received, %u bytes.\n", (unsigned) resp_buflen);
/* Parse response -- TBD */
#include <jansson.h>
#include <gsscon.h>
-#include <tid.h>
+#include <trust_router/tid.h>
+
static int tids_listen (int port)
{
return -1;
}
- fprintf(stdout, "Request Received, %d bytes.\n", buflen);
+ fprintf(stdout, "Request Received, %u bytes.\n", (unsigned) buflen);
/* Parse request -- TBD */
return;
}
-TIDS_INSTANCE *tids_create ()
+TIDS_INSTANCE *tids_create (void)
{
TIDS_INSTANCE *tids = 0;
if (tids = malloc(sizeof(TIDS_INSTANCE)))
#include <tr.h>
-int tids_req_handler (TIDS_INSTANCE * tids,
+int static tids_req_handler (TIDS_INSTANCE * tids,
TID_REQ *req,
TID_RESP *resp,
void *cookie)