Asterisk - The Open Source Telephony Project  18.5.0
Data Structures | Functions
pbx_ignorepat.c File Reference

Dialplan context ignorepat routines. More...

#include "asterisk.h"
#include "asterisk/_private.h"
#include "asterisk/pbx.h"
#include "pbx_private.h"
Include dependency graph for pbx_ignorepat.c:

Go to the source code of this file.

Data Structures

struct  ast_ignorepat
 ast_ignorepat: Ignore patterns in dial plan More...
 

Functions

const char * ast_get_ignorepat_name (const struct ast_ignorepat *ip)
 
const char * ast_get_ignorepat_registrar (const struct ast_ignorepat *ip)
 
struct ast_ignorepatignorepat_alloc (const char *value, const char *registrar)
 
void ignorepat_free (struct ast_ignorepat *ip)
 

Detailed Description

Dialplan context ignorepat routines.

Author
Corey Farrell git@c.nosp@m.fwar.nosp@m.e.com

Definition in file pbx_ignorepat.c.

Function Documentation

◆ ast_get_ignorepat_name()

const char* ast_get_ignorepat_name ( const struct ast_ignorepat ip)

◆ ast_get_ignorepat_registrar()

const char* ast_get_ignorepat_registrar ( const struct ast_ignorepat ip)

◆ ignorepat_alloc()

struct ast_ignorepat* ignorepat_alloc ( const char *  value,
const char *  registrar 
)

Definition at line 52 of file pbx_ignorepat.c.

References ast_calloc, NULL, ast_ignorepat::pattern, and ast_ignorepat::registrar.

Referenced by ast_context_add_ignorepat2().

53 {
54  struct ast_ignorepat *ignorepat;
55  int length = strlen(value) + 1;
56  char *pattern;
57 
58  /* allocate new include structure ... */
59  ignorepat = ast_calloc(1, sizeof(*ignorepat) + length);
60  if (!ignorepat) {
61  return NULL;
62  }
63 
64  /* The cast to char * is because we need to write the initial value.
65  * The field is not supposed to be modified otherwise. Also, gcc 4.2
66  * sees the cast as dereferencing a type-punned pointer and warns about
67  * it. This is the workaround (we're telling gcc, yes, that's really
68  * what we wanted to do).
69  */
70  pattern = (char *) ignorepat->pattern;
71  strcpy(pattern, value);
72  ignorepat->registrar = registrar;
73 
74  return ignorepat;
75 }
const char pattern[0]
Definition: pbx_ignorepat.c:39
#define NULL
Definition: resample.c:96
int value
Definition: syslog.c:37
const char * registrar
Definition: pbx_ignorepat.c:38
ast_ignorepat: Ignore patterns in dial plan
Definition: pbx_ignorepat.c:37
static char * registrar
Definition: pbx_ael.c:78
#define ast_calloc(num, len)
A wrapper for calloc()
Definition: astmm.h:204

◆ ignorepat_free()

void ignorepat_free ( struct ast_ignorepat ip)

Definition at line 77 of file pbx_ignorepat.c.

References ast_free.

Referenced by __ast_context_destroy(), __ast_internal_context_destroy(), ast_context_add_ignorepat2(), and ast_context_remove_ignorepat2().

78 {
79  ast_free(ip);
80 }
#define ast_free(a)
Definition: astmm.h:182