reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
FlowManagerSipXSocket.hxx
Go to the documentation of this file.
1
2#ifndef _FlowManagerSipXSocket_hxx_
3#define _FlowManagerSipXSocket_hxx_
4
5#if (_MSC_VER >= 1600)
6#include <stdint.h> // Use Visual Studio's stdint.h
7#define _MSC_STDINT_H_ // This define will ensure that stdint.h in sipXport tree is not used
8#endif
9
10#include "os/OsSocket.h"
12
13using namespace flowmanager;
14
15namespace recon
16{
17
18class FlowManagerSipXSocket : public OsSocket
19{
20/* //////////////////////////// PUBLIC //////////////////////////////////// */
21public:
22
24 virtual ~FlowManagerSipXSocket();
25
26/* ============================ MANIPULATORS ============================== */
27
28 virtual OsSocket* getSocket();
29
30 virtual int read(char* buffer, int bufferLength) ;
31 virtual int read(char* buffer, int bufferLength,
32 UtlString* ipAddress, int* port);
33 virtual int read(char* buffer, int bufferLength,
34 struct in_addr* ipAddress, int* port);
35 virtual int read(char* buffer, int bufferLength, long waitMilliseconds);
36
37
38 virtual int write(const char* buffer, int bufferLength);
39 virtual int write(const char* buffer, int bufferLength,
40 const char* ipAddress, int port);
41 virtual int write(const char* buffer, int bufferLength,
42 long waitMilliseconds);
43
44 virtual void close() { return; }
45 //: Closes the socket
46
47 virtual void makeNonblocking() { return; }
48 virtual void makeBlocking() { return; }
49 //: Make the connect and all subsequent operations blocking
50 // By default the sockets are blocking.
51
52/* ============================ ACCESSORS ================================= */
53
54 virtual OsSocket::IpProtocolSocketType getIpProtocol() const { return OsSocket::CUSTOM; }
55 //:Return the protocol type of this socket
56
57 virtual UtlBoolean reconnect() { return TRUE; }
58 //:Set up the connection again, assuming the connection failed
59
60 virtual int getSocketDescriptor() const;
61 //:Return the socket descriptor
62 // Warning: Use of this method risks the creation of platform-dependent
63 // code.
64
65 virtual void getLocalHostIp(UtlString* localHostAddress) const { *localHostAddress = "FlowManagerHost"; }
66 //:Return this host's ip address
67 // Returns the ip address for this host on which this socket is communicating
68 // On multi-homed machines, this is the address to the NIC over which the
69 // socket communicates. The format is of the form: xx.x.xxx.x
70
71 virtual const UtlString& getLocalIp() const { static UtlString ipAddr="0.0.0.0"; return ipAddr; }
72 //:Return this socket's Local Ip Address
73
74 virtual int getLocalHostPort() const { return 0; }
75 //:Return the local port number
76 // Returns the port to which this socket is bound on this host.
77
78 virtual void getRemoteHostName(UtlString* remoteHostName) const { *remoteHostName = "FlowManagerRemoteHost"; }
79 //:Return remote host name
80 // Returns a string containing the name of the host on which the socket
81 // on the other end of this socket is bound. This may be the local
82 // name, a fully qualified domain name or anything in between.
83
84
86 int* remotePort = NULL) { printf("getRemoteHostIp\n"); return; }
87 //:Return remote host ip address
88 // Returns the ip address for the host on which the socket on the
89 // other end of this socket is bound.
90
92 int* remotePort = NULL) { printf("getRemoteHostIp\n"); return; }
93 //:Return remote host ip address
94 // Returns the ip address for the host on which the socket on the
95 // other end of this socket is bound. The format is of the form:
96 // xx.x.xxx.x
97
98 virtual int getRemoteHostPort() const { return 0; }
99 //:Return the remote port number
100 // Returns the port to which the socket on the other end of this socket
101 // is bound.
102
103
104/* ============================ INQUIRY =================================== */
105
106 virtual UtlBoolean isOk() const { return TRUE; }
107 //:Returns TRUE if this socket's descriptor is not the invalid descriptor
108
109 virtual UtlBoolean isConnected() const { return TRUE; }
110 //:Returns TRUE if this socket is connected
111
113 //:Poll if there are bytes to read
114 // Returns TRUE if socket is read to read.
115 // Returns FALSE if wait expires or socket error.
116 // rSocketError returns TRUE is socket error occurred.
117
118 virtual UtlBoolean isReadyToRead(long waitMilliseconds = 0) const { return TRUE; }
119 //:Poll if there are bytes to read
120 // Returns TRUE if socket is ready to read.
121 // Returns FALSE if wait expires or socket error.
122
123 virtual UtlBoolean isReadyToWrite(long waitMilliseconds = 0) const { return TRUE; }
124 //:Poll if socket is able to write without blocking
125
126
127/* //////////////////////////// PROTECTED ///////////////////////////////// */
128protected:
129
130
131/* //////////////////////////// PRIVATE /////////////////////////////////// */
132private:
133 Flow* mFlow;
134};
135
136}
137/* ============================ INLINE METHODS ============================ */
138
139
140/* ///////////////////////// HELPER CLASSES /////////////////////////////// */
141
142
143
144#endif // _FlowManagerSipXSocket_h_
145
146
147/* ====================================================================
148
149 Copyright (c) 2021, Daniel Pocock https://danielpocock.com
150 Copyright (c) 2007-2008, Plantronics, Inc.
151 All rights reserved.
152
153 Redistribution and use in source and binary forms, with or without
154 modification, are permitted provided that the following conditions are
155 met:
156
157 1. Redistributions of source code must retain the above copyright
158 notice, this list of conditions and the following disclaimer.
159
160 2. Redistributions in binary form must reproduce the above copyright
161 notice, this list of conditions and the following disclaimer in the
162 documentation and/or other materials provided with the distribution.
163
164 3. Neither the name of Plantronics nor the names of its contributors
165 may be used to endorse or promote products derived from this
166 software without specific prior written permission.
167
168 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
169 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
170 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
171 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
172 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
173 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
174 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
175 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
176 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
177 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
178 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
179
180 ==================================================================== */
This class represents a Flow that is created by the Flow Manager.
Definition Flow.hxx:45
virtual UtlBoolean isReadyToReadEx(long waitMilliseconds, UtlBoolean &rSocketError) const
virtual void getLocalHostIp(UtlString *localHostAddress) const
virtual void getRemoteHostIp(struct in_addr *remoteHostAddress, int *remotePort=NULL)
virtual void getRemoteHostIp(UtlString *remoteHostAddress, int *remotePort=NULL)
virtual UtlBoolean isConnected() const
virtual void getRemoteHostName(UtlString *remoteHostName) const
virtual OsSocket::IpProtocolSocketType getIpProtocol() const
virtual const UtlString & getLocalIp() const
virtual UtlBoolean isReadyToWrite(long waitMilliseconds=0) const
virtual int read(char *buffer, int bufferLength)
virtual UtlBoolean isReadyToRead(long waitMilliseconds=0) const
virtual UtlBoolean isOk() const
virtual int write(const char *buffer, int bufferLength)
This class is used during media sessions that use Dtls-Srtp for a media transport.
Definition ErrorCode.hxx:4
void list()
Definition userAdmin.cxx:66