SIP Witch 1.9.15: mapped.h Source File

SIP Witch 1.9.15
mapped.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 
24 #ifndef _SIPWITCH_MAPPED_H_
25 #define _SIPWITCH_MAPPED_H_
26 
27 #ifndef _SIPWITCH_NAMESPACE_H_
28 #include <sipwitch/namespace.h>
29 #endif
30 
31 #ifndef _SIPWITCH_VOIP_H_
32 #include <sipwitch/voip.h>
33 #endif
34 
35 #ifndef _SIPWITCH_STATS_H_
36 #include <sipwitch/stats.h>
37 #endif
38 
47 // user and device properties...
48 
49  #define USER_PROFILE_DIALABLE 0x0001 // user may be dialed
50  #define USER_PROFILE_REACHABLE 0x0002 // user may be reached by gateway
51  #define USER_PROFILE_INTERNAL 0x0008 // user may use dialing/routing
52  #define USER_PROFILE_SUBSCRIPTIONS 0x0010 // user can subscribe to others
53  #define USER_PROFILE_SUBSCRIBERS 0x0020 // user can be subscribed
54  #define USER_PROFILE_INCOMING 0x1000 // user "name" id may be accessed
55  #define USER_PROFILE_OUTGOING 0x2000 // may use generic uri
56  #define USER_PROFILE_SUPERUSER 0x8000 // has admin flag
57 
58  #define USER_PROFILE_ADMIN 0xffff
59  #define USER_PROFILE_LOCAL 0x0fff
60  #define USER_PROFILE_DEVICE 0x0f0f
61  #define USER_PROFILE_SERVICE 0x7f0f
62  #define USER_PROFILE_SYSTEM 0x2f08
63  #define USER_PROFILE_DEFAULT 0x7fff
64  #define USER_PROFILE_RESTRICTED (0)
65 
66  #define MAX_NETWORK_SIZE 16 // based on cidr name size...
67  #define MAX_PATTERN_SIZE 16
68  #define MAX_DISPLAY_SIZE 64
69  #define MAX_USERID_SIZE 48
70  #define MAX_IDENT_SIZE (MAX_USERID_SIZE + 50)
71  #define MAX_URI_SIZE 256
72  #define MAX_SDP_BUFFER 1024
73 
74 namespace sipwitch {
75 
76  #define CALL_MAP "sipwitch.calls"
77  #define REGISTRY_MAP "sipwitch.regs"
78 
83  typedef struct {
84   char id[MAX_USERID_SIZE];
85   unsigned short features;
86   unsigned level;
87 } profile_t;
88 
95  class MappedRegistry : public LinkedObject
96 {
97 public:
98   typedef enum {OFFLINE = 0, IDLE, BUSY, AWAY, DND} status_t;
99 
100   char userid[MAX_USERID_SIZE];
101   char display[MAX_DISPLAY_SIZE];
102   char remote[MAX_USERID_SIZE];
103   char network[MAX_NETWORK_SIZE];
104   status_t status;
105   enum {EXPIRED = 0, USER, GATEWAY, SERVICE, REJECT, REFER, TEMPORARY, EXTERNAL} type;
106   bool hidden;
107   voip::reg_t rid; // registry remap or peer id
108   unsigned ext; // 0 or extnum
109   unsigned count; // active regs count
110   volatile unsigned inuse; // in use for call count
111   sockaddr_internet contact; // last/newest created contact registration
112   time_t created; // initial registration
113   volatile time_t expires; // when registry expires as a whole
114   profile_t profile; // profile at time of registration
115  union {
116  struct { // external registry properties...
117   const char *identity; // forced identity string when calling
118   const char *connect; // invite uri host identity
119   stats *statnode; // associated stat node...
120  } external;
121  struct { // internal registry properties
122   LinkedObject *published; // published routes
123   LinkedObject *targets; // active registrations (can be multiple)
124   LinkedObject *routes; // active route records
125  } internal;
126  } source;
127 
128   inline bool is_user(void) const
129 {return (type == USER);}
130 
131   inline bool is_profiled(void) const
132 {return (type == USER || type == SERVICE);}
133 
134   inline bool is_admin(void) const
135 {return (is_profiled() && (profile.features & USER_PROFILE_SUPERUSER));}
136 
137   inline bool has_feature(unsigned short X) const
138 {return is_profiled() && (profile.features & X);}
139 };
140 
147  class MappedCall : public LinkedObject
148 {
149 public:
150   time_t created;
151   time_t active;
152   char state[16];
153   char authorized[MAX_USERID_SIZE];
154   char source[MAX_IDENT_SIZE], target[MAX_IDENT_SIZE];
155   char display[MAX_DISPLAY_SIZE];
156   uint32_t sequence;
157   int cid;
158 };
159 
160 } // namespace sipwitch
161 
162 #endif
sipwitch::stats
A stat element of call traffic.
Definition: stats.h:57
sipwitch::MappedRegistry::rid
voip::reg_t rid
Definition: mapped.h:107
sipwitch::MappedCall::display
char display[64]
Definition: mapped.h:155
sipwitch::MappedRegistry::identity
const char * identity
Definition: mapped.h:117
USER_PROFILE_SUPERUSER
#define USER_PROFILE_SUPERUSER
Definition: mapped.h:56
sipwitch::profile_t
User profiles are used to map features and toll restriction level together under a common identifier...
Definition: mapped.h:83
sipwitch::MappedRegistry::is_user
bool is_user(void) const
Definition: mapped.h:128
sipwitch::profile_t::features
unsigned short features
Definition: mapped.h:85
sipwitch::MappedRegistry
Representation of a mapped active user record.
Definition: mapped.h:95
sipwitch::MappedRegistry::connect
const char * connect
Definition: mapped.h:118
sipwitch::MappedRegistry::contact
sockaddr_internet contact
Definition: mapped.h:111
sipwitch::MappedCall::sequence
uint32_t sequence
Definition: mapped.h:156
sipwitch::MappedRegistry::expires
volatile time_t expires
Definition: mapped.h:113
sipwitch::MappedRegistry::is_profiled
bool is_profiled(void) const
Definition: mapped.h:131
sipwitch::MappedRegistry::targets
LinkedObject * targets
Definition: mapped.h:123
sipwitch::MappedRegistry::source
union sipwitch::MappedRegistry::@6 source
sipwitch::MappedCall::state
char state[16]
Definition: mapped.h:152
stats.h
Basic server call statistics.
sipwitch::MappedCall::target
char target[(48+50)]
Definition: mapped.h:154
sipwitch::MappedCall::active
time_t active
Definition: mapped.h:151
sipwitch::MappedCall::authorized
char authorized[48]
Definition: mapped.h:153
sipwitch::MappedRegistry::has_feature
bool has_feature(unsigned short X) const
Definition: mapped.h:137
namespace.h
GNU SIP Witch library namespace.
MAX_IDENT_SIZE
#define MAX_IDENT_SIZE
Definition: mapped.h:70
sipwitch::MappedCall
Representation of an active call record.
Definition: mapped.h:147
MAX_USERID_SIZE
#define MAX_USERID_SIZE
Definition: mapped.h:69
sipwitch::MappedRegistry::is_admin
bool is_admin(void) const
Definition: mapped.h:134
sipwitch::MappedRegistry::published
LinkedObject * published
Definition: mapped.h:122
sipwitch::MappedRegistry::routes
LinkedObject * routes
Definition: mapped.h:124
sipwitch::MappedRegistry::external
struct sipwitch::MappedRegistry::@6::@7 external
sipwitch::profile_t::level
unsigned level
Definition: mapped.h:86
sipwitch::MappedRegistry::profile
profile_t profile
Definition: mapped.h:114
sipwitch::voip::reg_t
int reg_t
Definition: voip.h:59
sipwitch::MappedCall::source
char source[(48+50)]
Definition: mapped.h:154
sipwitch::MappedRegistry::network
char network[16]
Definition: mapped.h:103
sipwitch::MappedCall::created
time_t created
Definition: mapped.h:150
sipwitch::MappedRegistry::display
char display[64]
Definition: mapped.h:101
MAX_DISPLAY_SIZE
#define MAX_DISPLAY_SIZE
Definition: mapped.h:68
sipwitch::MappedRegistry::inuse
volatile unsigned inuse
Definition: mapped.h:110
MAX_NETWORK_SIZE
#define MAX_NETWORK_SIZE
Definition: mapped.h:66
sipwitch::MappedRegistry::type
enum sipwitch::MappedRegistry::@5 type

Generated on Dec 21, 2017 for sipwitch-1.9.15 (*.h and *.cpp), libosip2-5.0.0 (*.h) and libeXosip2-4.0.0 (*.h), by   doxygen 1.8.6

AltStyle によって変換されたページ (->オリジナル) /