axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Samisa Abeysinghe <samisa.abeysin...@gmail.com>
Subject Re: [Axis2] patch - callback client
Date Fri, 07 Apr 2006 01:09:11 GMT
Hey Nabeeel,  thanks for the patch.
Have you got any sample/test written to test the interface introduced by 
the patch? if so please send in that as well.

Thanks,
Samisa...

Nabeel wrote:

> This patch provides some methods to access callback specific data and 
> to set callback functions.
> Please review and apply.
>
> Thanks
> -Nabeel
>
>------------------------------------------------------------------------
>
>Index: callback.c
>===================================================================
>--- callback.c	(revision 391888)
>+++ callback.c	(working copy)
>@@ -28,6 +28,8 @@
>     axis2_soap_envelope_t *envelope;
>     /** error code */
>     int error;
>+	/** to store callback specific data */
>+	void *data;
> } axis2_callback_impl_t;
> 
> /** Interface to implementation conversion macro */
>@@ -82,8 +84,21 @@
> axis2_callback_free (struct axis2_callback *callback, 
>                      axis2_env_t **env);
> 
>+void AXIS2_CALL
>+axis2_callback_set_on_complete(struct axis2_callback *callback,
>+								on_complete_func_ptr f);
> 
>+void  AXIS2_CALL
>+axis2_callback_set_on_error(struct axis2_callback *callback,
>+							on_error_func_ptr f);
>+		
>+axis2_status_t AXIS2_CALL
>+axis2_callback_set_data(struct axis2_callback *callback,
>+						void *data);
> 
>+void* AXIS2_CALL
>+axis2_callback_get_data(struct axis2_callback *callback);
>+
> axis2_callback_t* AXIS2_CALL 
> axis2_callback_create(axis2_env_t **env)
> {
>@@ -102,6 +117,7 @@
>     callback_impl->complete = AXIS2_FALSE;
>     callback_impl->envelope = NULL;
>     callback_impl->error = AXIS2_ERROR_NONE;
>+	callback_impl->data = NULL;
>     
>     /* initialize ops */    
>     callback_impl->callback.ops  = 
>@@ -143,7 +159,13 @@
>         
>     callback_impl->callback.ops->set_error = 
>         axis2_callback_set_error;
>-        
>+
>+	callback_impl->callback.ops->set_data =
>+		axis2_callback_set_data;
>+
>+	callback_impl->callback.ops->get_data =
>+		axis2_callback_get_data;
>+
>     callback_impl->callback.ops->free = 
>         axis2_callback_free;
> 
>@@ -245,6 +267,43 @@
>     return AXIS2_SUCCESS;
> }
> 
>+axis2_status_t AXIS2_CALL
>+axis2_callback_set_data(struct axis2_callback *callback,
>+							void *data)
>+{
>+	axis2_callback_impl_t *callback_impl = NULL;
>+	
>+	callback_impl = AXIS2_INTF_TO_IMPL(callback);
>+
>+	callback_impl->data = (void*)data;
>+
>+	return AXIS2_SUCCESS;
>+}
>+
>+void * AXIS2_CALL
>+axis2_callback_get_data(struct axis2_callback *callback)
>+{
>+	axis2_callback_impl_t *callback_impl = NULL;
>+
>+	callback_impl = AXIS2_INTF_TO_IMPL(callback);
>+
>+	return callback_impl->data;
>+}
>+
>+void AXIS2_CALL
>+axis2_callback_set_on_complete(struct axis2_callback *callback,
>+								on_complete_func_ptr func)
>+{
>+	callback->ops->on_complete = func;
>+}
>+
>+void AXIS2_CALL
>+axis2_callback_set_on_error(struct axis2_callback *callback,
>+							on_error_func_ptr func)
>+{
>+	callback->ops->on_error = func;
>+}
>+
> axis2_status_t AXIS2_CALL 
> axis2_callback_on_complete(struct axis2_callback *callback, 
>                                   axis2_env_t **env)
>Index: ../../../include/axis2_callback.h
>===================================================================
>--- ../../../include/axis2_callback.h	(revision 391888)
>+++ ../../../include/axis2_callback.h	(working copy)
>@@ -41,6 +41,11 @@
> typedef struct axis2_callback_ops axis2_callback_ops_t;
> typedef struct axis2_callback axis2_callback_t; 
> 
>+typedef axis2_status_t(*on_complete_func_ptr)
>+	(struct axis2_callback *, axis2_env_t **);
>+
>+typedef axis2_status_t(*on_error_func_ptr)(struct axis2_callback *,
>+	axis2_env_t **, int);
>     
> /** 
>  * @brief Message Context ops struct
>@@ -133,7 +138,21 @@
>                axis2_env_t **env, 
>                int error);
> 	
>-	
>+	axis2_status_t (AXIS2_CALL *
>+	set_data)(struct axis2_callback *callback,
>+			void *data);
>+
>+	void * (AXIS2_CALL *
>+	get_data)(struct axis2_callback *callback);
>+
>+	void (AXIS2_CALL *
>+	set_on_complete)(struct axis2_callback *callback,
>+		on_complete_func_ptr f);
>+
>+	void (AXIS2_CALL *
>+	set_on_error)(struct axis2_callback *callback,
>+		on_error_func_ptr f);
>+
>     axis2_status_t (AXIS2_CALL *
> 	free)(struct axis2_callback *callback, 
>           axis2_env_t **env);
>@@ -181,7 +200,19 @@
> 		
> #define AXIS2_CALLBACK_SET_ERROR(callback, env, error) \
> 		((callback)->ops->set_error(callback, env, error))
>-		
>+
>+#define AXIS2_CALLBACK_GET_DATA(callback) \
>+		((callback)->ops->get_data(callback))
>+
>+#define AXIS2_CALLBACK_SET_DATA(callback, data) \
>+		((callback)->ops->set_data(callback, data))
>+/*
>+#define AXIS2_CALLBACK_SET_ON_COMPLETE(callback, func) \
>+		((callback)->ops->set_on_complete(callback, func))
>+
>+#define AXIS2_CALLBACK_SET_ON_ERROR(callback, func) \
>+		((callback)->ops->set_on_error(callback, func))
>+*/
> #define AXIS2_CALLBACK_FREE(callback, env) \
> 		((callback)->ops->free (callback, env))
> 
>  
>


Mime
View raw message