X-Git-Url: http://www.project-moonshot.org/gitweb/?p=trust_router.git;a=blobdiff_plain;f=include%2Fmon_internal.h;h=189695fa4d6923d981aec9911a875e4321843874;hp=171ce1810dcbfa71a8f4f75329e13d753a2b5f08;hb=884dfb4e2fa13d09a0c84d4da0febfdfb75e1bf6;hpb=3b59db3c5565b707e745d58f7ec1df1bdc7c1895 diff --git a/include/mon_internal.h b/include/mon_internal.h index 171ce18..189695f 100644 --- a/include/mon_internal.h +++ b/include/mon_internal.h @@ -40,10 +40,11 @@ #include #include #include -#include +//#include #include #include #include +#include /* Typedefs */ typedef struct mon_req MON_REQ; @@ -58,9 +59,11 @@ typedef enum mon_opt_type MON_OPT_TYPE; typedef enum mon_rc MON_RC; typedef struct mons_instance MONS_INSTANCE; +typedef struct monc_instance MONC_INSTANCE; typedef int (MONS_REQ_FUNC)(MONS_INSTANCE *, MON_REQ *, MON_RESP *, void *); typedef int (MONS_AUTH_FUNC)(gss_name_t client_name, TR_NAME *display_name, void *cookie); +typedef int (MONC_RESP_FUNC)(MONS_INSTANCE *, MON_REQ *, MON_RESP *, void *); /* Struct and enum definitions */ enum mon_rc { @@ -121,13 +124,18 @@ struct mons_instance { const char *hostname; unsigned int port; TR_GSS_NAMES *authorized_gss_names; - TIDS_INSTANCE *tids; - TRPS_INSTANCE *trps; + void *tids; // TODO sort out header file cycles and use typed pointers + void *trps; // TODO sort out header file cycles and use typed pointers MONS_REQ_FUNC *req_handler; MONS_AUTH_FUNC *auth_handler; void *cookie; }; +/* Monitoring client instance */ +struct monc_instance { + DH *client_dh; +}; + /* Prototypes */ /* tr_mon.c */ const char *mon_cmd_to_string(MON_CMD cmd); @@ -146,7 +154,7 @@ MON_OPT *mon_req_opt_index(MON_REQ *req, size_t index); json_t *mon_req_encode(MON_REQ *req); /* mon_req_decode.c */ -MON_REQ *mon_req_decode(TALLOC_CTX *mem_ctx, const char *req_json); +MON_REQ *mon_req_decode(TALLOC_CTX *mem_ctx, json_t *req_json); /* mon_resp.c */ MON_RESP *mon_resp_new(TALLOC_CTX *mem_ctx, @@ -165,4 +173,15 @@ int mons_get_listener(MONS_INSTANCE *mons, MONS_REQ_FUNC *req_handler, MONS_AUTH unsigned int port, void *cookie, int *fd_out, size_t max_fd); int mons_accept(MONS_INSTANCE *mons, int listen); +/* monc.c */ +MONC_INSTANCE *monc_create(void); +void monc_destroy(MONC_INSTANCE *monc); +int monc_open_connection (MONC_INSTANCE *monc, const char *server, unsigned int port, gss_ctx_id_t *gssctx); +int monc_send_request (MONC_INSTANCE *monc, int conn, gss_ctx_id_t gssctx, MONC_RESP_FUNC *resp_handler, + void *cookie); +int monc_fwd_request(MONC_INSTANCE *monc, int conn, gss_ctx_id_t gssctx, MON_REQ *mon_req, + MONC_RESP_FUNC *resp_handler, void *cookie); +DH * monc_get_dh(MONC_INSTANCE *inst); +DH *monc_set_dh(MONC_INSTANCE *inst, DH *dh); + #endif //TRUST_ROUTER_MON_REQ_H