X-Git-Url: http://www.project-moonshot.org/gitweb/?p=trust_router.git;a=blobdiff_plain;f=include%2Ftid_internal.h;h=c5ecdc86f2c2abfddbb69c0893a16b27902fc5d9;hp=db8189dc2612ee965c699fba0b9d5790f465b8c8;hb=3b59db3c5565b707e745d58f7ec1df1bdc7c1895;hpb=1a04603d88385536e5de4034819dd04bb7f673e9 diff --git a/include/tid_internal.h b/include/tid_internal.h index db8189d..c5ecdc8 100644 --- a/include/tid_internal.h +++ b/include/tid_internal.h @@ -1,38 +1,5 @@ /* - * Copyright (c) 2012-2014, 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. - * - */ -/* - * Copyright (c) 2012, JANET(UK) + * Copyright (c) 2012-2015, JANET(UK) * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -67,17 +34,22 @@ #ifndef TID_INTERNAL_H #define TID_INTERNAL_H -#include +#include +#include +#include #include -typedef struct tid_srvr_blk { - struct tid_srvr_blk *next; - struct in_addr aaa_server_addr; + +struct tid_srvr_blk { + TID_SRVR_BLK *next; + char *aaa_server_addr; TR_NAME *key_name; DH *aaa_server_dh; /* AAA server's public dh information */ -} TID_SRVR_BLK; + GTimeVal key_expiration; /**< absolute time at which key expires*/ + TID_PATH *path;/**< Path of trust routers that the request traversed*/ +}; -typedef struct tid_resp { +struct tid_resp { TID_RC result; TR_NAME *err_msg; TR_NAME *rp_realm; @@ -85,13 +57,15 @@ typedef struct tid_resp { TR_NAME *comm; TR_CONSTRAINT_SET *cons; TR_NAME *orig_coi; - TID_SRVR_BLK *servers; /* Linked list of servers */ - /* TBD -- Trust Path Used */ -} TID_RESP; + TID_SRVR_BLK *servers; /* array of servers */ + json_t *error_path; /**< Path that a request generating an error traveled*/ +}; + struct tid_req { struct tid_req *next_req; int resp_sent; int conn; + int free_conn; /* free conn and gss ctx*/ gss_ctx_id_t gssctx; int resp_rcvd; TR_NAME *rp_realm; @@ -102,15 +76,19 @@ struct tid_req { DH *tidc_dh; /* Client's public dh information */ TIDC_RESP_FUNC *resp_func; void *cookie; - json_t *json_references; /** References to objects dereferenced on request destruction*/ + time_t expiration_interval; /**< Time to key expire in minutes*/ + json_t *json_references; /**< References to objects dereferenced on request destruction*/ + json_t *path; /**< Path of systems this request has traversed; added by receiver*/ }; + struct tidc_instance { - TID_REQ *req_list; + // TID_REQ *req_list; // TBD -- Do we still need a separate private key */ // char *priv_key; // int priv_len; DH *client_dh; /* Client's DH struct with priv and pub keys */ }; + struct tids_instance { int req_count; char *priv_key; @@ -119,12 +97,26 @@ struct tids_instance { TIDS_REQ_FUNC *req_handler; tids_auth_func *auth_handler; void *cookie; + unsigned int tids_port; + TR_NAME *gss_name; /* GSS name client used for authentication */ }; - /** Decrement a reference to #json when this tid_req is cleaned up. A new reference is not created; in effect the caller is handing a reference they already hold to the TID_REQ.*/ void tid_req_cleanup_json(TID_REQ *, json_t *json); +int tid_req_add_path(TID_REQ *, const char *this_system, unsigned port); + +TID_SRVR_BLK *tid_srvr_blk_new(TALLOC_CTX *mem_ctx); +void tid_srvr_blk_free(TID_SRVR_BLK *srvr); +TID_SRVR_BLK *tid_srvr_blk_dup(TALLOC_CTX *mem_ctx, TID_SRVR_BLK *srvr); +TID_SRVR_BLK *tid_srvr_blk_add_func(TID_SRVR_BLK *head, TID_SRVR_BLK *new); +#define tid_srvr_blk_add(head, new) ((head)=tid_srvr_blk_add_func((head),(new))) +void tid_srvr_blk_set_path(TID_SRVR_BLK *block, TID_PATH *path); + +TID_RC tid_resp_cpy(TID_RESP *dst, TID_RESP *src); +void tid_resp_set_cons(TID_RESP *resp, TR_CONSTRAINT_SET *cons); +void tid_resp_set_error_path(TID_RESP *resp, json_t *ep); + #endif