-bin_PROGRAMS= tr/tr tpq/tpqc tpq/tpqs
+bin_PROGRAMS= tr/tr tpq/example/tpqc tpq/example/tpqs
AM_CPPFLAGS=-I$(srcdir)/include
SUBDIRS = gsscon
tr_tr_SOURCES = tr/tr_main.c \
tpq/tpqs.c \
-tpq/tpq_common.c \
-common/tr_config.c
+common/tr_name.c \
+common/tr_msg.c \
+common/tr_config.c
tr_tr_LDADD = gsscon/libgsscon.la
-tpq_tpqc_SOURCES = tpq/example/tpqc_main.c \
+tpq_example_tpqc_SOURCES = tpq/example/tpqc_main.c \
tpq/tpqc.c \
-tpq/tpq_common.c
+common/tr_name.c \
+common/tr_msg.c
-tpq_tpqc_LDADD = gsscon/libgsscon.la
+tpq_example_tpqc_LDADD = gsscon/libgsscon.la
-tpq_tpqs_SOURCES = tpq/example/tpqs_main.c \
+tpq_example_tpqs_SOURCES = tpq/example/tpqs_main.c \
tpq/tpqs.c \
-tpq/tpq_common.c
+common/tr_name.c \
+common/tr_msg.c
-tpq_tpqs_LDADD = gsscon/libgsscon.la
+tpq_example_tpqs_LDADD = gsscon/libgsscon.la
-
-
/*
* Copyright (c) 2012, JANET(UK)
* All rights reserved.
*
*/
-#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
-#include <trust_router.h>
+#include <tr_config.h>
int tr_read_config (FILE *cfg_file) {
- int rc = 0;
- return rc;
+ return 0;
}
#include <string.h>
#include <jansson.h>
-#include <tpq.h>
+#include <tr_msg.h>
-char *tpq_req_encode(TPQ_REQ *req)
+char *tr_msg_encode(TR_MSG *msg)
{
return NULL;
}
-TPQ_REQ *tpq_req_decode(char *jreq)
+TR_MSG *tr_msg_decode(char *jmsg)
{
return NULL;
}
-char *tpq_resp_encode(TPQ_REQ *resp)
-{
- return NULL;
-}
-
-TPQ_RESP *tpq_resp_decode(char *jresp)
-{
- return NULL;
-}
#include <stdlib.h>
#include <string.h>
-#include <tpq.h>
+#include <tr_name.h>
-TPQ_NAME *tpq_new_name (char *name)
+TR_NAME *tr_new_name (char *name)
{
- TPQ_NAME *new;
+ TR_NAME *new;
- if (new = malloc(sizeof(TPQ_NAME))) {
+ if (new = malloc(sizeof(TR_NAME))) {
new->len = strlen(name);
if (new->buf = malloc(new->len+1)) {
strcpy(new->buf, name);
return new;
}
-TPQ_NAME *tpq_dup_name (TPQ_NAME *from)
+TR_NAME *tr_dup_name (TR_NAME *from)
{
- TPQ_NAME *to;
+ TR_NAME *to;
- if (to = malloc(sizeof(TPQ_NAME))) {
+ if (to = malloc(sizeof(TR_NAME))) {
to->len = from->len;
if (to->buf = malloc(to->len+1)) {
- strncpy(to->buf, from->buf, to->len);
+ strncpy(to->buf, from->buf, from->len);
to->buf[to->len] = 0; /* NULL terminate for debugging printf()s */
}
}
#define TPQ_PORT 12309
#include <gsscon.h>
-typedef struct tpq_name {
- char *buf;
- int len;
-} TPQ_NAME;
+#include <tr_name.h>
typedef struct tpq_req {
struct tpq_req *next_req;
int conn;
- TPQ_NAME *realm;
- TPQ_NAME *coi;
+ TR_NAME *realm;
+ TR_NAME *coi;
void *resp_func;
void *cookie;
} TPQ_REQ;
typedef struct tpq_resp {
- TPQ_NAME *realm;
- TPQ_NAME *coi;
+ TR_NAME *realm;
+ TR_NAME *coi;
/* Address of AAA Server */
/* Credentials */
/* Trust Path Used */
typedef void (TPQC_RESP_FUNC)(TPQC_INSTANCE *, TPQ_RESP *, void *);
typedef int (TPQS_REQ_FUNC)(TPQS_INSTANCE *, TPQ_REQ *, TPQ_RESP *, void *);
-TPQ_NAME *tpq_new_name (char *name);
-TPQ_NAME *tpq_dup_name (TPQ_NAME *from);
-
-char *tpq_req_encode(TPQ_REQ *req);
-TPQ_REQ *tpq_req_decode(char *jreq);
-char *tpq_resp_encode(TPQ_REQ *resp);
-TPQ_RESP *tpq_resp_decode(char *jresp);
-
TPQC_INSTANCE *tpqc_create (void);
int tpqc_open_connection (TPQC_INSTANCE *tpqc, char *server, gss_ctx_id_t *gssctx);
int tpqc_send_request (TPQC_INSTANCE *tpqc, int conn, gss_ctx_id_t gssctx, char *realm, char *coi, TPQC_RESP_FUNC *resp_handler, void *cookie);
*
*/
-#ifndef TRUST_ROUTER_H
-#define TRUST_ROUTER_H
+#ifndef TR_H
+#define TR_H
+#include <tr_msg.h>
+#include <tr_name.h>
+#include <tr_config.h>
#include <tpq.h>
#include <tidr.h>
#define TRUST_ROUTER_PORT 12308
-int tr_read_config (FILE *cfg_file);
-
#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_CONFIG_H
+#define TR_CONFIG_H
+
+#include <stdio.h>
+
+int tr_read_config (FILE *cfg_file);
+
+#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_MSG_H
+#define TR_MSG_H
+
+#include <tpq.h>
+// #include <tidr.h>
+#include <jansson.h>
+
+enum msg_type {
+ TR_UNKNOWN,
+ TPQ_REQUEST,
+ TPQ_RESPONSE,
+ TIDR_REQUEST,
+ TIDR_RESPONSE
+};
+
+/* Union of TR message types to hold message of any type. */
+typedef struct tr_msg {
+ enum msg_type msg_type;
+ union {
+ TPQ_REQ msg_req;
+ TPQ_RESP msg_resp;
+ // TIDR_REQ tidr_req;
+ // TIDR_RESP tidr_resp;
+ };
+} TR_MSG;
+
+char *tr_msg_encode(TR_MSG *msg);
+TR_MSG *tr_msg_decode(char *jmsg);
+
+#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_NAME_H
+#define TR_NAME_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);
+
+#endif
if (tpqs)
tpqs->req_count++;
- if ((NULL == (resp->realm = tpq_dup_name(req->realm))) ||
- (NULL == (resp->coi = tpq_dup_name(req->coi)))) {
+ if ((NULL == (resp->realm = tr_dup_name(req->realm))) ||
+ (NULL == (resp->coi = tr_dup_name(req->coi)))) {
printf ("Error in tpq_dup_name, not responding.\n");
return 1;
}
--- /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.
+ *
+ */
+
+#include <stdio.h>
+
+#include <tr_config.h>
+
+int tr_read_config (FILE *cfg_file) {
+ int rc = 0;
+
+ return rc;
+}
#include <stdio.h>
-#include <trust_router.h>
+#include <tr.h>
int tpqs_req_handler (TPQS_INSTANCE * tpqs,
TPQ_REQ *req,
if (tpqs)
tpqs->req_count++;
- if ((NULL == (resp->realm = tpq_dup_name(req->realm))) ||
- (NULL == (resp->coi = tpq_dup_name(req->coi)))) {
+ if ((NULL == (resp->realm = tr_dup_name(req->realm))) ||
+ (NULL == (resp->coi = tr_dup_name(req->coi)))) {
printf ("Error in tpq_dup_name, not responding.\n");
return 1;
}