BLPAPI C++ 3.26.5
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
35
36#ifndef INCLUDED_BLPAPI_SOCKS5CONFIG
37#define INCLUDED_BLPAPI_SOCKS5CONFIG
38
64
67
68#include <blpapi_call.h>
69#include <blpapi_defs.h>
70#include <blpapi_exception.h>
71#include <blpapi_streamproxy.h>
72#include <blpapi_types.h>
73
74#ifdef __cplusplus
75
76extern "C" {
77#endif
78
80
83
84BLPAPI_EXPORT
85blpapi_Socks5Config_t *blpapi_Socks5Config_create(
86 const char *hostname, size_t hostname_size, unsigned short port);
87
88BLPAPI_EXPORT
89int blpapi_Socks5Config_copy(blpapi_Socks5Config_t **socks5Config,
90 blpapi_Socks5Config_t *srcSocks5Config);
91
92BLPAPI_EXPORT
93void blpapi_Socks5Config_destroy(blpapi_Socks5Config_t *socks5Config);
94
95BLPAPI_EXPORT
96int blpapi_Socks5Config_print(blpapi_Socks5Config_t *socks5Config,
97 blpapi_StreamWriter_t streamWriter,
98 void *userStream,
99 int indentLevel,
100 int spacesPerLevel);
101
104
105#ifdef __cplusplus
106}
107
108#include <algorithm>
109#include <string>
110
117
118namespace BloombergLP {
119namespace blpapi {
120
121class SessionOptions;
122
131
132 blpapi_Socks5Config_t *d_handle;
133 // Handle to the internal representation.
134
135 public:
136 Socks5Config();
139
140 Socks5Config(const std::string& hostName, unsigned short port);
146
151
152 std::ostream& print(
153 std::ostream& stream, int indentLevel, int spacesPerLevel) const;
154
156 blpapi_Socks5Config_t *impl() const;
161};
162
165
167 : d_handle(0)
168{
169}
170
171inline Socks5Config::Socks5Config(const Socks5Config& socks5Config)
172{
173 ExceptionUtil::throwOnError(BLPAPI_CALL(blpapi_Socks5Config_copy)(
174 &d_handle, socks5Config.d_handle));
175}
176
178{
179 Socks5Config copy(socks5Config);
180 std::swap(d_handle, copy.d_handle);
181 return *this;
182}
183
184inline std::ostream& Socks5Config::print(std::ostream& stream,
185 int indentLevel = 0,
186 int spacesPerLevel = 4) const
187{
188 BLPAPI_CALL(blpapi_Socks5Config_print)
189 (d_handle,
191 &stream,
192 indentLevel,
193 spacesPerLevel);
194 return stream;
195}
196
197std::ostream& operator<<(
198 std::ostream& stream, const Socks5Config& socks5Config);
199
201 const std::string& hostname, unsigned short port)
202{
203 d_handle = BLPAPI_CALL(blpapi_Socks5Config_create)(
204 hostname.c_str(), hostname.size(), port);
205}
206
208{
209 BLPAPI_CALL_UNCHECKED(blpapi_Socks5Config_destroy)(d_handle);
210}
211
212inline blpapi_Socks5Config_t *Socks5Config::impl() const { return d_handle; }
213
214inline std::ostream& operator<<(
215 std::ostream& stream, const Socks5Config& socks5Config)
216{
217 socks5Config.print(stream, 0, -1);
218 return stream;
219}
220
221} // end namespace blpapi
222} // end namespace BloombergLP
223
224#endif // #ifdef __cplusplus
225#endif // #ifndef INCLUDED_BLPAPI_SOCKS5CONFIG
Provide functions for dispatchtbl.
#define BLPAPI_CALL_UNCHECKED(FUNCNAME)
Definition blpapi_call.h:362
#define BLPAPI_CALL(FUNCNAME)
Definition blpapi_call.h:361
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:541
Definition blpapi_sessionoptions.h:447
Definition blpapi_socks5config.h:130
Socks5Config()
Definition blpapi_socks5config.h:166
std::ostream & print(std::ostream &stream, int indentLevel, int spacesPerLevel) const
Definition blpapi_socks5config.h:184
Socks5Config & operator=(const Socks5Config &)
Definition blpapi_socks5config.h:177
~Socks5Config()
Definition blpapi_socks5config.h:207
Definition blpapi_abstractsession.h:212
std::ostream & operator<<(std::ostream &os, const CorrelationId &correlator)
Definition blpapi_correlationid.h:680
Definition blpapi_abstractsession.h:211
static int writeToStream(const char *data, int length, void *stream)
Definition blpapi_streamproxy.h:109