# Savan_core

## Files
file | savan_sub_processor.h
## Typedefs
typedef struct savan_sub_processor | savan_sub_processor_t
## Functions
axis2_status_t | savan_sub_processor_subscribe (savan_sub_processor_t *sub_processor, const axutil_env_t *env, axis2_msg_ctx_t *msg_ctx)
axis2_status_t | savan_sub_processor_unsubscribe (savan_sub_processor_t *sub_processor, const axutil_env_t *env, axis2_msg_ctx_t *msg_ctx)
axis2_status_t | savan_sub_processor_renew_subscription (savan_sub_processor_t *sub_processor, const axutil_env_t *env, axis2_msg_ctx_t *msg_ctx)
axis2_status_t | savan_sub_processor_get_status (savan_sub_processor_t *sub_processor, const axutil_env_t *env, axis2_msg_ctx_t *msg_ctx)
AXIS2_EXTERN savan_sub_processor_t * | savan_sub_processor_create (const axutil_env_t *env, struct savan_subs_mgr *subs_mgr)
AXIS2_EXTERN void | savan_sub_processor_free (savan_sub_processor_t *sub_processor, const axutil_env_t *env)
AXIS2_EXTERN savan_subscriber_t * | savan_sub_processor_get_subscriber_from_msg (const axutil_env_t *env, axis2_msg_ctx_t *msg_ctx, struct savan_subs_mgr *subs_mgr, const axis2_char_t *sub_id)
AXIS2_EXTERN savan_subscriber_t * | savan_sub_processor_get_subscriber_from_renew_msg (const axutil_env_t *env, axis2_msg_ctx_t *msg_ctx, struct savan_subs_mgr *subs_mgr, const axis2_char_t *sub_id)
AXIS2_EXTERN axis2_status_t | savan_sub_processor_add_subscriber (const axutil_env_t *env, axis2_msg_ctx_t *msg_ctx, struct savan_subs_mgr *subs_mgr, savan_subscriber_t *subscriber)
AXIS2_EXTERN axis2_status_t | savan_sub_processor_update_subscriber (const axutil_env_t *env, axis2_msg_ctx_t *msg_ctx, struct savan_subs_mgr *subs_mgr, savan_subscriber_t *subscriber)
AXIS2_EXTERN axis2_status_t | savan_sub_processor_remove_subscriber (const axutil_env_t *env, axis2_msg_ctx_t *msg_ctx, struct savan_subs_mgr *subs_mgr, savan_subscriber_t *subscriber)

## Detailed Description

subcription processor is responsible for processing incoming eventing message headers and is invoked from the savan_in_handler. This will create 'subcription' objects

## Function Documentation

AXIS2_EXTERN savan_sub_processor_t* savan_sub_processor_create | ( | const axutil_env_t * | env,
|  | struct savan_subs_mgr * | subs_mgr |
| ) |  |  |

Creates a subcription processor instance.

Parameters:

  | env | pointer to environment struct

Returns:
  pointer to newly created subcription processor struct

AXIS2_EXTERN void savan_sub_processor_free | ( | savan_sub_processor_t * | sub_processor,
|  | const axutil_env_t * | env |
| ) |  |  |

Freesf a subscription manager instance.

Parameters:

  | env | pointer to the environment struct
  | sub_processor | pointer to the sub_processor struct

axis2_status_t savan_sub_processor_get_status | ( | savan_sub_processor_t * | sub_processor,
|  | const axutil_env_t * | env,
|  | axis2_msg_ctx_t * | msg_ctx |
| ) |  |  |

This method returns the status of a given subscription.

Parameters:

  | sub_processor | pointer to subcription processor
  | env | pointer to environment struct
  | msg_ctx | pointer to message context representing current state that is used when receiving message

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

axis2_status_t savan_sub_processor_renew_subscription | ( | savan_sub_processor_t * | sub_processor,
|  | const axutil_env_t * | env,
|  | axis2_msg_ctx_t * | msg_ctx |
| ) |  |  |

This method finds the subcriptin id from the incoming message and renews that subscription.

Parameters:

  | sub_processor | pointer to subcription processor
  | env | pointer to environment struct
  | msg_ctx | pointer to message context representing current state that is used when receiving message

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

axis2_status_t savan_sub_processor_subscribe | ( | savan_sub_processor_t * | sub_processor,
|  | const axutil_env_t * | env,
|  | axis2_msg_ctx_t * | msg_ctx |
| ) |  |  |

This method creates a subcription object from the incoming message and adds it to the internal list.

Parameters:

  | sub_processor | pointer to subcription processor
  | env | pointer to environment struct
  | msg_ctx | pointer to message context representing current state that is used when receiving message

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

axis2_status_t savan_sub_processor_unsubscribe | ( | savan_sub_processor_t * | sub_processor,
|  | const axutil_env_t * | env,
|  | axis2_msg_ctx_t * | msg_ctx |
| ) |  |  |

This method finds the subcription id from the incoming message and removes that suscriber from the internal list.

Parameters:

  | sub_processor | pointer to subcription processor
  | env | pointer to environment struct
  | msg_ctx | pointer to message context representing current state that is used when receiving message

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE