-#include <opensrf/transport_client.h>
-#include <opensrf/osrf_message.h>
-#include <opensrf/osrf_app_session.h>
-
#ifndef OSRF_STACK_H
#define OSRF_STACK_H
-/* the max number of oilsMessage blobs present in any one root packet */
-#define OSRF_MAX_MSGS_PER_PACKET 256
-// -----------------------------------------------------------------------------
-
-int osrf_stack_process( transport_client* client, int timeout, int* msg_received );
-osrfAppSession* osrf_stack_transport_handler( transport_message* msg, char* my_service );
-int osrf_stack_message_handler( osrf_app_session* session, osrf_message* msg );
-int osrf_stack_application_handler( osrf_app_session* session, osrf_message* msg );
-
+#include <opensrf/transport_client.h>
+#include <opensrf/osrf_message.h>
+#include <opensrf/osrf_app_session.h>
+osrfAppSession* osrf_stack_transport_handler( transport_message* msg,
+ const char* my_service );
#endif
#include <opensrf/osrf_stack.h>
#include <opensrf/osrf_application.h>
-osrf_message* _do_client( osrf_app_session*, osrf_message* );
-osrf_message* _do_server( osrf_app_session*, osrf_message* );
+/* the max number of oilsMessage blobs present in any one root packet */
+#define OSRF_MAX_MSGS_PER_PACKET 256
+// -----------------------------------------------------------------------------
+
+static int osrf_stack_process( transport_client* client, int timeout, int* msg_received );
+static int osrf_stack_message_handler( osrf_app_session* session, osrf_message* msg );
+static int osrf_stack_application_handler( osrf_app_session* session, osrf_message* msg );
+static osrf_message* _do_client( osrf_app_session*, osrf_message* );
+static osrf_message* _do_server( osrf_app_session*, osrf_message* );
/* tell osrf_app_session where the stack entry is */
int (*osrf_stack_entry_point) (transport_client*, int, int*) = &osrf_stack_process;
-int osrf_stack_process( transport_client* client, int timeout, int* msg_received ) {
+static int osrf_stack_process( transport_client* client, int timeout, int* msg_received ) {
if( !client ) return -1;
transport_message* msg = NULL;
if(msg_received) *msg_received = 0;
// -----------------------------------------------------------------------------
// Entry point into the stack
// -----------------------------------------------------------------------------
-osrfAppSession* osrf_stack_transport_handler( transport_message* msg, char* my_service ) {
+osrfAppSession* osrf_stack_transport_handler( transport_message* msg,
+ const char* my_service ) {
if(!msg) return NULL;
if( !session && my_service )
session = osrf_app_server_session_init( msg->thread, my_service, msg->sender);
- if( !session ) return NULL;
-
+ if( !session ) {
+ message_free( msg );
+ return NULL;
+ }
+
if(!msg->is_error)
osrfLogDebug( OSRF_LOG_MARK, "Session [%s] found or built", session->session_id );
return session;
}
-int osrf_stack_message_handler( osrf_app_session* session, osrf_message* msg ) {
+static int osrf_stack_message_handler( osrf_app_session* session, osrf_message* msg ) {
if(session == NULL || msg == NULL)
return 0;
/** If we return a message, that message should be passed up the stack,
* if we return NULL, we're finished for now...
*/
-osrf_message* _do_client( osrf_app_session* session, osrf_message* msg ) {
+static osrf_message* _do_client( osrf_app_session* session, osrf_message* msg ) {
if(session == NULL || msg == NULL)
return NULL;
/** If we return a message, that message should be passed up the stack,
* if we return NULL, we're finished for now...
*/
-osrf_message* _do_server( osrf_app_session* session, osrf_message* msg ) {
+static osrf_message* _do_server( osrf_app_session* session, osrf_message* msg ) {
if(session == NULL || msg == NULL) return NULL;
-int osrf_stack_application_handler( osrf_app_session* session, osrf_message* msg ) {
+static int osrf_stack_application_handler( osrf_app_session* session, osrf_message* msg ) {
if(session == NULL || msg == NULL) return 0;
if(msg->m_type == RESULT && session->type == OSRF_SESSION_CLIENT) {