// --------------------------------------------------------------------------
/** Allocates a initializes a new app_session */
-osrf_app_session* osrfAppSessionClientInit( char* remote_service );
-osrf_app_session* osrf_app_client_session_init( char* remote_service );
+osrf_app_session* osrfAppSessionClientInit( const char* remote_service );
+osrf_app_session* osrf_app_client_session_init( const char* remote_service );
/** Allocates and initializes a new server session. The global session cache
* is checked to see if this session already exists, if so, it's returned
*/
osrf_app_session* osrf_app_server_session_init(
- char* session_id, char* our_app, char* remote_id );
+ const char* session_id, const char* our_app, const char* remote_id );
/** sets the default locale for a session **/
char* osrf_app_session_set_locale( osrf_app_session*, const char* );
/** returns a session from the global session hash */
-osrf_app_session* osrf_app_session_find_session( char* session_id );
+osrf_app_session* osrf_app_session_find_session( const char* session_id );
/** Builds a new app_request object with the given payload andn returns
* the id of the request. This id is then used to perform work on the
* requeset.
*/
int osrfAppSessionMakeRequest(
- osrf_app_session* session, jsonObject* params,
- char* method_name, int protocol, string_array* param_strings);
+ osrf_app_session* session, const jsonObject* params,
+ const char* method_name, int protocol, string_array* param_strings);
int osrf_app_session_make_req(
- osrf_app_session* session, jsonObject* params,
- char* method_name, int protocol, string_array* param_strings);
+ osrf_app_session* session, const jsonObject* params,
+ const char* method_name, int protocol, string_array* param_strings);
int osrfAppSessionMakeLocaleRequest(
- osrf_app_session* session, jsonObject* params,
- char* method_name, int protocol, string_array* param_strings, char* locale);
+ osrf_app_session* session, const jsonObject* params, const char* method_name,
+ int protocol, string_array* param_strings, char* locale);
int osrf_app_session_make_locale_req(
- osrf_app_session* session, jsonObject* params,
- char* method_name, int protocol, string_array* param_strings, char* locale);
+ osrf_app_session* session, const jsonObject* params, const char* method_name,
+ int protocol, string_array* param_strings, char* locale);
/** Sets the given request to complete state */
void osrf_app_session_set_complete( osrf_app_session* session, int request_id );
/** Returns true if the given request is complete */
-int osrf_app_session_request_complete( osrf_app_session* session, int request_id );
+int osrf_app_session_request_complete( const osrf_app_session* session, int request_id );
/** Does a recv call on the given request */
osrf_message* osrfAppSessionRequestRecv(
void osrf_app_session_reset_remote( osrf_app_session* );
/** Sets the remote target to 'remote_id' */
-void osrf_app_session_set_remote( osrf_app_session* session, char* remote_id );
+void osrf_app_session_set_remote( osrf_app_session* session, const char* remote_id );
/** pushes the given message into the result list of the app_request
* whose request_id matches the messages thread_trace
int osrfAppSessionSendBatch( osrf_app_session*, osrf_message* msgs[], int size );
-int osrfAppRequestRespond( osrfAppSession* ses, int requestId, jsonObject* data );
-int osrfAppRequestRespondComplete( osrfAppSession* ses, int requestId, jsonObject* data );
+int osrfAppRequestRespond( osrfAppSession* ses, int requestId, const jsonObject* data );
+int osrfAppRequestRespondComplete(
+ osrfAppSession* ses, int requestId, const jsonObject* data );
int osrfAppSessionStatus( osrfAppSession* ses, int type, char* name, int reqId, char* message );
@param soFile The library (.so) file that implements this application
@return 0 on success, -1 on error
*/
-int osrfAppRegisterApplication( char* appName, char* soFile );
+int osrfAppRegisterApplication( const char* appName, const char* soFile );
/**
Register a method
@param streaming True if this is a streaming method that requires an atomic version
@return 0 on success, -1 on error
*/
-int osrfAppRegisterMethod( char* appName, char* methodName,
- char* symbolName, char* notes, int argc, int options );
+int osrfAppRegisterMethod( const char* appName, const char* methodName,
+ const char* symbolName, const char* notes, int argc, int options );
-int osrfAppRegisterExtendedMethod( char* appName, char* methodName,
- char* symbolName, char* notes, int argc, int options, void* );
+int osrfAppRegisterExtendedMethod( const char* appName, const char* methodName,
+ const char* symbolName, const char* notes, int argc, int options, void* );
-osrfMethod* _osrfAppBuildMethod( char* methodName,
- char* symbolName, char* notes, int argc, int options, void* );
+osrfMethod* _osrfAppBuildMethod( const char* methodName, const char* symbolName,
+ const char* notes, int argc, int options, void* );
/**
Finds the given app in the list of apps
@param name The name of the application
@return The application pointer or NULL if there is no such application
*/
-osrfApplication* _osrfAppFindApplication( char* name );
+osrfApplication* _osrfAppFindApplication( const char* name );
/**
Finds the given method for the given app
@return A method pointer or NULL if no such method
exists for the given application
*/
-osrfMethod* _osrfAppFindMethod( char* appName, char* methodName );
+osrfMethod* _osrfAppFindMethod( const char* appName, const char* methodName );
/**
Finds the given method for the given app
@return A method pointer or NULL if no such method
exists for the given application
*/
-osrfMethod* __osrfAppFindMethod( osrfApplication* app, char* methodName );
+osrfMethod* __osrfAppFindMethod( osrfApplication* app, const char* methodName );
/**
@params reqId The request id for this request
@param params The method parameters
*/
-int osrfAppRunMethod( char* appName, char* methodName,
+int osrfAppRunMethod( const char* appName, const char* methodName,
osrfAppSession* ses, int reqId, jsonObject* params );
/**
Registers all of the system methods for this app so that they may be
treated the same as other methods */
-int __osrfAppRegisterSysMethods( char* app );
+int __osrfAppRegisterSysMethods( const char* app );
@param msg The debug message to send to the client
@return 0 on successfully sending of the message, -1 otherwise
*/
-int osrfAppRequestRespondException( osrfAppSession* ses, int request, char* msg, ... );
+int osrfAppRequestRespondException( osrfAppSession* ses, int request, const char* msg, ... );
int __osrfAppPostProcess( osrfMethodContext* context, int retcode );
-int osrfAppRespond( osrfMethodContext* context, jsonObject* data );
-int _osrfAppRespond( osrfMethodContext* context, jsonObject* data, int complete );
-int osrfAppRespondComplete( osrfMethodContext* context, jsonObject* data );
+int osrfAppRespond( osrfMethodContext* context, const jsonObject* data );
+int _osrfAppRespond( osrfMethodContext* context, const jsonObject* data, int complete );
+int osrfAppRespondComplete( osrfMethodContext* context, const jsonObject* data );
/* OSRF_METHOD_ATOMIC and/or OSRF_METHOD_CACHABLE and/or 0 for no special options */
//int osrfAppProcessMethodOptions( char* method );
/**
* Tells the backend process to run its child init function */
-int osrfAppRunChildInit(char* appname);
-void osrfAppSetOnExit(osrfApplication* app, char* appName);
+int osrfAppRunChildInit(const char* appname);
+void osrfAppSetOnExit(osrfApplication* app, const char* appName);
void osrfAppRunExitCode();
@param maxCacheSeconds The maximum amount of time an object / string may
be cached. Negative number means there is no limit
*/
-int osrfCacheInit( char* serverStrings[], int size, time_t maxCacheSeconds );
+int osrfCacheInit( const char* serverStrings[], int size, time_t maxCacheSeconds );
/**
@param key The cache key
@return The object (which must be freed) if it exists, otherwise returns NULL
*/
-jsonObject* osrfCacheGetObject( char* key, ... );
+jsonObject* osrfCacheGetObject( const char* key, ... );
/**
Grabs a string from the cache.
@param key The cache key
@return The string (which must be freed) if it exists, otherwise returns NULL
*/
-char* osrfCacheGetString( char* key, ... );
+char* osrfCacheGetString( const char* key, ... );
/**
Removes the item with the given key from the cache.
@return 0 on success, -1 on error.
*/
-int osrfCacheRemove( char* key, ... );
+int osrfCacheRemove( const char* key, ... );
/**
* Sets the expire time to 'seconds' for the given key
*/
-int osrfCacheSetExpire( time_t seconds, char* key, ... );
+int osrfCacheSetExpire( time_t seconds, const char* key, ... );
// success, 0 otherwise.
// ---------------------------------------------------------------------------
int client_connect( transport_client* client,
- char* username, char* password, char* resource,
+ const char* username, const char* password, const char* resource,
int connect_timeout, enum TRANSPORT_AUTH_TYPE auth_type );
// ---------------------------------------------------------------------------
// Returns 1 if this client is currently connected to the server, 0 otherwise
// ---------------------------------------------------------------------------
-int client_connected( transport_client* client );
+int client_connected( const transport_client* client );
// ---------------------------------------------------------------------------
// This is the message handler required by transport_session. This handler
const char* unix_path, void* user_data, int component );
// ------------------------------------------------------------------
-// Returns the value of the given XML attribute
-// The xmlChar** construct is commonly returned from SAX event
-// handlers. Pass that in with the name of the attribute you want
-// to retrieve.
-// ------------------------------------------------------------------
-char* get_xml_attr( const xmlChar** atts, char* attr_name );
-
-// ------------------------------------------------------------------
// Waits at most 'timeout' seconds for data to arrive from the
// TCP handler. A timeout of -1 means to wait indefinitely.
// ------------------------------------------------------------------
truncation may occurr.
*/
int init_proc_title( int argc, char* argv[] );
-int set_proc_title( char* format, ... );
+int set_proc_title( const char* format, ... );
-int daemonize();
+int daemonize( void );
void* safe_malloc(int size);
void* safe_calloc(int size);
// XXX This isn't defined in utils.c!! removing for now...
//int buffer_addchar(growing_buffer* gb, char c);
-int buffer_add(growing_buffer* gb, char* c);
+int buffer_add(growing_buffer* gb, const char* c);
int buffer_fadd(growing_buffer* gb, const char* format, ... );
int buffer_reset( growing_buffer* gb);
-char* buffer_data( growing_buffer* gb);
+char* buffer_data( const growing_buffer* gb);
char* buffer_release( growing_buffer* gb );
int buffer_free( growing_buffer* gb );
int buffer_add_char(growing_buffer* gb, char c);
// Utility method
-double get_timestamp_millis();
+double get_timestamp_millis( void );
/* returns true if the whole string is a number */
-int stringisnum(char* s);
+int stringisnum(const char* s);
/* reads a file and returns the string version of the file
user is responsible for freeing the returned char*
Calculates the md5 of the text provided.
The returned string must be freed by the caller.
*/
-char* md5sum( char* text, ... );
+char* md5sum( const char* text, ... );
/**
OSRF_METHOD_VERIFY_CONTEXT(ctx);
- jsonObject* x = jsonObjectGetIndex(ctx->params, 0);
- jsonObject* y = jsonObjectGetIndex(ctx->params, 1);
+ const jsonObject* x = jsonObjectGetIndex(ctx->params, 0);
+ const jsonObject* y = jsonObjectGetIndex(ctx->params, 1);
if( x && y ) {
OSRF_METHOD_VERIFY_CONTEXT(ctx); /* see osrf_application.h */
/* collect the request params */
- jsonObject* x = jsonObjectGetIndex(ctx->params, 0);
- jsonObject* y = jsonObjectGetIndex(ctx->params, 1);
+ const jsonObject* x = jsonObjectGetIndex(ctx->params, 0);
+ const jsonObject* y = jsonObjectGetIndex(ctx->params, 1);
if( x && y ) {
return 0;
}
- jsonObject* serv = jsonObjectGetIndex(ctx->params, 0);
- jsonObject* meth = jsonObjectGetIndex(ctx->params, 1);
- char* service = jsonObjectGetString(serv);
- char* methd = jsonObjectGetString(meth);
+ const jsonObject* serv = jsonObjectGetIndex(ctx->params, 0);
+ const jsonObject* meth = jsonObjectGetIndex(ctx->params, 1);
+ const char* service = jsonObjectGetString(serv);
+ const char* methd = jsonObjectGetString(meth);
if( service && methd ) {
/* shove the additional params into an array */
req->complete = 0;
req->payload = msg;
req->result = NULL;
+ req->reset_timeout = 0;
return req;
}
/** returns a session from the global session hash */
-osrf_app_session* osrf_app_session_find_session( char* session_id ) {
+osrf_app_session* osrf_app_session_find_session( const char* session_id ) {
if(session_id) return osrfHashGet(osrfAppSessionCache, session_id);
return NULL;
}
osrfHashSet( osrfAppSessionCache, session, session->session_id );
}
-/** Allocates a initializes a new app_session */
+/** Allocates and initializes a new app_session */
-osrf_app_session* osrfAppSessionClientInit( char* remote_service ) {
+osrf_app_session* osrfAppSessionClientInit( const char* remote_service ) {
return osrf_app_client_session_init( remote_service );
}
-osrf_app_session* osrf_app_client_session_init( char* remote_service ) {
+osrf_app_session* osrf_app_client_session_init( const char* remote_service ) {
if (!remote_service) {
osrfLogWarning( OSRF_LOG_MARK, "No remote service specified in osrf_app_client_session_init");
session->state = OSRF_SESSION_DISCONNECTED;
session->type = OSRF_SESSION_CLIENT;
//session->next = NULL;
+
+ session->userData = NULL;
+ session->userDataFree = NULL;
+
_osrf_app_session_push_session( session );
return session;
}
osrf_app_session* osrf_app_server_session_init(
- char* session_id, char* our_app, char* remote_id ) {
+ const char* session_id, const char* our_app, const char* remote_id ) {
osrfLogDebug( OSRF_LOG_MARK, "Initing server session with session id %s, service %s,"
" and remote_id %s", session_id, our_app, remote_id );
session->state = OSRF_SESSION_DISCONNECTED;
session->type = OSRF_SESSION_SERVER;
+ session->userData = NULL;
+ session->userDataFree = NULL;
+
_osrf_app_session_push_session( session );
return session;
}
int osrfAppSessionMakeRequest(
- osrf_app_session* session, jsonObject* params,
- char* method_name, int protocol, string_array* param_strings ) {
+ osrf_app_session* session, const jsonObject* params,
+ const char* method_name, int protocol, string_array* param_strings ) {
return osrf_app_session_make_locale_req( session, params,
method_name, protocol, param_strings, NULL );
}
int osrfAppSessionMakeLocaleRequest(
- osrf_app_session* session, jsonObject* params,
- char* method_name, int protocol, string_array* param_strings, char* locale ) {
+ osrf_app_session* session, const jsonObject* params, const char* method_name,
+ int protocol, string_array* param_strings, char* locale ) {
return osrf_app_session_make_locale_req( session, params,
method_name, protocol, param_strings, locale );
}
int osrf_app_session_make_req(
- osrf_app_session* session, jsonObject* params,
- char* method_name, int protocol, string_array* param_strings) {
+ osrf_app_session* session, const jsonObject* params,
+ const char* method_name, int protocol, string_array* param_strings) {
return osrf_app_session_make_locale_req(session, params,
method_name, protocol, param_strings, NULL);
}
int osrf_app_session_make_locale_req(
- osrf_app_session* session, jsonObject* params,
- char* method_name, int protocol, string_array* param_strings, char* locale ) {
+ osrf_app_session* session, const jsonObject* params, const char* method_name,
+ int protocol, string_array* param_strings, char* locale ) {
if(session == NULL) return -1;
osrfLogMkXid();
if(req) req->complete = 1;
}
-int osrf_app_session_request_complete( osrf_app_session* session, int request_id ) {
+int osrf_app_session_request_complete( const osrf_app_session* session, int request_id ) {
if(session == NULL)
return 0;
osrf_app_request* req = OSRF_LIST_GET_INDEX( session->request_queue, request_id );
session->remote_id = strdup(session->orig_remote_id);
}
-void osrf_app_session_set_remote( osrf_app_session* session, char* remote_id ) {
+void osrf_app_session_set_remote( osrf_app_session* session, const char* remote_id ) {
if(session == NULL)
return;
if( session->remote_id )
*/
int osrf_app_session_queue_wait( osrf_app_session* session, int timeout, int* recvd ){
if(session == NULL) return 0;
- int ret_val = 0;
osrfLogDebug(OSRF_LOG_MARK, "AppSession in queue_wait with timeout %d", timeout );
- ret_val = osrf_stack_entry_point(session->transport_handle, timeout, recvd);
- return ret_val;
+ return osrf_stack_entry_point(session->transport_handle, timeout, recvd);
}
/** Disconnects (if client) and removes the given session from the global session cache
-int osrfAppRequestRespond( osrfAppSession* ses, int requestId, jsonObject* data ) {
+int osrfAppRequestRespond( osrfAppSession* ses, int requestId, const jsonObject* data ) {
if(!ses || ! data ) return -1;
osrf_message* msg = osrf_message_init( RESULT, requestId, 1 );
int osrfAppRequestRespondComplete(
- osrfAppSession* ses, int requestId, jsonObject* data ) {
+ osrfAppSession* ses, int requestId, const jsonObject* data ) {
osrf_message* payload = osrf_message_init( RESULT, requestId, 1 );
osrf_message_set_status_info( payload, NULL, "OK", OSRF_STATUS_OK );
#include <opensrf/osrf_application.h>
-osrfHash* __osrfAppHash = NULL;
+static osrfHash* _osrfAppHash = NULL;
-int osrfAppRegisterApplication( char* appName, char* soFile ) {
+int osrfAppRegisterApplication( const char* appName, const char* soFile ) {
if(!appName || ! soFile) return -1;
char* error;
- if(!__osrfAppHash) __osrfAppHash = osrfNewHash();
+ if(!_osrfAppHash) _osrfAppHash = osrfNewHash();
osrfLogInfo( OSRF_LOG_MARK, "Registering application %s with file %s", appName, soFile );
}
app->methods = osrfNewHash();
- osrfHashSet( __osrfAppHash, app, appName );
+ osrfHashSet( _osrfAppHash, app, appName );
/* see if we can run the initialize method */
int (*init) (void);
}
-void osrfAppSetOnExit(osrfApplication* app, char* appName) {
+void osrfAppSetOnExit(osrfApplication* app, const char* appName) {
if(!(app && appName)) return;
/* see if we can run the initialize method */
}
-int osrfAppRunChildInit(char* appname) {
+int osrfAppRunChildInit(const char* appname) {
osrfApplication* app = _osrfAppFindApplication(appname);
if(!app) return -1;
void osrfAppRunExitCode() {
- osrfHashIterator* itr = osrfNewHashIterator(__osrfAppHash);
+ osrfHashIterator* itr = osrfNewHashIterator(_osrfAppHash);
osrfApplication* app;
while( (app = osrfHashIteratorNext(itr)) ) {
if( app->onExit ) {
}
-int osrfAppRegisterMethod( char* appName, char* methodName,
- char* symbolName, char* notes, int argc, int options ) {
+int osrfAppRegisterMethod( const char* appName, const char* methodName,
+ const char* symbolName, const char* notes, int argc, int options ) {
return osrfAppRegisterExtendedMethod(
appName,
}
-int osrfAppRegisterExtendedMethod( char* appName, char* methodName,
- char* symbolName, char* notes, int argc, int options, void * user_data ) {
+int osrfAppRegisterExtendedMethod( const char* appName, const char* methodName,
+ const char* symbolName, const char* notes, int argc, int options, void * user_data ) {
if( !appName || ! methodName ) return -1;
-osrfMethod* _osrfAppBuildMethod( char* methodName,
- char* symbolName, char* notes, int argc, int options, void* user_data ) {
+osrfMethod* _osrfAppBuildMethod( const char* methodName, const char* symbolName,
+ const char* notes, int argc, int options, void* user_data ) {
osrfMethod* method = safe_malloc(sizeof(osrfMethod));
}
-int __osrfAppRegisterSysMethods( char* app ) {
+int __osrfAppRegisterSysMethods( const char* app ) {
osrfAppRegisterMethod(
app, OSRF_SYSMETHOD_INTROSPECT, NULL,
return 0;
}
-osrfApplication* _osrfAppFindApplication( char* name ) {
+osrfApplication* _osrfAppFindApplication( const char* name ) {
if(!name) return NULL;
- return (osrfApplication*) osrfHashGet(__osrfAppHash, name);
+ return (osrfApplication*) osrfHashGet(_osrfAppHash, name);
}
-osrfMethod* __osrfAppFindMethod( osrfApplication* app, char* methodName ) {
+osrfMethod* __osrfAppFindMethod( osrfApplication* app, const char* methodName ) {
if(!app || ! methodName) return NULL;
return (osrfMethod*) osrfHashGet( app->methods, methodName );
}
-osrfMethod* _osrfAppFindMethod( char* appName, char* methodName ) {
+osrfMethod* _osrfAppFindMethod( const char* appName, const char* methodName ) {
if(!appName || ! methodName) return NULL;
return __osrfAppFindMethod( _osrfAppFindApplication(appName), methodName );
}
-int osrfAppRunMethod( char* appName, char* methodName,
+int osrfAppRunMethod( const char* appName, const char* methodName,
osrfAppSession* ses, int reqId, jsonObject* params ) {
if( !(appName && methodName && ses) ) return -1;
}
-int osrfAppRespond( osrfMethodContext* ctx, jsonObject* data ) {
+int osrfAppRespond( osrfMethodContext* ctx, const jsonObject* data ) {
return _osrfAppRespond( ctx, data, 0 );
}
-int osrfAppRespondComplete( osrfMethodContext* context, jsonObject* data ) {
+int osrfAppRespondComplete( osrfMethodContext* context, const jsonObject* data ) {
return _osrfAppRespond( context, data, 1 );
}
-int _osrfAppRespond( osrfMethodContext* ctx, jsonObject* data, int complete ) {
+int _osrfAppRespond( osrfMethodContext* ctx, const jsonObject* data, int complete ) {
if(!(ctx && ctx->method)) return -1;
if( ctx->method->options & OSRF_METHOD_ATOMIC ) {
return 0;
}
-int osrfAppRequestRespondException( osrfAppSession* ses, int request, char* msg, ... ) {
+int osrfAppRequestRespondException( osrfAppSession* ses, int request, const char* msg, ... ) {
if(!ses) return -1;
if(!msg) msg = "";
VA_LIST_TO_STRING(msg);
}
-static void __osrfAppSetIntrospectMethod( osrfMethodContext* ctx, osrfMethod* method, jsonObject* resp ) {
+static void _osrfAppSetIntrospectMethod( osrfMethodContext* ctx, const osrfMethod* method, jsonObject* resp ) {
if(!(ctx && resp)) return;
jsonObjectSetKey(resp, "api_name", jsonNewObject(method->name));
- jsonObjectSetKey(resp, "method", jsonNewObject(method->symbol));
+ jsonObjectSetKey(resp, "method", jsonNewObject(method->symbol));
jsonObjectSetKey(resp, "service", jsonNewObject(ctx->session->remote_service));
jsonObjectSetKey(resp, "notes", jsonNewObject(method->notes));
jsonObjectSetKey(resp, "argc", jsonNewNumberObject(method->argc));
if( (len = strlen(methodSubstring)) <= strlen(method->name) ) {
if( !strncmp( method->name, methodSubstring, len) ) {
resp = jsonNewObject(NULL);
- __osrfAppSetIntrospectMethod( ctx, method, resp );
+ _osrfAppSetIntrospectMethod( ctx, method, resp );
osrfAppRespond(ctx, resp);
jsonObjectFree(resp);
}
osrfMethod* method;
while( (method = osrfHashIteratorNext(itr)) ) {
resp = jsonNewObject(NULL);
- __osrfAppSetIntrospectMethod( ctx, method, resp );
+ _osrfAppSetIntrospectMethod( ctx, method, resp );
osrfAppRespond(ctx, resp);
jsonObjectFree(resp);
}
OSRF_METHOD_VERIFY_CONTEXT(ctx);
int i;
for( i = 0; i < ctx->params->size; i++ ) {
- jsonObject* str = jsonObjectGetIndex(ctx->params,i);
+ const jsonObject* str = jsonObjectGetIndex(ctx->params,i);
osrfAppRespond(ctx, str);
}
return 1;
#include <opensrf/osrf_cache.h>
-struct memcache* __osrfCache = NULL;
-time_t __osrfCacheMaxSeconds = -1;
+static struct memcache* _osrfCache = NULL;
+static time_t _osrfCacheMaxSeconds = -1;
-int osrfCacheInit( char* serverStrings[], int size, time_t maxCacheSeconds ) {
+int osrfCacheInit( const char* serverStrings[], int size, time_t maxCacheSeconds ) {
if( !(serverStrings && size > 0) ) return -1;
int i;
- __osrfCache = mc_new();
- __osrfCacheMaxSeconds = maxCacheSeconds;
+ _osrfCache = mc_new();
+ _osrfCacheMaxSeconds = maxCacheSeconds;
for( i = 0; i < size && serverStrings[i]; i++ )
- mc_server_add4( __osrfCache, serverStrings[i] );
+ mc_server_add4( _osrfCache, serverStrings[i] );
return 0;
}
if( !(key && obj) ) return -1;
char* s = jsonObjectToJSON( obj );
osrfLogInternal( OSRF_LOG_MARK, "osrfCachePut(): Putting object: %s", s);
- if( seconds < 0 ) seconds = __osrfCacheMaxSeconds;
+ if( seconds < 0 ) seconds = _osrfCacheMaxSeconds;
- mc_set(__osrfCache, key, strlen(key), s, strlen(s), seconds, 0);
+ mc_set(_osrfCache, key, strlen(key), s, strlen(s), seconds, 0);
free(s);
return 0;
}
int osrfCachePutString( char* key, const char* value, time_t seconds ) {
if( !(key && value) ) return -1;
- if( seconds < 0 ) seconds = __osrfCacheMaxSeconds;
+ if( seconds < 0 ) seconds = _osrfCacheMaxSeconds;
osrfLogInternal( OSRF_LOG_MARK, "osrfCachePutString(): Putting string: %s", value);
- mc_set(__osrfCache, key, strlen(key), value, strlen(value), seconds, 0);
+ mc_set(_osrfCache, key, strlen(key), value, strlen(value), seconds, 0);
return 0;
}
-jsonObject* osrfCacheGetObject( char* key, ... ) {
+jsonObject* osrfCacheGetObject( const char* key, ... ) {
jsonObject* obj = NULL;
if( key ) {
VA_LIST_TO_STRING(key);
- char* data = (char*) mc_aget( __osrfCache, VA_BUF, strlen(VA_BUF) );
+ char* data = (char*) mc_aget( _osrfCache, VA_BUF, strlen(VA_BUF) );
if( data ) {
osrfLogInternal( OSRF_LOG_MARK, "osrfCacheGetObject(): Returning object: %s", data);
obj = jsonParseString( data );
return NULL;
}
-char* osrfCacheGetString( char* key, ... ) {
+char* osrfCacheGetString( const char* key, ... ) {
if( key ) {
VA_LIST_TO_STRING(key);
- char* data = (char*) mc_aget(__osrfCache, VA_BUF, strlen(VA_BUF) );
+ char* data = (char*) mc_aget(_osrfCache, VA_BUF, strlen(VA_BUF) );
osrfLogInternal( OSRF_LOG_MARK, "osrfCacheGetObject(): Returning object: %s", data);
if(!data) osrfLogWarning(OSRF_LOG_MARK, "No cache data exists with key %s", VA_BUF);
return data;
}
-int osrfCacheRemove( char* key, ... ) {
+int osrfCacheRemove( const char* key, ... ) {
if( key ) {
VA_LIST_TO_STRING(key);
- return mc_delete(__osrfCache, VA_BUF, strlen(VA_BUF), 0 );
+ return mc_delete(_osrfCache, VA_BUF, strlen(VA_BUF), 0 );
}
return -1;
}
-int osrfCacheSetExpire( time_t seconds, char* key, ... ) {
+int osrfCacheSetExpire( time_t seconds, const char* key, ... ) {
if( key ) {
VA_LIST_TO_STRING(key);
jsonObject* o = osrfCacheGetObject( VA_BUF );
}
void osrfCacheCleanup() {
- if(__osrfCache)
- mc_free(__osrfCache);
+ if(_osrfCache)
+ mc_free(_osrfCache);
}
*/
#include <opensrf/osrf_json.h>
+#include <opensrf/osrf_json_utils.h>
-jsonObject* _jsonObjectEncodeClass( const jsonObject* obj, int ignoreClass );
+static jsonObject* _jsonObjectEncodeClass( const jsonObject* obj, int ignoreClass );
-
-jsonObject* jsonObjectFindPath( const jsonObject* obj, char* path, ...);
-jsonObject* _jsonObjectFindPathRecurse(const jsonObject* obj, char* root, char* path);
-jsonObject* __jsonObjectFindPathRecurse(const jsonObject* obj, char* root);
-
-
-static char* __tabs(int count) {
+static char* _tabs(int count) {
growing_buffer* buf = buffer_init(24);
int i;
for(i=0;i<count;i++) OSRF_BUFFER_ADD(buf, " ");
if( c == '{' || c == '[' ) {
- tab = __tabs(++depth);
+ tab = _tabs(++depth);
buffer_fadd( buf, "%c\n%s", c, tab);
free(tab);
} else if( c == '}' || c == ']' ) {
- tab = __tabs(--depth);
+ tab = _tabs(--depth);
buffer_fadd( buf, "\n%s%c", tab, c);
free(tab);
if(string[i+1] != ',') {
- tab = __tabs(depth);
+ tab = _tabs(depth);
buffer_fadd( buf, "%s", tab );
free(tab);
}
} else if( c == ',' ) {
- tab = __tabs(depth);
+ tab = _tabs(depth);
buffer_fadd(buf, ",\n%s", tab);
free(tab);
return _jsonObjectEncodeClass( obj, 0 );
}
-jsonObject* _jsonObjectEncodeClass( const jsonObject* obj, int ignoreClass ) {
+static jsonObject* _jsonObjectEncodeClass( const jsonObject* obj, int ignoreClass ) {
//if(!obj) return NULL;
if(!obj) return jsonNewObject(NULL);
t = NULL;
do {
- obj = jsonObjectGetKey(obj, token);
+ obj = jsonObjectGetKeyConst(obj, token);
} while( (token = strtok_r(NULL, "/", &tt)) && obj);
return jsonObjectClone(obj);
/* if the current object has a node that matches, add it */
- jsonObject* o = jsonObjectGetKey(obj, root);
+ const jsonObject* o = jsonObjectGetKeyConst(obj, root);
if(o) jsonObjectPush( arr, jsonObjectClone(o) );
jsonObject* tmp = NULL;
typedef struct osrfXMLGatewayParserStruct osrfXMLGatewayParser;
/** returns the attribute value with the given attribute name */
-static char* getXMLAttr(const xmlChar** atts, char* attr_name) {
+static char* getXMLAttr(const xmlChar** atts, const char* attr_name) {
int i;
if (atts != NULL) {
for(i = 0; (atts[i] != NULL); i++) {
-static char* _escape_xml (char*);
+static char* _escape_xml (const char*);
static int _recurse_jsonObjectToXML(jsonObject*, growing_buffer*);
-char* jsonObjectToXML(jsonObject* obj) {
+char* jsonObjectToXML(const jsonObject* obj) {
growing_buffer * res_xml;
- char * output;
res_xml = buffer_init(1024);
return strdup("<null/>");
_recurse_jsonObjectToXML( obj, res_xml );
- output = buffer_data(res_xml);
-
- buffer_free(res_xml);
-
- return output;
+ return buffer_release(res_xml);
}
-int _recurse_jsonObjectToXML(jsonObject* obj, growing_buffer* res_xml) {
+int _recurse_jsonObjectToXML(const jsonObject* obj, growing_buffer* res_xml) {
char * hint = NULL;
- char * bool_val = NULL;
- int i = 0;
if (obj->classname)
hint = strdup(obj->classname);
} else if(obj->type == JSON_BOOL) {
+ const char* bool_val;
if (obj->value.b)
- bool_val = strdup("true");
+ bool_val = "true";
else
- bool_val = strdup("false");
+ bool_val = "false";
if (hint)
buffer_fadd(res_xml, "<boolean value=\"%s\" class_hint=\"%s\"/>", bool_val, hint);
else
buffer_fadd(res_xml, "<boolean value=\"%s\"/>", bool_val);
- free(bool_val);
-
} else if (obj->type == JSON_STRING) {
if (hint) {
char * t = _escape_xml(jsonObjectGetString(obj));
else
buffer_add(res_xml,"<array>");
- for ( i = 0; i!= obj->size; i++ )
+ for ( int i = 0; i!= obj->size; i++ )
_recurse_jsonObjectToXML(jsonObjectGetIndex(obj,i), res_xml);
buffer_add(res_xml,"</array>");
buffer_add(res_xml,"<object>");
jsonIterator* itr = jsonNewIterator(obj);
- jsonObject* tmp;
+ const jsonObject* tmp;
while( (tmp = jsonIteratorNext(itr)) ) {
buffer_fadd(res_xml,"<element key=\"%s\">",itr->key);
_recurse_jsonObjectToXML(tmp, res_xml);
return 1;
}
-char* _escape_xml (char* text) {
- char* out;
+char* _escape_xml (const char* text) {
growing_buffer* b = buffer_init(256);
int len = strlen(text);
int i;
else
buffer_add_char(b,text[i]);
}
- out = buffer_data(b);
- buffer_free(b);
- return out;
+ return buffer_release(b);
}
#endif
if( cacheServers->type == JSON_ARRAY ) {
int i;
- char* servers[cacheServers->size];
+ const char* servers[cacheServers->size];
for( i = 0; i != cacheServers->size; i++ ) {
servers[i] = jsonObjectGetString( jsonObjectGetIndex(cacheServers, i) );
osrfLogInfo( OSRF_LOG_MARK, "Adding cache server %s", servers[i]);
osrfCacheInit( servers, cacheServers->size, atoi(maxCache) );
} else {
- char* servers[] = { jsonObjectGetString(cacheServers) };
+ const char* servers[] = { jsonObjectGetString(cacheServers) };
osrfLogInfo( OSRF_LOG_MARK, "Adding cache server %s", servers[0]);
osrfCacheInit( servers, 1, atoi(maxCache) );
}
osrfStringArrayAdd(arr, jsonObjectGetString(apps));
} else {
- jsonObject* app;
+ const jsonObject* app;
while( (app = jsonObjectGetIndex(apps, i++)) )
osrfStringArrayAdd(arr, jsonObjectGetString(app));
}
if(server == NULL) return NULL;
/* build and clear the client object */
- size_t c_size = sizeof( transport_client);
- transport_client* client = safe_malloc( c_size );
+ transport_client* client = safe_malloc( sizeof( transport_client) );
/* build and clear the message list */
- size_t l_size = sizeof( transport_message_list );
- client->m_list = safe_malloc( l_size );
+ client->m_list = safe_malloc( sizeof( transport_message_list ) );
client->m_list->next = NULL;
client->m_list->message = NULL;
int client_connect( transport_client* client,
- char* username, char* password, char* resource,
+ const char* username, const char* password, const char* resource,
int connect_timeout, enum TRANSPORT_AUTH_TYPE auth_type ) {
if(client == NULL) return 0;
return session_connect( client->session, username,
return session_disconnect( client->session );
}
-int client_connected( transport_client* client ) {
+int client_connected( const transport_client* client ) {
if(client == NULL) return 0;
return client->session->state_machine->connected;
}
transport_client* cli = (transport_client*) client;
- size_t len = sizeof(transport_message_node);
- transport_message_node* node =
- (transport_message_node*) safe_malloc(len);
+ transport_message_node* node = safe_malloc( sizeof( transport_message_node) );
+ node->next = NULL;
node->type = MESSAGE_LIST_ITEM;
node->message = msg;
#include <opensrf/transport_session.h>
-
+static char* get_xml_attr( const xmlChar** atts, const char* attr_name );
// ---------------------------------------------------------------------------------
// returns a built and allocated transport_session object.
session->status_buffer = buffer_init( JABBER_STATUS_BUFSIZE );
session->recipient_buffer = buffer_init( JABBER_JID_BUFSIZE );
session->message_error_type = buffer_init( JABBER_JID_BUFSIZE );
- session->session_id = buffer_init( 64 );
+ session->session_id = buffer_init( 64 );
+
+ session->message_error_code = 0;
/* for OpenSRF extensions */
session->router_to_buffer = buffer_init( JABBER_JID_BUFSIZE );
session->router_class_buffer = buffer_init( JABBER_JID_BUFSIZE );
session->router_command_buffer = buffer_init( JABBER_JID_BUFSIZE );
+ session->router_broadcast = 0;
if( session->body_buffer == NULL || session->subject_buffer == NULL ||
session->thread_buffer == NULL || session->from_buffer == NULL ||
session->session_id == NULL ) {
osrfLogError(OSRF_LOG_MARK, "init_transport(): buffer_init returned NULL" );
+ buffer_free( session->body_buffer );
+ buffer_free( session->subject_buffer );
+ buffer_free( session->thread_buffer );
+ buffer_free( session->from_buffer );
+ buffer_free( session->status_buffer );
+ buffer_free( session->recipient_buffer );
+ buffer_free( session->router_to_buffer );
+ buffer_free( session->router_from_buffer );
+ buffer_free( session->router_class_buffer );
+ buffer_free( session->router_command_buffer );
+ buffer_free( session->session_id );
+ free( session );
return 0;
}
/* initialize the jabber state machine */
session->state_machine = (jabber_machine*) safe_malloc( sizeof(jabber_machine) );
+ session->state_machine->connected = 0;
+ session->state_machine->connecting = 0;
+ session->state_machine->in_message = 0;
+ session->state_machine->in_message_body = 0;
+ session->state_machine->in_thread = 0;
+ session->state_machine->in_subject = 0;
+ session->state_machine->in_error = 0;
+ session->state_machine->in_message_error = 0;
+ session->state_machine->in_iq = 0;
+ session->state_machine->in_presence = 0;
+ session->state_machine->in_status = 0;
/* initialize the sax push parser */
session->parser_ctxt = xmlCreatePushParserCtxt(SAXHandler, session, "", 0, NULL);
session->sock_mgr = (socket_manager*) safe_malloc( sizeof(socket_manager) );
session->sock_mgr->data_received = &grab_incoming;
+ session->sock_mgr->on_socket_closed = NULL;
+ session->sock_mgr->socket = NULL;
session->sock_mgr->blob = session;
session->port = port;
else session->unix_path = NULL;
session->sock_id = 0;
+ session->message_callback = NULL;
return session;
}
}
}
-char* get_xml_attr( const xmlChar** atts, char* attr_name ) {
+// ------------------------------------------------------------------
+// Returns the value of the given XML attribute
+// The xmlChar** construct is commonly returned from SAX event
+// handlers. Pass that in with the name of the attribute you want
+// to retrieve.
+// ------------------------------------------------------------------
+static char* get_xml_attr( const xmlChar** atts, const char* attr_name ) {
int i;
if (atts != NULL) {
for(i = 0;(atts[i] != NULL);i++) {
return;
}
- if( strcmp( (char*) name, "body" ) == 0 ) {
+ if( strcmp( (const char*) name, "body" ) == 0 ) {
ses->state_machine->in_message_body = 0;
return;
}
- if( strcmp( (char*) name, "subject" ) == 0 ) {
+ if( strcmp( (const char*) name, "subject" ) == 0 ) {
ses->state_machine->in_subject = 0;
return;
}
- if( strcmp( (char*) name, "thread" ) == 0 ) {
+ if( strcmp( (const char*) name, "thread" ) == 0 ) {
ses->state_machine->in_thread = 0;
return;
}
- if( strcmp( (char*) name, "iq" ) == 0 ) {
+ if( strcmp( (const char*) name, "iq" ) == 0 ) {
ses->state_machine->in_iq = 0;
if( ses->message_error_code > 0 ) {
osrfLogWarning( OSRF_LOG_MARK, "Error in IQ packet: code %d", ses->message_error_code );
return;
}
- if( strcmp( (char*) name, "presence" ) == 0 ) {
+ if( strcmp( (const char*) name, "presence" ) == 0 ) {
ses->state_machine->in_presence = 0;
/*
if( ses->presence_callback ) {
return;
}
- if( strcmp( (char*) name, "status" ) == 0 ) {
+ if( strcmp( (const char*) name, "status" ) == 0 ) {
ses->state_machine->in_status = 0;
return;
}
- if( strcmp( (char*) name, "error" ) == 0 ) {
+ if( strcmp( (const char*) name, "error" ) == 0 ) {
ses->state_machine->in_message_error = 0;
return;
}
- if( strcmp( (char*) name, "error:error" ) == 0 ) {
+ if( strcmp( (const char*) name, "error:error" ) == 0 ) {
ses->state_machine->in_error = 0;
return;
}
void *session, const xmlChar *ch, int len) {
char data[len+1];
- strncpy( data, (char*) ch, len );
+ strncpy( data, (const char*) ch, len );
data[len] = 0;
//printf( "Handling characters: %s\n", data );
return 0;
}
-int set_proc_title( char* format, ... ) {
+int set_proc_title( const char* format, ... ) {
VA_LIST_TO_STRING(format);
osrf_clearbuf( *(global_argv), global_argv_size);
return snprintf( *(global_argv), global_argv_size, VA_BUF );
/* utility method for profiling */
-double get_timestamp_millis() {
+double get_timestamp_millis( void ) {
struct timeval tv;
gettimeofday(&tv, NULL);
double time = (int)tv.tv_sec + ( ((double)tv.tv_usec / 1000000) );
}
-int buffer_add(growing_buffer* gb, char* data) {
+int buffer_add(growing_buffer* gb, const char* data) {
if(!(gb && data)) return 0;
int data_len = strlen( data );
return 1;
}
-char* buffer_data( growing_buffer *gb) {
+char* buffer_data( const growing_buffer *gb) {
return strdup( gb->buf );
}
// A function to turn a process into a daemon
-int daemonize() {
+int daemonize( void ) {
pid_t f = fork();
if (f == -1) {
/* Return 1 if the string represents an integer, */
/* as recognized by strtol(); Otherwise return 0. */
-int stringisnum(char* s) {
+int stringisnum(const char* s) {
char* w;
strtol(s, &w, 10);
return *w ? 0 : 1;
}
-char* md5sum( char* text, ... ) {
+char* md5sum( const char* text, ... ) {
struct md5_ctx ctx;
unsigned char digest[16];
#define ROUTER_REQUEST_STATS_CLASS_SUMMARY "opensrf.router.info.stats.class.summary"
osrfRouter* osrfNewRouter(
- char* domain, char* name,
- char* resource, char* password, int port,
+ const char* domain, const char* name,
+ const char* resource, const char* password, int port,
osrfStringArray* trustedClients, osrfStringArray* trustedServers ) {
if(!( domain && name && resource && password && port && trustedClients && trustedServers )) return NULL;
}
}
-int osrfRouterClassHandleIncoming( osrfRouter* router, char* classname, osrfRouterClass* class ) {
+int osrfRouterClassHandleIncoming( osrfRouter* router, const char* classname,
+ osrfRouterClass* class ) {
if(!(router && class)) return -1;
transport_message* msg;
-osrfRouterClass* osrfRouterAddClass( osrfRouter* router, char* classname ) {
+osrfRouterClass* osrfRouterAddClass( osrfRouter* router, const char* classname ) {
if(!(router && router->classes && classname)) return NULL;
osrfRouterClass* class = safe_malloc(sizeof(osrfRouterClass));
class->connection = client_init( router->domain, router->port, NULL, 0 );
- if(!client_connect( class->connection, router->name,
+ if(!client_connect( class->connection, router->name,
router->password, classname, 10, AUTH_DIGEST ) ) {
- osrfRouterClassFree( classname, class );
+ // We cast away the constness of classname. Though ugly, this
+ // cast is benign because osrfRouterClassFree doesn't actually
+ // write through the pointer. We can't readily change its
+ // signature because it is used for a function pointer, and
+ // we would have to change other signatures the same way.
+ osrfRouterClassFree( (char *) classname, class );
return NULL;
}
}
-int osrfRouterClassAddNode( osrfRouterClass* rclass, char* remoteId ) {
+int osrfRouterClassAddNode( osrfRouterClass* rclass, const char* remoteId ) {
if(!(rclass && rclass->nodes && remoteId)) return -1;
osrfLogInfo( OSRF_LOG_MARK, "Adding router node for remote id %s", remoteId );
? return NULL if it's the last node ?
*/
-transport_message* osrfRouterClassHandleBounce(
- osrfRouter* router, char* classname, osrfRouterClass* rclass, transport_message* msg ) {
+transport_message* osrfRouterClassHandleBounce( osrfRouter* router,
+ const char* classname, osrfRouterClass* rclass, transport_message* msg ) {
osrfLogDebug( OSRF_LOG_MARK, "osrfRouterClassHandleBounce()");
}
-int osrfRouterRemoveClass( osrfRouter* router, char* classname ) {
+int osrfRouterRemoveClass( osrfRouter* router, const char* classname ) {
if(!(router && router->classes && classname)) return -1;
osrfLogInfo( OSRF_LOG_MARK, "Removing router class %s", classname );
osrfHashRemove( router->classes, classname );
int osrfRouterClassRemoveNode(
- osrfRouter* router, char* classname, char* remoteId ) {
+ osrfRouter* router, const char* classname, const char* remoteId ) {
if(!(router && router->classes && classname && remoteId)) return 0;
-osrfRouterClass* osrfRouterFindClass( osrfRouter* router, char* classname ) {
+osrfRouterClass* osrfRouterFindClass( osrfRouter* router, const char* classname ) {
if(!( router && router->classes && classname )) return NULL;
return (osrfRouterClass*) osrfHashGet( router->classes, classname );
}
-osrfRouterNode* osrfRouterClassFindNode( osrfRouterClass* rclass, char* remoteId ) {
+osrfRouterNode* osrfRouterClassFindNode( osrfRouterClass* rclass, const char* remoteId ) {
if(!(rclass && remoteId)) return NULL;
return (osrfRouterNode*) osrfHashGet( rclass->nodes, remoteId );
}
int osrfRouterHandleAppResponse( osrfRouter* router,
- transport_message* msg, osrfMessage* omsg, jsonObject* response ) {
+ transport_message* msg, osrfMessage* omsg, const jsonObject* response ) {
if( response ) { /* send the response message */
@param trustedServers The array of server domains that we allow to register, etc. with ust.
@return The allocated router or NULL on memory error
*/
-osrfRouter* osrfNewRouter( char* domain, char* name, char* resource,
- char* password, int port, osrfStringArray* trustedClients, osrfStringArray* trustedServers );
+osrfRouter* osrfNewRouter( const char* domain, const char* name, const char* resource,
+ const char* password, int port, osrfStringArray* trustedClients,
+ osrfStringArray* trustedServers );
/**
Connects the given router to the network
@param classname The name of the class this node handles.
@return 0 on success, -1 on connection error.
*/
-osrfRouterClass* osrfRouterAddClass( osrfRouter* router, char* classname );
+osrfRouterClass* osrfRouterAddClass( osrfRouter* router, const char* classname );
/**
Adds a new server node to the given class.
@param remoteId The remote login of this node
@return 0 on success, -1 on generic error
*/
-int osrfRouterClassAddNode( osrfRouterClass* rclass, char* remoteId );
+int osrfRouterClassAddNode( osrfRouterClass* rclass, const char* remoteId );
/**
/**
Removes a given class from the router, freeing as it goes
*/
-int osrfRouterRemoveClass( osrfRouter* router, char* classname );
+int osrfRouterRemoveClass( osrfRouter* router, const char* classname );
/**
Removes the given node from the class. Also, if this is that last node in the set,
@return 1 on successful remove with class removal
@return -1 error on removal
*/
-int osrfRouterClassRemoveNode( osrfRouter* router, char* classname, char* remoteId );
+int osrfRouterClassRemoveNode( osrfRouter* router, const char* classname,
+ const char* remoteId );
/**
Frees a router class object
/**
Finds the class associated with the given class name in the list of classes
*/
-osrfRouterClass* osrfRouterFindClass( osrfRouter* router, char* classname );
+osrfRouterClass* osrfRouterFindClass( osrfRouter* router, const char* classname );
/**
Finds the router node within this class with the given remote id
*/
-osrfRouterNode* osrfRouterClassFindNode( osrfRouterClass* rclass, char* remoteId );
+osrfRouterNode* osrfRouterClassFindNode( osrfRouterClass* rclass, const char* remoteId );
/**
Utility method for handling incoming requests to a router class,
makes sure sender is a trusted client
*/
-int osrfRouterClassHandleIncoming( osrfRouter* router, char* classname, osrfRouterClass* class );
+int osrfRouterClassHandleIncoming( osrfRouter* router,
+ const char* classname, osrfRouterClass* class );
/* handles case where router node is not longer reachable. copies over the
data from the last sent message and returns a newly crafted suitable for treating
as a newly inconing message. Removes the dead node and If there are no more
nodes to send the new message to, returns NULL.
*/
-transport_message* osrfRouterClassHandleBounce(
- osrfRouter* router, char* classname, osrfRouterClass* rclass, transport_message* msg );
+transport_message* osrfRouterClassHandleBounce( osrfRouter* router,
+ const char* classname, osrfRouterClass* rclass, transport_message* msg );
int osrfRouterProcessAppRequest( osrfRouter* router, transport_message* msg, osrfMessage* omsg );
int osrfRouterHandleAppResponse( osrfRouter* router,
- transport_message* msg, osrfMessage* omsg, jsonObject* response );
+ transport_message* msg, osrfMessage* omsg, const jsonObject* response );
int osrfRouterHandleMethodNFound( osrfRouter* router, transport_message* msg, osrfMessage* omsg );