#include <trust_router/tr_name.h>
#include <trust_router/tr_versioning.h>
+#include <gssapi.h>
#define TID_PORT 12309
-typedef struct gss_ctx_id_struct *gss_ctx_id_t;
-typedef struct tid_req TID_REQ;
typedef enum tid_rc {
TID_SUCCESS = 0,
struct tid_req {
struct tid_req *next_req;
+ int resp_sent;
int conn;
+ gss_ctx_id_t gssctx;
+ int resp_rcvd;
TR_NAME *rp_realm;
TR_NAME *realm;
TR_NAME *comm;
struct tidc_instance {
TID_REQ *req_list;
- char *priv_key;
- int priv_len;
- DH *priv_dh; /* Client's DH struct with priv and pub keys */
+ // 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 */
};
typedef int (TIDS_REQ_FUNC)(TIDS_INSTANCE *, TID_REQ *, TID_RESP **, void *);
+typedef int (tids_auth_func)(gss_name_t client_name, TR_NAME *display_name, void *cookie);
+
struct tids_instance {
int req_count;
char *priv_key;
+ char *ipaddr;
TIDS_REQ_FUNC *req_handler;
+ tids_auth_func *auth_handler;
void *cookie;
};
+TR_EXPORT TID_REQ *tid_dup_req (TID_REQ *orig_req);
+
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 int tidc_fwd_request (TIDC_INSTANCE *tidc, TID_REQ *req, TIDC_RESP_FUNC *resp_handler, void *cookie);
TR_EXPORT void tidc_destroy (TIDC_INSTANCE *tidc);
TR_EXPORT TIDS_INSTANCE *tids_create (void);
-TR_EXPORT int tids_start (TIDS_INSTANCE *tids, TIDS_REQ_FUNC *req_handler, void *cookie);
+TR_EXPORT int tids_start (TIDS_INSTANCE *tids, TIDS_REQ_FUNC *req_handler,
+ tids_auth_func *auth_handler,
+ void *cookie);
+TR_EXPORT int tids_send_response (TIDS_INSTANCE *tids, TID_REQ *req, TID_RESP *resp);
+TR_EXPORT int tids_send_err_response (TIDS_INSTANCE *tids, TID_REQ *req, const char *err_msg);
TR_EXPORT void tids_destroy (TIDS_INSTANCE *tids);
#endif