X-Git-Url: http://www.project-moonshot.org/gitweb/?p=trust_router.git;a=blobdiff_plain;f=include%2Fmon_internal.h;h=f49889a0cb65afda6a70f1703ec2d07c2cc65869;hp=58cfdee84d23a1ca5f6bf3362369514f923dc158;hb=1a3ad555c6b58de28efb85e7ab07c2f35208ab0d;hpb=3fcf1090ac283dfb96bbc7ede879dc21ee1c3065 diff --git a/include/mon_internal.h b/include/mon_internal.h index 58cfdee..f49889a 100644 --- a/include/mon_internal.h +++ b/include/mon_internal.h @@ -37,9 +37,14 @@ #define TRUST_ROUTER_MON_REQ_H #include +#include #include #include + +#include +#include #include +#include /* Typedefs */ typedef struct mon_req MON_REQ; @@ -53,6 +58,10 @@ typedef enum mon_opt_type MON_OPT_TYPE; typedef enum mon_rc MON_RC; +typedef struct mons_instance MONS_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); /* Struct and enum definitions */ enum mon_rc { @@ -108,6 +117,15 @@ struct mon_resp { json_t *payload; }; +/* Monitoring server instance */ +struct mons_instance { + unsigned int port; + TR_GSS_NAMES *authorized_gss_names; + MONS_REQ_FUNC *req_handler; + MONS_AUTH_FUNC *auth_handler; + void *cookie; +}; + /* Prototypes */ /* tr_mon.c */ const char *mon_cmd_to_string(MON_CMD cmd); @@ -139,4 +157,9 @@ void mon_resp_free(MON_RESP *resp); /* mon_resp_encode.c */ json_t *mon_resp_encode(MON_RESP *resp); +/* mons.c */ +MONS_INSTANCE *mons_new(TALLOC_CTX *mem_ctx); +int mons_get_listener(MONS_INSTANCE *mons, MONS_REQ_FUNC *req_handler, MONS_AUTH_FUNC *auth_handler, unsigned int port, + void *cookie, int *fd_out, size_t max_fd); + #endif //TRUST_ROUTER_MON_REQ_H