config_domain_aliases.c File Reference

#include "asterisk.h"
#include "pjsip.h"
#include "pjlib.h"
#include "asterisk/res_pjsip.h"
#include "include/res_pjsip_private.h"
#include "asterisk/logger.h"
#include "asterisk/sorcery.h"

Include dependency graph for config_domain_aliases.c:

Go to the source code of this file.

Functions

int ast_sip_initialize_sorcery_domain_alias (void)
 Initialize sorcery with domain alias support.
static void * domain_alias_alloc (const char *name)
static void domain_alias_destroy (void *obj)


Function Documentation

int ast_sip_initialize_sorcery_domain_alias ( void   ) 

Initialize sorcery with domain alias support.

Definition at line 52 of file config_domain_aliases.c.

References ast_sip_get_sorcery(), ast_sorcery_apply_default, ast_sorcery_object_field_register, ast_sorcery_object_register, domain_alias_alloc(), NULL, OPT_NOOP_T, OPT_STRINGFIELD_T, SIP_SORCERY_DOMAIN_ALIAS_TYPE, sorcery, and STRFLDSET.

Referenced by ast_res_pjsip_initialize_configuration().

00053 {
00054    struct ast_sorcery *sorcery = ast_sip_get_sorcery();
00055 
00056    ast_sorcery_apply_default(sorcery, SIP_SORCERY_DOMAIN_ALIAS_TYPE, "config", "pjsip.conf,criteria=type=domain_alias");
00057 
00058    if (ast_sorcery_object_register(sorcery, SIP_SORCERY_DOMAIN_ALIAS_TYPE, domain_alias_alloc, NULL, NULL)) {
00059       return -1;
00060    }
00061 
00062    ast_sorcery_object_field_register(sorcery, SIP_SORCERY_DOMAIN_ALIAS_TYPE, "type", "",
00063          OPT_NOOP_T, 0, 0);
00064    ast_sorcery_object_field_register(sorcery, SIP_SORCERY_DOMAIN_ALIAS_TYPE, "domain",
00065          "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_domain_alias, domain));
00066 
00067    return 0;
00068 }

static void* domain_alias_alloc ( const char *  name  )  [static]

Definition at line 35 of file config_domain_aliases.c.

References ao2_cleanup, ast_sorcery_generic_alloc(), ast_string_field_init, domain_alias_destroy(), and NULL.

Referenced by ast_sip_initialize_sorcery_domain_alias().

00036 {
00037         struct ast_sip_domain_alias *alias = ast_sorcery_generic_alloc(sizeof(*alias), domain_alias_destroy);
00038 
00039    if (!alias) {
00040       return NULL;
00041    }
00042 
00043    if (ast_string_field_init(alias, 256)) {
00044       ao2_cleanup(alias);
00045       return NULL;
00046    }
00047 
00048    return alias;
00049 }

static void domain_alias_destroy ( void *  obj  )  [static]

Definition at line 28 of file config_domain_aliases.c.

References ast_string_field_free_memory.

Referenced by domain_alias_alloc().

00029 {
00030    struct ast_sip_domain_alias *alias = obj;
00031 
00032    ast_string_field_free_memory(alias);
00033 }


Generated on Thu Apr 16 06:30:26 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6