BLPAPI C++ 3.26.6
Loading...
Searching...
No Matches
blpapi_socks5config.h
Go to the documentation of this file.
1/* Copyright 2022. Bloomberg Finance L.P.
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to
5 * deal in the Software without restriction, including without limitation the
6 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 * sell copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions: The above
9 * copyright notice and this permission notice shall be included in all copies
10 * or substantial portions of the Software.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
17 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
18 * IN THE SOFTWARE.
19 */
20
37
38#ifndef INCLUDED_BLPAPI_SOCKS5CONFIG
39#define INCLUDED_BLPAPI_SOCKS5CONFIG
40
65
68
69#include <blpapi_call.h>
70#include <blpapi_defs.h>
71#include <blpapi_exception.h>
72#include <blpapi_streamproxy.h>
73#include <blpapi_types.h>
74
75#ifdef __cplusplus
76
77extern "C" {
78#endif
79
81
84
99BLPAPI_EXPORT
100blpapi_Socks5Config_t *blpapi_Socks5Config_create(
101 const char *hostname, size_t hostname_size, unsigned short port);
102
116BLPAPI_EXPORT
117int blpapi_Socks5Config_copy(blpapi_Socks5Config_t **socks5Config,
118 blpapi_Socks5Config_t *srcSocks5Config);
119
128BLPAPI_EXPORT
129void blpapi_Socks5Config_destroy(blpapi_Socks5Config_t *socks5Config);
130
147BLPAPI_EXPORT
148int blpapi_Socks5Config_print(blpapi_Socks5Config_t *socks5Config,
149 blpapi_StreamWriter_t streamWriter,
150 void *userStream,
151 int indentLevel,
152 int spacesPerLevel);
153
156
157#ifdef __cplusplus
158}
159
160#include <algorithm>
161#include <string>
162
163namespace BloombergLP {
164namespace blpapi {
171
172class SessionOptions;
173
182
183 blpapi_Socks5Config_t *d_handle;
184 // Handle to the internal representation.
185
186 public:
187 Socks5Config();
190
191 Socks5Config(const std::string& hostName, unsigned short port);
197
202
203 std::ostream& print(
204 std::ostream& stream, int indentLevel, int spacesPerLevel) const;
205
207 blpapi_Socks5Config_t *impl() const;
212};
213
216
218 : d_handle(0)
219{
220}
221
222inline Socks5Config::Socks5Config(const Socks5Config& socks5Config)
223{
224 ExceptionUtil::throwOnError(BLPAPI_CALL(blpapi_Socks5Config_copy)(
225 &d_handle, socks5Config.d_handle));
226}
227
229{
230 Socks5Config copy(socks5Config);
231 std::swap(d_handle, copy.d_handle);
232 return *this;
233}
234
235inline std::ostream& Socks5Config::print(std::ostream& stream,
236 int indentLevel = 0,
237 int spacesPerLevel = 4) const
238{
239 BLPAPI_CALL(blpapi_Socks5Config_print)
240 (d_handle,
242 &stream,
243 indentLevel,
244 spacesPerLevel);
245 return stream;
246}
247
248std::ostream& operator<<(
249 std::ostream& stream, const Socks5Config& socks5Config);
250
252 const std::string& hostname, unsigned short port)
253{
254 d_handle = BLPAPI_CALL(blpapi_Socks5Config_create)(
255 hostname.c_str(), hostname.size(), port);
256}
257
259{
260 BLPAPI_CALL_UNCHECKED(blpapi_Socks5Config_destroy)(d_handle);
261}
262
264inline blpapi_Socks5Config_t *Socks5Config::impl() const { return d_handle; }
266
267inline std::ostream& operator<<(
268 std::ostream& stream, const Socks5Config& socks5Config)
269{
270 socks5Config.print(stream, 0, -1);
271 return stream;
272}
273
274} // end namespace blpapi
275} // end namespace BloombergLP
276
277#endif // #ifdef __cplusplus
278#endif // #ifndef INCLUDED_BLPAPI_SOCKS5CONFIG
Provide functions for dispatchtbl.
Common definitions used by the library.
Defines Exceptions that can be thrown by the blpapi library.
A signature for callback on print and default C++ implementation.
Provide BLPAPI types.
static void throwOnError(int errorCode)
Definition blpapi_exception.h:556
Definition blpapi_sessionoptions.h:1141
Definition blpapi_socks5config.h:181
Socks5Config()
Definition blpapi_socks5config.h:217
std::ostream & print(std::ostream &stream, int indentLevel, int spacesPerLevel) const
Definition blpapi_socks5config.h:235
Socks5Config & operator=(const Socks5Config &)
Definition blpapi_socks5config.h:228
~Socks5Config()
Definition blpapi_socks5config.h:258
Definition blpapi_abstractsession.h:452
std::ostream & operator<<(std::ostream &os, const CorrelationId &correlator)
Definition blpapi_correlationid.h:761
Definition blpapi_abstractsession.h:451
static int writeToStream(const char *data, int length, void *stream)
Definition blpapi_streamproxy.h:108