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_URI_H_
27 #define _SIPWITCH_URI_H_
28
29 #ifndef _UCOMMON_STRING_H_
30 #include <ucommon/string.h>
31 #endif
32
33 #ifndef _UCOMMON_PLATFORM_H_
34 #include <ucommon/platform.h>
35 #endif
36
37 #ifndef _UCOMMON_SOCKET_H_
38 #include <ucommon/socket.h>
39 #endif
40
41 #ifndef __SIPWITCH_NAMESPACE_H_
43 #endif
44
45 #ifndef __SIPWITCH_VOIP_H_
47 #endif
48
49 namespace sipwitch {
50
56 {
57 public:
59 static void serviceid(const char *sipuri, char *buffer, size_t size);
60 static bool server(
struct sockaddr *address,
char *buffer,
size_t size);
61 static bool userid(const char *sipuri, char *buffer, size_t size);
62 static bool hostid(const char *sipuri, char *buffer, size_t size);
63 static unsigned short portid(const char *sipuri);
64 static void identity(const struct sockaddr *address, char *buffer, const char *user, size_t size);
65 static void publish(const char *uri, char *buffer, const char *user, size_t size);
67 };
68
69 class __EXPORT
srv :
protected Socket::address
70 {
71 public:
73 {
74 public:
75 struct sockaddr_storage addr;
77 };
78
79 protected:
84
85 public:
89
90 void set(
const char *
uri);
91
92 void clear(void);
93
95 {return entry;}
96
97 inline operator bool()
const
98 {return entry != NULL;}
99
101 {return entry == NULL;}
102
103 struct sockaddr *next(void);
104
105 uint16_t after(uint16_t priority = 0);
106
107 uint32_t total(uint16_t priority);
108
109 struct sockaddr *find(uint16_t priority, uint32_t weight);
110
112
113 };
114
115 } // namespace sipwitch
116
117 #endif
Some convenience methods for manipulating SIP uri's.
GNU SIP Witch library namespace.
struct sockaddr * operator*() const