Ignore:
Timestamp:
Dec 30, 2005 11:50:15 PM (18 years ago)
Author:
bennylp
Message:

Basic module, transport, and sending messages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsip/sip_module.h

    r65 r106  
    4242struct pjsip_module 
    4343{ 
     44    /** To allow chaining of modules in the endpoint. */ 
     45    PJ_DECL_LIST_MEMBER(struct pjsip_module); 
     46 
    4447    /** 
    4548     * Module name. 
     
    4851 
    4952    /** 
    50      * Flag to indicate the type of interfaces supported by the module. 
     53     * Module ID. 
    5154     */ 
    52     pj_uint32_t flag; 
     55    int id; 
    5356 
    5457    /** 
     
    5760     * initialized later. 
    5861     */ 
    59     pj_uint32_t priority; 
     62    int priority; 
    6063 
    6164    /** 
     
    6366     * the module itself. 
    6467     */ 
    65     void *mod_data; 
     68    void *user_data; 
    6669 
    6770    /** 
     
    7982     * 
    8083     * @param endpt     The endpoint instance. 
    81      * @param mod       The module. 
    82      * @param id        The unique module ID assigned to this module. 
    83      * 
    84      * @return          Module should return zero when initialization succeed. 
     84     * @return          Module should return PJ_SUCCESS to indicate success. 
    8585     */ 
    86     pj_status_t (*init_module)(pjsip_endpoint *endpt, 
    87                                struct pjsip_module *mod, pj_uint32_t id); 
     86    pj_status_t (*load)(pjsip_endpoint *endpt); 
    8887 
    8988    /** 
    9089     * Pointer to function to be called to start the module. 
    9190     * 
    92      * @param mod       The module. 
    93      * 
    9491     * @return          Module should return zero to indicate success. 
    9592     */ 
    96     pj_status_t (*start_module)(struct pjsip_module *mod); 
     93    pj_status_t (*start)(void); 
     94 
     95    /** 
     96     * Pointer to function to be called to deinitialize the module before 
     97     * it is unloaded. 
     98     * 
     99     * @return          Module should return PJ_SUCCESS to indicate success. 
     100     */ 
     101    pj_status_t (*stop)(void); 
    97102 
    98103    /** 
     
    102107     * @param mod       The module. 
    103108     * 
    104      * @return          Module should return zero to indicate success. 
     109     * @return          Module should return PJ_SUCCESS to indicate success. 
    105110     */ 
    106     pj_status_t (*deinit_module)(struct pjsip_module *mod); 
     111    pj_status_t (*unload)(void); 
    107112 
    108113    /** 
    109      * Pointer to function to receive transaction related events. 
    110      * If the module doesn't wish to receive such notification, this member 
    111      * must be set to NULL. 
     114     * Called to process incoming request. 
    112115     * 
    113      * @param mod       The module. 
    114      * @param event     The transaction event. 
     116     * @param rdata     The incoming message. 
     117     * 
     118     * @return          Module should return PJ_TRUE if it handles the request, 
     119     *                  or otherwise it should return PJ_FALSE to allow other 
     120     *                  modules to handle the request. 
    115121     */ 
    116     void (*tsx_handler)(struct pjsip_module *mod, pjsip_event *event); 
     122    pj_bool_t (*on_rx_request)(pjsip_rx_data *rdata); 
     123 
     124    /** 
     125     * Called to processed incoming response. 
     126     * 
     127     * @param rdata     The incoming message. 
     128     * 
     129     * @return          Module should return PJ_TRUE if it handles the  
     130     *                  response, or otherwise it should return PJ_FALSE to  
     131     *                  allow other modules to handle the response. 
     132     */ 
     133    pj_bool_t (*on_rx_response)(pjsip_rx_data *rdata); 
     134 
     135    /** 
     136     * Called when this module is acting as transaction user for the specified 
     137     * transaction, when the transaction's state has changed. 
     138     * 
     139     * @param tsx       The transaction. 
     140     * @param event     The event which has caused the transaction state 
     141     *                  to change. 
     142     */ 
     143    void (*on_tsx_state)(pjsip_transaction *tsx, pjsip_event *event); 
     144 
    117145}; 
    118146 
    119147 
    120148/** 
    121  * Prototype of function to register static modules (eg modules that are 
    122  * linked staticly with the application). This function must be implemented  
    123  * by any applications that use PJSIP library. 
    124  * 
    125  * @param count     [input/output] On input, it contains the maximum number of 
    126  *                  elements in the array. On output, the function fills with  
    127  *                  the number of modules to be registered. 
    128  * @param modules   [output] array of pointer to modules to be registered. 
     149 * Module priority guidelines. 
    129150 */ 
    130 pj_status_t register_static_modules( pj_size_t *count, 
    131                                      pjsip_module **modules ); 
     151enum pjsip_module_priority 
     152{ 
     153    PJSIP_MOD_PRIORITY_TSX_LAYER = 4, 
     154    PJSIP_MOD_PRIORITY_UA_PROXY_LAYER = 16, 
     155    PJSIP_MOD_PRIORITY_APPLICATION = 32, 
     156}; 
     157 
    132158 
    133159/** 
Note: See TracChangeset for help on using the changeset viewer.