7 #include <trust_router/tr_dh.h>
11 typedef struct trp_req {
15 typedef struct trp_resp {
19 typedef struct trps_instance TRPS_INSTANCE;
21 typedef int (TRPS_REQ_FUNC)(TRPS_INSTANCE *, TRP_REQ *, TRP_RESP *, void *);
22 typedef void (TRPS_RESP_FUNC)(TRPS_INSTANCE *, TRP_REQ *, TRP_RESP *, void *);
23 typedef int (trps_auth_func)(gss_name_t client_name, TR_NAME *display_name, void *cookie);
26 /* encapsulate a gss context and its connection file handle */
27 typedef struct trps_connection {
32 /* a collection of the above */
33 #define TRPS_CONNECTIONS_MAX 10;
34 typedef struct trps_connection_set {
35 TRPS_CONNECTION *conn[TRPS_CONNECTIONS_MAX];
37 } TRPS_CONNECTION_SET;
39 /* TRP Client Instance Data */
40 typedef struct trpc_instance {
41 DH *client_dh; /* Client's DH struct with priv and pub keys */
44 /* TRP Server Instance Data */
45 struct trps_instance {
48 TRPS_REQ_FUNC *req_handler;
49 trps_auth_func *auth_handler;
51 struct tr_rp_client *rp_gss; /* Client matching GSS name, TBD -- FIX ME (??) */
52 TRPS_CONNECTION_SET *connections; /* active GSS connections */
56 TRPS_ERR_OK=0, /* success */
57 TRPS_ERR_NOMEM, /* allocation problem */
58 TRPS_ERR_MAX_CONN, /* out of connections */
59 TRPS_ERR_UNKNOWN /* catch-all */
64 /* these should probably be static? */
65 TRPS_CONNECTION *trps_connection_new(TALLOC_CTX *mem_ctx);
66 TRPS_CONNECTION_SET *trps_connection_set_new(TALLOC_CTX *mem_ctx);
67 TRPS_ERR trps_connection_set_add(TRPS_CONNECTION_SET *tcs, TRPS_CONNECTION *new_conn);
68 TRPS_ERR trps_connection_set_del(TRPS_CONNECTION_SET *tcs, TRPS_CONNECTION *conn);
69 unsigned int trps_connection_set_len(TRPS_CONNECTION_SET *tcs);
71 TRPC_INSTANCE *trpc_create (TALLOC_CTX *mem_ctx);
72 void trpc_destroy (TRPC_INSTANCE *trpc);
73 int trpc_open_connection (TRPC_INSTANCE *trpc, char *server, unsigned int port, gss_ctx_id_t *gssctx);
74 int trpc_send_msg (TRPC_INSTANCE *trpc, int conn, gss_ctx_id_t gssctx, const char *msg_content,
75 int *resp_handler(), void *cookie);
77 TRPS_INSTANCE *trps_create (TALLOC_CTX *mem_ctx);
78 void trps_destroy (TRPS_INSTANCE *trps);
79 int trps_send_msg (TRPS_INSTANCE *trps, int conn, gss_ctx_id_t gssctx, const char *msg_content);
80 int trps_accept(TRPS_INSTANCE *trps, int listen);
82 #endif /* TRP_INTERNAL_H */