X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=include%2Ftr_idp.h;h=8b56c37d9cfc4e2a2c5b12dcd5fa4414d80e0d63;hb=HEAD;hp=0eba31501512060ed265ba3e005dfde9d5e45fee;hpb=9883dc6b60bc95f04961e3590fe3ed8732147f13;p=trust_router.git diff --git a/include/tr_idp.h b/include/tr_idp.h index 0eba315..8b56c37 100644 --- a/include/tr_idp.h +++ b/include/tr_idp.h @@ -35,14 +35,20 @@ #ifndef TR_IDP_H #define TR_IDP_H -#include -#include +#include +#include + +#include +#include #include -typedef struct tr_aaa_server { - struct tr_aaa_server *next; - TR_NAME *hostname; -} TR_AAA_SERVER; +/* may also want to use in tr_rp.h */ +typedef enum tr_realm_origin { + TR_REALM_LOCAL=0, /* realm we were configured to contact */ + TR_REALM_REMOTE_INCOMPLETE, /* realm we were configured to know about, without contact info yet */ + TR_REALM_REMOTE, /* realm we were configured to know about, with discovered contact info */ + TR_REALM_DISCOVERED /* realm we learned about from a peer */ +} TR_REALM_ORIGIN; typedef struct tr_idp_realm { struct tr_idp_realm *next; @@ -51,8 +57,34 @@ typedef struct tr_idp_realm { int shared_config; TR_AAA_SERVER *aaa_servers; TR_APC *apcs; + TR_REALM_ORIGIN origin; /* how did we learn about this realm? */ + unsigned int refcount; /* how many TR_COMM_MEMBs refer to this realm */ } TR_IDP_REALM; -TR_AAA_SERVER *tr_idp_aaa_server_lookup(TR_INSTANCE *tr, TR_NAME *idp_realm, TR_NAME *comm); -TR_AAA_SERVER *tr_default_server_lookup(TR_INSTANCE *tr, TR_NAME *comm); +TR_IDP_REALM *tr_idp_realm_new(TALLOC_CTX *mem_ctx); +void tr_idp_realm_free(TR_IDP_REALM *idp); +TR_NAME *tr_idp_realm_get_id(TR_IDP_REALM *idp); +TR_NAME *tr_idp_realm_dup_id(TR_IDP_REALM *idp); +void tr_idp_realm_set_id(TR_IDP_REALM *idp, TR_NAME *id); +void tr_idp_realm_set_apcs(TR_IDP_REALM *idp, TR_APC *apc); +TR_APC *tr_idp_realm_get_apcs(TR_IDP_REALM *idp); +TR_IDP_REALM *tr_idp_realm_lookup(TR_IDP_REALM *idp_realms, TR_NAME *idp_name); +TR_IDP_REALM *tr_idp_realm_add_func(TR_IDP_REALM *head, TR_IDP_REALM *new); +#define tr_idp_realm_add(head,new) ((head)=tr_idp_realm_add_func((head),(new))) +TR_IDP_REALM *tr_idp_realm_remove_func(TR_IDP_REALM *head, TR_IDP_REALM *remove); +#define tr_idp_realm_remove(head,remove) ((head)=tr_idp_realm_remove_func((head),(remove))) +TR_IDP_REALM *tr_idp_realm_sweep_func(TR_IDP_REALM *head); +#define tr_idp_realm_sweep(head) ((head)=tr_idp_realm_sweep_func((head))) +int tr_idp_realm_aaa_server_count(TR_IDP_REALM *idp); +int tr_idp_realm_apc_count(TR_IDP_REALM *idp); +void tr_idp_realm_incref(TR_IDP_REALM *realm); + +void tr_idp_realm_decref(TR_IDP_REALM *realm); +TR_AAA_SERVER *tr_idp_aaa_server_lookup(TR_IDP_REALM *idp_realms, TR_NAME *idp_realm_name, TR_NAME *comm, int *shared_out); +TR_AAA_SERVER *tr_default_server_lookup(TR_AAA_SERVER *default_servers, TR_NAME *comm); + +/* tr_idp_encoders.c */ +char *tr_idp_realm_to_str(TALLOC_CTX *mem_ctx, TR_IDP_REALM *idp); +json_t *tr_idp_realms_to_json(TR_IDP_REALM *idp); + #endif