SIP Witch 1.9.15
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
events.h
Go to the documentation of this file.
1 // Copyright (C) 2006-2014 David Sugar, Tycho Softworks.
2 // Copyright (C) 2015 Cherokees of Idaho.
3 //
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
26 #ifndef _SIPWITCH_EVENTS_H_
27 #define _SIPWITCH_EVENTS_H_
28 
29 #ifndef _UCOMMON_LINKED_H_
30 #include <ucommon/linked.h>
31 #endif
32 
33 #ifndef _UCOMMON_THREAD_H_
34 #include <ucommon/thread.h>
35 #endif
36 
37 #ifndef _UCOMMON_STRING_H_
38 #include <ucommon/string.h>
39 #endif
40 
41 #ifndef _UCOMMON_SOCKET_H_
42 #include <ucommon/socket.h>
43 #endif
44 
45 #ifndef __SIPWITCH_NAMESPACE_H_
46 #include <sipwitch/namespace.h>
47 #endif
48 
49 #ifndef __SIPWITCH_MAPPED_H_
50 #include <sipwitch/mapped.h>
51 #endif
52 
53 #ifndef __SIPWITCH_CDR_H_
54 #include <sipwitch/cdr.h>
55 #endif
56 
57 namespace sipwitch {
58 
66 class __EXPORT events
67 {
68 protected:
74  bool put(events *event);
75 
76 public:
77  typedef enum {NOTICE, WARNING, FAILURE, TERMINATE, STATE, REALM, CALL, DROP, ACTIVATE, RELEASE, WELCOME, SYNC, CONTACT, PUBLISH} type_t;
78 
83 
87  union {
88  struct {
89  time_t started;
90  char reason[16];
91  char network[MAX_NETWORK_SIZE * 2];
92  char dialed[MAX_USERID_SIZE];
93  char caller[MAX_IDENT_SIZE];
94  char display[MAX_DISPLAY_SIZE];
95  } call;
96  struct {
97  unsigned extension;
98  char id[MAX_USERID_SIZE];
99  } user;
100  struct {
101  time_t started;
102  char version[16];
103  char state[32];
104  char realm[64];
105  } server;
106  char contact[160];
107  char reason[160];
108  unsigned period;
109  } msg;
110 
115  static bool start(void);
116 
121  static void state(const char *newstate);
122 
127  static void realm(const char *newrealm);
128 
133  static void connect(cdr *rec);
134 
139  static void drop(cdr *rec);
140 
146  static void activate(MappedRegistry *user);
147 
153  static void release(MappedRegistry *user);
154 
161  static void notice(const char *reason);
162 
169  static void warning(const char *reason);
170 
177  static void failure(const char *reason);
178 
182  static void reload(void);
183 
188  static void publish(const char *address);
189 
194  static void terminate(const char *reason);
195 
201  static void sync(unsigned period = 0l);
202 };
203 
204 typedef events event_t;
205 
206 } // namespace sipwitch
207 
208 #endif
#define WARNING
Definition: osip_const.h:86
unsigned period
Definition: events.h:108
Event message and supporting methods for plugins.
Definition: events.h:66
Representation of a mapped active user record.
Definition: mapped.h:95
#define CONTACT
Definition: osip_const.h:44
events event_t
Definition: events.h:204
Definitions for memory mapped objects that may be shared between processes.
Basic server call detail record.
GNU SIP Witch library namespace.
time_t started
Definition: events.h:89
#define MAX_IDENT_SIZE
Definition: mapped.h:70
type_t type
Type of event message.
Definition: events.h:82
#define MAX_USERID_SIZE
Definition: mapped.h:69
Interface class for call detail records.
Definition: cdr.h:56
unsigned extension
Definition: events.h:97
#define MAX_DISPLAY_SIZE
Definition: mapped.h:68
#define MAX_NETWORK_SIZE
Definition: mapped.h:66
type_t
Enumeration for event type.
Definition: osip.h:111