X-Git-Url: http://www.project-moonshot.org/gitweb/?p=trust_router.git;a=blobdiff_plain;f=include%2Fmon_internal.h;h=db9d1b422be0138181656f8c0691d3465885d30d;hp=58cfdee84d23a1ca5f6bf3362369514f923dc158;hb=605ee6f071ad51755ba07b4e1a712814bbf4f780;hpb=34a48da22180b477dccb83cd5baa844f754ba9b9 diff --git a/include/mon_internal.h b/include/mon_internal.h index 58cfdee..db9d1b4 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,18 @@ struct mon_resp { json_t *payload; }; +/* Monitoring server instance */ +struct mons_instance { + char *hostname; + unsigned int port; + TR_GSS_NAMES *authorized_gss_names; + TIDS_INSTANCE *tids; + TRPS_INSTANCE *trps; + 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 +160,10 @@ 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); +int mons_accept(MONS_INSTANCE *mons, int listen); + #endif //TRUST_ROUTER_MON_REQ_H