BLPAPI C++ 3.25.8
Loading...
Searching...
No Matches
blpapi_authoptions.h
Go to the documentation of this file.
1/* Copyright 2019. 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
28#ifndef INCLUDED_BLPAPI_AUTHOPTIONS
29#define INCLUDED_BLPAPI_AUTHOPTIONS
30
73#include <blpapi_call.h>
74#include <blpapi_defs.h>
75#include <blpapi_exception.h>
76#include <blpapi_types.h>
77
78#include <stddef.h>
79
80#ifdef __cplusplus
81extern "C" {
82#endif
83
86
89 blpapi_AuthOptions_t **options, const blpapi_AuthUser_t *user);
90
94
97 const blpapi_AuthUser_t *user,
98 const blpapi_AuthApplication_t *app);
99
102 blpapi_AuthOptions_t **options, const blpapi_AuthToken_t *token);
103
106 blpapi_AuthOptions_t **options, const blpapi_AuthOptions_t *dup);
107
111
114
117
120 blpapi_AuthUser_t **user, const char *propertyName);
121
124 blpapi_AuthUser_t **user, const char *userId, const char *ipAddress);
125
128 blpapi_AuthUser_t **user, const blpapi_AuthUser_t *dup);
129
132
135
138 blpapi_AuthApplication_t **app, const char *appName);
139
143
147
150
152int blpapi_AuthToken_create(blpapi_AuthToken_t **token, const char *tokenStr);
153
156 blpapi_AuthToken_t **token, const blpapi_AuthToken_t *dup);
157
160 blpapi_AuthToken_t *lhs, const blpapi_AuthToken_t *rhs);
161
164
165#ifdef __cplusplus
166}
167
175namespace BloombergLP {
176namespace blpapi {
177
178class AuthUser;
179class AuthApplication;
180class AuthToken;
181
182// =================
183// class AuthOptions
184// =================
185
195
196 blpapi_AuthOptions_t *d_handle_p;
197
198 public:
199 AuthOptions();
205 AuthOptions(const AuthUser& user);
214 AuthOptions(const AuthApplication& app);
219 AuthOptions(const AuthUser& user, const AuthApplication& app);
224 AuthOptions(const AuthToken& token);
234 AuthOptions(const AuthOptions& options);
239 ~AuthOptions();
244 AuthOptions& operator=(const AuthOptions& rhs);
254};
255
256// =======================
257// class AuthUser
258// =======================
259
266class AuthUser {
267
268 blpapi_AuthUser_t *d_handle_p;
269
270 public:
276 AuthUser(const AuthUser& user);
281 ~AuthUser();
286 AuthUser& operator=(const AuthUser& rhs);
299 const char *propertyName);
309 const char *userId, const char *ipAddress);
317 const blpapi_AuthUser_t *handle() const;
321};
322
323// ==============================
324// class AuthApplication
325// ==============================
326
334
335 blpapi_AuthApplication_t *d_handle_p;
336
337 public:
338 explicit AuthApplication(const char *appName);
367 const blpapi_AuthApplication_t *handle() const;
371};
372
373// ========================
374// class AuthToken
375// ========================
376
384
385 blpapi_AuthToken_t *d_handle_p;
386
387 public:
388 explicit AuthToken(const char *tokenStr);
401 AuthToken(const AuthToken& token);
406 ~AuthToken();
411 AuthToken& operator=(const AuthToken& rhs);
417 const blpapi_AuthToken_t *handle() const;
421};
422
426// ============================================================================
427// INLINE FUNCTION DEFINITIONS
428// ============================================================================
429
430// =================
431// class AuthOptions
432// =================
433
439
446
452
454 const AuthUser& user, const AuthApplication& app)
455{
458 &d_handle_p, user.handle(), app.handle()));
459}
460
466
468 : d_handle_p(handle)
469{
470}
471
473{
475 &d_handle_p, options.handle()));
476}
477
482
484{
486 BLPAPI_CALL(blpapi_AuthOptions_copy)(d_handle_p, rhs.handle()));
487
488 return *this;
489}
490
491inline blpapi_AuthOptions_t *AuthOptions::handle() const { return d_handle_p; }
492
493// =======================
494// class AuthUser
495// =======================
496
498 : d_handle_p(handle)
499{
500}
501
502inline AuthUser::AuthUser(const AuthUser& user)
503{
505 &d_handle_p, user.handle()));
506}
507
512
514{
516 BLPAPI_CALL(blpapi_AuthUser_copy)(d_handle_p, rhs.handle()));
517
518 return *this;
519}
520
532
534 const char *propertyName)
535{
537
540 &handle, propertyName));
541
542 AuthUser user(handle);
543
544 return user;
545}
546
548 const char *userId, const char *ipAddress)
549{
551
554 &handle, userId, ipAddress));
555
556 AuthUser user(handle);
557
558 return user;
559}
560
561inline const blpapi_AuthUser_t *AuthUser::handle() const { return d_handle_p; }
562
563// ==============================
564// class AuthApplication
565// ==============================
566
567inline AuthApplication::AuthApplication(const char *name)
568{
570 BLPAPI_CALL(blpapi_AuthApplication_create)(&d_handle_p, name));
571}
572
574 : d_handle_p(handle)
575{
576}
577
583
588
590{
592 d_handle_p, rhs.handle()));
593
594 return *this;
595}
596
598{
599 return d_handle_p;
600}
601
602// ========================
603// class AuthToken
604// ========================
605
606inline AuthToken::AuthToken(const char *tokenStr)
607{
609 BLPAPI_CALL(blpapi_AuthToken_create)(&d_handle_p, tokenStr));
610}
611
613 : d_handle_p(handle)
614{
615}
616
617inline AuthToken::AuthToken(const AuthToken& token)
618{
620 &d_handle_p, token.handle()));
621}
622
627
629{
631 BLPAPI_CALL(blpapi_AuthToken_copy)(d_handle_p, rhs.handle()));
632
633 return *this;
634}
635
637{
638 return d_handle_p;
639}
640
641} // close namespace blpapi
642} // close namespace BloombergLP
643
644#endif // #ifdef __cplusplus
645#endif // #ifndef INCLUDED_BLPAPI_AUTHOPTIONS
BLPAPI_EXPORT int blpapi_AuthToken_copy(blpapi_AuthToken_t *lhs, const blpapi_AuthToken_t *rhs)
BLPAPI_EXPORT int blpapi_AuthOptions_create_forUserAndAppMode(blpapi_AuthOptions_t **options, const blpapi_AuthUser_t *user, const blpapi_AuthApplication_t *app)
BLPAPI_EXPORT int blpapi_AuthOptions_create_forToken(blpapi_AuthOptions_t **options, const blpapi_AuthToken_t *token)
BLPAPI_EXPORT int blpapi_AuthUser_duplicate(blpapi_AuthUser_t **user, const blpapi_AuthUser_t *dup)
BLPAPI_EXPORT void blpapi_AuthOptions_destroy(blpapi_AuthOptions_t *options)
BLPAPI_EXPORT int blpapi_AuthOptions_create_forUserMode(blpapi_AuthOptions_t **options, const blpapi_AuthUser_t *user)
BLPAPI_EXPORT int blpapi_AuthUser_createWithLogonName(blpapi_AuthUser_t **user)
BLPAPI_EXPORT void blpapi_AuthApplication_destroy(blpapi_AuthApplication_t *app)
BLPAPI_EXPORT int blpapi_AuthOptions_duplicate(blpapi_AuthOptions_t **options, const blpapi_AuthOptions_t *dup)
BLPAPI_EXPORT int blpapi_AuthUser_createWithActiveDirectoryProperty(blpapi_AuthUser_t **user, const char *propertyName)
BLPAPI_EXPORT int blpapi_AuthApplication_create(blpapi_AuthApplication_t **app, const char *appName)
BLPAPI_EXPORT int blpapi_AuthUser_copy(blpapi_AuthUser_t *lhs, const blpapi_AuthUser_t *rhs)
BLPAPI_EXPORT int blpapi_AuthApplication_copy(blpapi_AuthApplication_t *lhs, const blpapi_AuthApplication_t *rhs)
BLPAPI_EXPORT int blpapi_AuthToken_duplicate(blpapi_AuthToken_t **token, const blpapi_AuthToken_t *dup)
BLPAPI_EXPORT void blpapi_AuthUser_destroy(blpapi_AuthUser_t *user)
BLPAPI_EXPORT int blpapi_AuthOptions_copy(blpapi_AuthOptions_t *lhs, const blpapi_AuthOptions_t *rhs)
BLPAPI_EXPORT int blpapi_AuthApplication_duplicate(blpapi_AuthApplication_t **app, const blpapi_AuthApplication_t *dup)
BLPAPI_EXPORT void blpapi_AuthToken_destroy(blpapi_AuthToken_t *token)
BLPAPI_EXPORT int blpapi_AuthToken_create(blpapi_AuthToken_t **token, const char *tokenStr)
BLPAPI_EXPORT int blpapi_AuthUser_createWithManualOptions(blpapi_AuthUser_t **user, const char *userId, const char *ipAddress)
BLPAPI_EXPORT int blpapi_AuthOptions_create_default(blpapi_AuthOptions_t **options)
BLPAPI_EXPORT int blpapi_AuthOptions_create_forAppMode(blpapi_AuthOptions_t **options, const blpapi_AuthApplication_t *app)
Provide functions for dispatchtbl.
#define BLPAPI_CALL_UNCHECKED(FUNCNAME)
Definition blpapi_call.h:354
#define BLPAPI_CALL(FUNCNAME)
Definition blpapi_call.h:353
Common definitions used by the library.
#define BLPAPI_EXPORT
Definition blpapi_defs.h:171
Defines Exceptions that can be thrown by the blpapi library.
Provide BLPAPI types.
Definition blpapi_authoptions.h:333
AuthApplication(const char *appName)
Definition blpapi_authoptions.h:567
AuthApplication & operator=(const AuthApplication &rhs)
Definition blpapi_authoptions.h:589
const blpapi_AuthApplication_t * handle() const
Definition blpapi_authoptions.h:597
~AuthApplication()
Definition blpapi_authoptions.h:584
Definition blpapi_authoptions.h:194
AuthOptions & operator=(const AuthOptions &rhs)
Definition blpapi_authoptions.h:483
blpapi_AuthOptions_t * handle() const
Definition blpapi_authoptions.h:491
AuthOptions()
Definition blpapi_authoptions.h:434
~AuthOptions()
Definition blpapi_authoptions.h:478
Definition blpapi_authoptions.h:383
AuthToken & operator=(const AuthToken &rhs)
Definition blpapi_authoptions.h:628
const blpapi_AuthToken_t * handle() const
Definition blpapi_authoptions.h:636
AuthToken(const char *tokenStr)
Definition blpapi_authoptions.h:606
~AuthToken()
Definition blpapi_authoptions.h:623
Definition blpapi_authoptions.h:266
const blpapi_AuthUser_t * handle() const
Definition blpapi_authoptions.h:561
AuthUser & operator=(const AuthUser &rhs)
Definition blpapi_authoptions.h:513
static AuthUser createWithActiveDirectoryProperty(const char *propertyName)
Definition blpapi_authoptions.h:533
static AuthUser createWithLogonName()
Definition blpapi_authoptions.h:521
static AuthUser createWithManualOptions(const char *userId, const char *ipAddress)
Definition blpapi_authoptions.h:547
~AuthUser()
Definition blpapi_authoptions.h:508
AuthUser(blpapi_AuthUser_t *handle)
Definition blpapi_authoptions.h:497
static void throwOnError(int errorCode)
Definition blpapi_exception.h:526
struct blpapi_AuthApplication blpapi_AuthApplication_t
Definition blpapi_types.h:209
struct blpapi_AuthOptions blpapi_AuthOptions_t
Definition blpapi_types.h:203
struct blpapi_AuthToken blpapi_AuthToken_t
Definition blpapi_types.h:212
struct blpapi_AuthUser blpapi_AuthUser_t
Definition blpapi_types.h:206
Definition blpapi_abstractsession.h:195