SIP Witch 1.9.15: uri.h Source File

SIP Witch 1.9.15
uri.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_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_
42 #include <sipwitch/namespace.h>
43 #endif
44 
45 #ifndef __SIPWITCH_VOIP_H_
46 #include <sipwitch/voip.h>
47 #endif
48 
49 namespace sipwitch {
50 
55  class __EXPORT uri
56 {
57 public:
58  static voip::context_t route(const char *uri, char *buf, size_t size);
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);
66  static voip::context_t context(const char *uri);
67 };
68 
69  class __EXPORT srv : protected Socket::address
70 {
71 public:
72   class address
73  {
74  public:
75   struct sockaddr_storage addr;
76   uint16_t weight, priority;
77  };
78 
79 protected:
80   address *srvlist;
81   struct sockaddr *entry;
82   uint16_t pri;
83   unsigned count;
84 
85 public:
86  srv(const char *uri);
87  srv();
88  ~srv();
89 
90  void set(const char *uri);
91 
92  void clear(void);
93 
94   inline struct sockaddr *operator*() const
95 {return entry;}
96 
97   inline operator bool() const
98 {return entry != NULL;}
99 
100   inline bool operator!() const
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 
111  voip::context_t route(const char *uri, char *buf, size_t size);
112 
113 };
114 
115 } // namespace sipwitch
116 
117 #endif
sipwitch::uri
Some convenience methods for manipulating SIP uri's.
Definition: uri.h:55
sipwitch::srv::entry
struct sockaddr * entry
Definition: uri.h:81
sipwitch::srv::pri
uint16_t pri
Definition: uri.h:82
sipwitch::srv::operator!
bool operator!() const
Definition: uri.h:100
namespace.h
GNU SIP Witch library namespace.
sipwitch::srv::srvlist
address * srvlist
Definition: uri.h:80
sipwitch::srv::operator*
struct sockaddr * operator*() const
Definition: uri.h:94
sipwitch::srv::count
unsigned count
Definition: uri.h:83
sipwitch::srv::address::weight
uint16_t weight
Definition: uri.h:76
sipwitch::voip::context_t
void * context_t
Definition: voip.h:53
sipwitch::srv
Definition: uri.h:69

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 によって変換されたページ (->オリジナル) /