- blade_session_t - blade_session_send(blade_session_t *bs, cJSON *json) - Application layer produces the json and calls this - Break down the json, determine if it is a request or a response/error - If request, produce a blade_request_t and cache it in the main handle with a TTL, lookup upon receiving a response or error - Blade main handle requires it's own maintenance thread running to deal with expiring objects like sessions and requests - blade_session_process(blade_session_t *bs, cJSON *json) - Session state machine pops received json from it's queue and calls this - Break down the json, determine if it is a request or response/error - If request, lookup the callbacks within the local RPC method registry (research Colm's RPC code to figure out where this is at) - If response or error, lookup the original outgoing request by the message id from the main handle to obtain the method or callbacks - Per Jerris' suggestion, segregate state machine states into their own functions (for both session and connection) - blade_request_t - blade_handle_requests_add(blade_request_t *br) - Add a request to the cache - blade_handle_requests_remove(blade_request_t *br) - Remove a request from the cache - blade_handle_requests_get(blade_handle_t *bh, const char *id) - Lookup a cached request by the message id - When receiving or sending a request this is produced to unify the request passed around - When sending an outbound request this is cached with a TTL for linking to an inbound response - This is what is passed into the request callback for a method - blade_response_t - This is only produced when receiving a response to collect required information for the callback - When receiving a response, the original blade_request_t is obtained and associated to the response - This is what is passed into the response callback for a method - blade_method_t (or whatever...) - Plumbing for construction/destruction which retains internal blade_handle_t reference - blade_handle_methods_add(blade_method_t *bm) - Add a method to the main registry - blade_handle_methods_remove(blade_method_t *bm) - Remove a method from the main registry - blade_handle_methods_get(blade_handle_t *bh, const char *method) - Lookup an rpc method by the fully qualified method name - More about method "spaces" later, they are collectives of methods added and removed together and possibly other factors shared among some methods - DSO - Macros to define and export symbol for pointer to blade_module_callbacks_t structure allowing onload to be called - onload(blade_module_t **bmP, blade_handle_t *bh) - module initialization, upon return the blade_module_t can be registered by the core - onunload(blade_module_t **bmP) - module can be deregistered by core before calling this for cleanup - onstartup(blade_module_t *bm, config_setting_t *config) - transport and method initialization and registration - onshutdown(blade_module_t *bm) - transport and method deregistration and cleanup