[go: up one dir, main page]

Menu

[a443d0]: / src / FlomHandle.hh  Maximize  Restore  History

Download this file

783 lines (716 with data), 33.9 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
/*
* Copyright (c) 2013-2016, Christian Ferrari <tiian@users.sourceforge.net>
* All rights reserved.
*
* This file is part of FLoM, Free Lock Manager
*
* FLoM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2.0 as
* published by the Free Software Foundation.
*
* FLoM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with FLoM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FLOMHANDLE_HH
# define FLOMHANDLE_HH
#include <string>
#include <exception>
#include <syslog.h>
#include "flom_handle.h"
using namespace std;
namespace flom {
/**
* FLoM exception class, it extends standard exception class and adds the
* return code property that maps on C API
*/
class FlomException : public exception {
virtual const char* what() const throw()
{
return flom_strerror(ReturnCode);
}
private:
/**
* Return code returned by the failed C function
*/
int ReturnCode;
public:
/**
* @param ret_cod: the return code of the failed C function
*/
FlomException(int ret_cod) {
ReturnCode = ret_cod; }
/**
* Retrieve the numeric return code of the failed C function
*/
int getReturnCode() { return ReturnCode; }
/**
* Retrieve the description associated to the numeric return code of
* the failed C function
*/
string getReturnCodeText() {
return (string(flom_strerror(ReturnCode))); }
};
/**
* This class provides C++ abstraction to C flom_handle_t type
*/
class FlomHandle {
private:
/**
* C FLoM handle object
*/
flom_handle_t handle;
public:
FlomHandle() {
int ret_cod = flom_handle_init(&handle);
/* in case of error, an exception is thrown */
if (FLOM_RC_OK != ret_cod) {
syslog(LOG_ERR, "FlomHandle/flom_handle_init: "
"ret_cod=%d ('%s')\n", ret_cod, flom_strerror(ret_cod));
throw FlomException(ret_cod);
}
}
~FlomHandle() {
int ret_cod = flom_handle_clean(&handle);
/* exception can NOT be thrown from a destructor, only syslog
records the issue */
if (FLOM_RC_OK != ret_cod) {
syslog(LOG_ERR, "~FlomHandle/flom_handle_clean: "
"ret_cod=%d ('%s')\n", ret_cod, flom_strerror(ret_cod));
}
}
/**
* Locks the (logical) resource linked to this handle; the resource
* MUST be unlocked using method @ref unlock when the lock condition
* is no more necessary.
* @return a reason code (see file @ref flom_errors.h)
*/
int lock() { return flom_handle_lock(&handle); }
/**
* Unlocks the (logical) resource linked to this handle; the resource
* MUST be previously locked using method @ref lock
* @return a reason code (see file @ref flom_errors.h)
*/
int unlock() { return flom_handle_unlock(&handle); }
/**
* Get the name of the locked element if the resource is of
* type set.<P>
* Note 1: this method can be used only after @ref lock and before
* @ref unlock<P>
* Note 2: this method can be used only when locking a resource of
* type "resource set"<P>
* Note 3: the return string must copied as soon as possible to a
* different place because it's a dynamic string removed by
* @ref unlock<P>
* @return the name of the locked element
*/
const char *getLockedElementAsCStr() {
return flom_handle_get_locked_element(&handle); }
/**
* Get the name of the locked element if the resource is of
* type set.<P>
* Note 1: this method can be used only after @ref lock and before
* @ref unlock<P>
* Note 2: this method can be used only when locking a resource of
* type "resource set"<P>
* Note 3: the return string must copied as soon as possible to a
* different place because it's a dynamic string removed by
* @ref unlock<P>
* @return the name of the locked element
*/
string getLockedElement() {
return NULL != flom_handle_get_locked_element(&handle) ?
flom_handle_get_locked_element(&handle) : ""; }
/**
* Get the maximum number of attempts that will be tryed during
* auto-discovery phase using UDP/IP multicast (see
* @ref getMulticastAddress, @ref getMulticastPort).
* The current value can be altered using method
* @ref setDiscoveryAttempts
* @return the current value
*/
int getDiscoveryAttempts() {
return flom_handle_get_discovery_attempts(&handle); }
/**
* Set the maximum number of attempts that will be tryed during
* auto-discovery phase using UDP/IP multicast (see
* @ref setMulticastAddress, @ref setMulticastPort).
* The current value can be inspected using method
* @ref getDiscoveryAttempts
* @param value (Input): the new value
* @return @ref FLOM_RC_OK or @ref FLOM_RC_API_IMMUTABLE_HANDLE
*/
int setDiscoveryAttempts(int value) {
return flom_handle_set_discovery_attempts(&handle, value); }
/**
* Get the number of milliseconds between two consecutive attempts
* that will be tryed during auto-discovery phase using UDP/IP
* multicast (see
* @ref getMulticastAddress, @ref getMulticastPort).
* The current value can be altered using method
* @ref setDiscoveryTimeout
* @return the current value
*/
int getDiscoveryTimeout() {
return flom_handle_get_discovery_timeout(&handle); }
/**
* Set the number of milliseconds between two consecutive attempts
* that will be tryed during auto-discovery phase using UDP/IP
* multicast (see
* @ref setMulticastAddress, @ref setMulticastPort).
* The current value can be inspected using method
* @ref getDiscoveryTimeout.
* @param value (Input): the new value
* @return @ref FLOM_RC_OK or @ref FLOM_RC_API_IMMUTABLE_HANDLE
*/
int setDiscoveryTimeout(int value) {
return flom_handle_set_discovery_timeout(&handle, value); }
/**
* Get the UDP/IP multicast TTL parameter used during auto-discovery
* phase; for a definition of the parameter, see
* http://www.tldp.org/HOWTO/Multicast-HOWTO-2.html
* . The current value can be altered using method @ref setDiscoveryTtl
* @return the current value
*/
int getDiscoveryTtl() {
return flom_handle_get_discovery_ttl(&handle); }
/**
* Set the UDP/IP multicast TTL parameter used during auto-discovery
* phase; for a definition of the parameter, see
* http://www.tldp.org/HOWTO/Multicast-HOWTO-2.html
* . The current value can be inspected using method
* @ref getDiscoveryTtl.
* @param value (Input): the new value
* @return @ref FLOM_RC_OK or @ref FLOM_RC_API_IMMUTABLE_HANDLE
*/
int setDiscoveryTtl(int value) {
return flom_handle_set_discovery_ttl(&handle, value); }
/**
* Get lock mode property: how a simple or hierarchical resource will
* be locked when method @ref lock is called; FLoM
* supports the same lock mode semantic proposed by DLM, see
* http://en.wikipedia.org/wiki/Distributed_lock_manager#Lock_modes
* for a detailed explanation
* . The current value can be altered using method @ref setLockMode
* @return the current value
*/
flom_lock_mode_t getLockMode() {
return flom_handle_get_lock_mode(&handle); }
/**
* Set lock mode property: how a simple or hierarchical resource will
* be locked when method @ref lock is called; FLoM
* supports the same lock mode semantic proposed by DLM, see
* http://en.wikipedia.org/wiki/Distributed_lock_manager#Lock_modes
* for a detailed explanation
* . The current value can be inspected using method @ref getLockMode
* @param value (Input): the new value
* @return @ref FLOM_RC_OK or @ref FLOM_RC_API_IMMUTABLE_HANDLE
*/
int setLockMode(flom_lock_mode_t value) {
return flom_handle_set_lock_mode(&handle, value); }
/**
* Get the multicast address: the IP address (or a network name that
* the system can resolve) of the IP multicast group that must be
* contacted to reach FLoM daemon (server) using UDP/IP; see also
* @ref getMulticastPort.
* The current value can be altered using method
* @ref setMulticastAddress.
* @return the current value as a null terminated C string
*/
const char *getMulticastAddressAsCStr() {
return flom_handle_get_multicast_address(&handle); }
/**
* Get the multicast address: the IP address (or a network name that
* the system can resolve) of the IP multicast group that must be
* contacted to reach FLoM daemon (server) using UDP/IP; see also
* @ref getMulticastPort.
* The current value can be altered using method
* @ref setMulticastAddress.
* @return the current value as a standard C++ string
*/
string getMulticastAddress() {
return NULL != flom_handle_get_multicast_address(&handle) ?
flom_handle_get_multicast_address(&handle) : ""; }
/**
* Set the multicast address: the IP address (or a network name that
* the system can resolve) of the IP multicast group that must be
* contacted to reach FLoM daemon (server) using UDP/IP; see also
* @ref setMulticastPort.
* The current value can be inspected using method
* @ref getMulticastAddress.
* @param value (Input): the new value (C null terminated string)
* @return @ref FLOM_RC_OK or @ref FLOM_RC_API_IMMUTABLE_HANDLE
*/
int setMulticastAddress(const char *value) {
return flom_handle_set_multicast_address(&handle, value); }
/**
* Set the multicast address: the IP address (or a network name that
* the system can resolve) of the IP multicast group that must be
* contacted to reach FLoM daemon (server) using UDP/IP; see also
* @ref setMulticastPort.
* The current value can be inspected using method
* @ref getMulticastAddress.
* @param value (Input): the new value (C++ standard string)
* @return @ref FLOM_RC_OK or @ref FLOM_RC_API_IMMUTABLE_HANDLE
*/
int setMulticastAddress(const string &value) {
return flom_handle_set_multicast_address(&handle, value.c_str()); }
/**
* Get the UDP/IP multicast port that must be used to contact the FLoM
* daemon (server) using UDP/IP; see also @ref getMulticastAddress.
* The current value can be altered using method @ref setMulticastPort.
* @return the current value
*/
int getMulticastPort() {
return flom_handle_get_multicast_port(&handle); }
/**
* Set the UDP/IP multicast port that must be used to contact the FLoM
* daemon (server) using UDP/IP; see also @ref setMulticastAddress.
* The current value can be inspected using method
* @ref getMulticastPort.
* @param value (Input): the new value
* @return @ref FLOM_RC_OK or @ref FLOM_RC_API_IMMUTABLE_HANDLE
*/
int setMulticastPort(int value) {
return flom_handle_set_multicast_port(&handle, value); }
/**
* Get the network interface that must be used for IPv6 link local
* addresses
* The current value can be altered using method
* @ref setNetworkInterface.
* @return the current value as a C null terminated string
*/
const char *getNetworkInterfaceAsCStr() {
return flom_handle_get_network_interface(&handle); }
/**
* Get the network interface that must be used for IPv6 link local
* addresses
* The current value can be altered using method
* @ref setNetworkInterface.
* @return the current value as a C++ standard string
*/
string getNetworkInterface() {
return NULL != flom_handle_get_network_interface(&handle) ?
flom_handle_get_network_interface(&handle) : ""; }
/**
* Set the network interface that must be used for IPv6 link local
* addresses
* The current value can be inspected using method
* @ref getNetworkInterface.
* @param value (Input): the new value (C null terminted string)
* @return a reason code
*/
int setNetworkInterface(const char *value) {
return flom_handle_set_network_interface(&handle, value); }
/**
* Set the network interface that must be used for IPv6 link local
* addresses
* The current value can be inspected using method
* @ref getNetworkInterface.
* @param value (Input): the new value (C++ standard string)
* @return a reason code
*/
int setNetworkInterface(const string &value) {
flom_handle_set_network_interface(&handle, value.c_str()); }
/**
* Get "resource create" boolean property: it specifies if method
* @ref lock can create a new resource when the specified
* one is not defined; the default value is TRUE.
* The current value can be altered using method
* @ref setResourceCreate.
* @return the current value
*/
int getResourceCreate() {
return flom_handle_get_resource_create(&handle); }
/**
* Set "resource create" boolean property: it specifies if method
* @ref lock can create a new resource when the specified
* one is not defined.
* The current value can be inspected using method
* @ref getResourceCreate.
* @param value (Input): the new value
* @return @ref FLOM_RC_OK or @ref FLOM_RC_API_IMMUTABLE_HANDLE
*/
int setResourceCreate(int value) {
return flom_handle_set_resource_create(&handle, value); }
/**
* Get "resource idle lifespan" property: it specifies how many
* milliseconds a resource will be kept after the last locker released
* it; the expiration is necessary to avoid useless resource
* allocation.
* The current value can be altered using method
* @ref setResourceIdleLifespan.
* @return the current value
*/
int getResourceIdleLifespan() {
return flom_handle_get_resource_idle_lifespan(&handle); }
/**
* Set "resource idle lifespan" property: it specifies how many
* milliseconds a resource will be kept after the last locker released
* it; the expiration is necessary to avoid useless resource
* allocation.
* The current value can be inspected using method
* @ref getResourceIdleLifespan.
* @param value (Input): the new value
* @return @ref FLOM_RC_OK or @ref FLOM_RC_API_IMMUTABLE_HANDLE
*/
int setResourceIdleLifespan(int value) {
return flom_handle_set_resource_idle_lifespan(&handle, value); }
/**
* Get the resource name: the name of the resource that can be locked
* and unlocked using @ref lock and @ref unlock methods.
* The current value can be altered using method @ref setResourceName.
* @return the current value as a null terminated C string
*/
const char *getResourceNameAsCStr() {
return flom_handle_get_resource_name(&handle); }
/**
* Get the resource name: the name of the resource that can be locked
* and unlocked using @ref lock and @ref unlock methods.
* The current value can be altered using method @ref setResourceName.
* @return the current value as a C++ standard string
*/
string getResourceName() {
return NULL != flom_handle_get_resource_name(&handle) ?
flom_handle_get_resource_name(&handle) : ""; }
/**
* Set the resource name: the name of the resource that can be locked
* and unlocked using @ref lock and @ref unlock methods.
* The current value can be inspected using method
* @ref getResourceName.
* NOTE: the resource type is determined by its name; take a look to
* flom command man page (-r, --resource-name option) for an
* explanation of the resource name grammar.
* @param value (Input): the new value (C null terminated string)
* @return @ref FLOM_RC_OK or @ref FLOM_RC_API_IMMUTABLE_HANDLE
*/
int setResourceName(const char *value) {
return flom_handle_set_resource_name(&handle, value); }
/**
* Set the resource name: the name of the resource that can be locked
* and unlocked using @ref lock and @ref unlock methods.
* The current value can be inspected using method
* @ref getResourceName.
* NOTE: the resource type is determined by its name; take a look to
* flom command man page (-r, --resource-name option) for an
* explanation of the resource name grammar.
* @param value (Input): the new value (C++ standard string)
* @return a reason code (see file @ref flom_errors.h)
* @return @ref FLOM_RC_OK or @ref FLOM_RC_API_IMMUTABLE_HANDLE
*/
int setResourceName(const string &value) {
return flom_handle_set_resource_name(&handle, value.c_str()); }
/**
* Get "resource quantity" property: the number of units that will be
* locked and unlocked using @ref lock and @ref unlock methods.
* The current value can be altered using method
* @ref setResourceQuantity.
* NOTE: this property applies to "numeric resources" only.
* @return the current value
*/
int getResourceQuantity() {
return flom_handle_get_resource_quantity(&handle); }
/**
* Set "resource quantity" property: the number of units that will be
* locked and unlocked using @ref lock and @ref unlock methods.
* The current value can be inspected using method
* @ref getResourceQuantity.
* NOTE: this property applies to "numeric resources" only.
* @param value (Input): the new value
* @return @ref FLOM_RC_OK or @ref FLOM_RC_API_IMMUTABLE_HANDLE
*/
int setResourceQuantity(int value) {
return flom_handle_set_resource_quantity(&handle, value); }
/**
* Get "resource timeout" property: how long a lock operation
* (see @ref lock) will wait if the resource is locked
* by another requester.
* The current value can be altered using method
* @ref setResourceTimeout.
* @return the current value: <BR>
* 0: no wait <BR>
* >0: maximum number of milliseconds to wait <BR>
* <0: unlimited wait
*/
int getResourceTimeout() {
return flom_handle_get_resource_timeout(&handle); }
/**
* Set "resource timeout" property: how long a lock operation
* (see @ref lock) will wait if the resource is locked
* by another requester.
* The current value can be inspected using method
* @ref getResourceTimeout.
* @param value (Input): the new value: <BR>
* 0: no wait <BR>
* >0: maximum number of milliseconds to wait <BR>
* <0: unlimited wait
* @return @ref FLOM_RC_OK or @ref FLOM_RC_API_IMMUTABLE_HANDLE
*/
int setResourceTimeout(int value) {
return flom_handle_set_resource_timeout(&handle, value); }
/**
* Get the socket name: the AF_LOCAL/AF_UNIX socket name that must be
* used to contact a local FLoM daemon (server).
* The current value can be altered using method @ref setSocketName.
* @return the current value as a C null terminated string
*/
const char *getSocketNameAsCStr() {
return flom_handle_get_socket_name(&handle); }
/**
* Get the socket name: the AF_LOCAL/AF_UNIX socket name that must be
* used to contact a local FLoM daemon (server).
* The current value can be altered using method @ref setSocketName.
* @return the current value as a C++ standard string
*/
string getSocketName() {
return NULL != flom_handle_get_socket_name(&handle) ?
flom_handle_get_socket_name(&handle) : ""; }
/**
* Set the socket name: the AF_LOCAL/AF_UNIX socket name that must be
* used to contact a local FLoM daemon (server).
* The current value can be inspected using method @ref getSocketName.
* @param value (Input): the new value (C null terminated string)
* @return a reason code (see file @ref flom_errors.h)
*/
int setSocketName(const char *value) {
return flom_handle_set_socket_name(&handle, value); }
/**
* Set the socket name: the AF_LOCAL/AF_UNIX socket name that must be
* used to contact a local FLoM daemon (server).
* The current value can be inspected using method @ref getSocketName.
* @param value (Input): the new value (C++ standard string)
* @return a reason code (see file @ref flom_errors.h)
*/
int setSocketName(const string &value) {
return flom_handle_set_socket_name(&handle, value.c_str()); }
/**
* Get the trace filename: the name (absolute or relative path) used
* by libflom (FLoM client library) to record trace messages.
* The current value can be altered using method @ref setTraceFilename.
* @return the current value as a C null terminated string
*/
const char *getTraceFilenameAsCStr() {
return flom_handle_get_trace_filename(&handle); }
/**
* Get the trace filename: the name (absolute or relative path) used
* by libflom (FLoM client library) to record trace messages.
* The current value can be altered using method @ref setTraceFilename.
* @return the current value as a C++ standard string
*/
string getTraceFilename() {
return NULL != flom_handle_get_trace_filename(&handle) ?
flom_handle_get_trace_filename(&handle) : ""; }
/**
* Set the trace filename: the name (absolute or relative path) used
* by libflom (FLoM client library) to record trace messages.
* The current value can be inspected using method
* @ref getTraceFilename.
* @param value (Input): the new value (C null terminated string)
* @return @ref FLOM_RC_OK
*/
int setTraceFilename(const char *value) {
return flom_handle_set_trace_filename(&handle, value); }
/**
* Set the trace filename: the name (absolute or relative path) used
* by libflom (FLoM client library) to record trace messages.
* The current value can be inspected using method
* @ref getTraceFilename.
* @param value (Input): the new value (C++ standard string)
* @return @ref FLOM_RC_OK
*/
int setTraceFilename(const string &value) {
return flom_handle_set_trace_filename(&handle, value.c_str()); }
/**
* Get the unicast address: the IP address (or a network name that the
* system can resolve) of the host that must be contacted
* to reach FLoM daemon (server) using TCP/IP; see also
* @ref getUnicastPort.
* The current value can be altered using method
* @ref setUnicastAddress.
* @return the current value as a C null terminated string
*/
const char *getUnicastAddressAsCStr() {
return flom_handle_get_unicast_address(&handle); }
/**
* Get the unicast address: the IP address (or a network name that the
* system can resolve) of the host that must be contacted
* to reach FLoM daemon (server) using TCP/IP; see also
* @ref getUnicastPort.
* The current value can be altered using method
* @ref setUnicastAddress.
* @return the current value as a C++ standard string
*/
string getUnicastAddress() {
return NULL != flom_handle_get_unicast_address(&handle) ?
flom_handle_get_unicast_address(&handle) : ""; }
/**
* Set the unicast address: the IP address (or a network name that the
* system can resolve) of the host that must be contacted
* to reach FLoM daemon (server) using TCP/IP; see also
* @ref setUnicastPort.
* The current value can be inspected using method
* @ref getUnicastAddress.
* @param value (Input): the new value (C null terminted string)
* @return @ref FLOM_RC_OK or @ref FLOM_RC_API_IMMUTABLE_HANDLE
*/
int setUnicastAddress(const char *value) {
return flom_handle_set_unicast_address(&handle, value); }
/**
* Set the unicast address: the IP address (or a network name that the
* system can resolve) of the host that must be contacted
* to reach FLoM daemon (server) using TCP/IP; see also
* @ref setUnicastPort.
* The current value can be inspected using method
* @ref getUnicastAddress.
* @param value (Input): the new value (C++ standard string)
* @return @ref FLOM_RC_OK or @ref FLOM_RC_API_IMMUTABLE_HANDLE
*/
int setUnicastAddress(const string &value) {
return flom_handle_set_unicast_address(&handle, value.c_str()); }
/**
* Get the TCP/IP unicast port that must be used to contact the FLoM
* daemon (server) using TCP/IP; see also @ref getUnicastAddress.
* The current value can be altered using method @ref setUnicastPort.
* @return the current value
*/
int getUnicastPort() {
return flom_handle_get_unicast_port(&handle); }
/**
* Set the TCP/IP unicast port that must be used to contact the FLoM
* daemon (server) using TCP/IP; see also @ref setUnicastAddress.
* The current value can be inspected using method @ref getUnicastPort.
* @param value (Input): the new value
* @return @ref FLOM_RC_OK or @ref FLOM_RC_API_IMMUTABLE_HANDLE
*/
int setUnicastPort(int value) {
return flom_handle_set_unicast_port(&handle, value); }
/**
* Get the TLS certificate file name.
* The current value can be altered using method
* @ref setTlsCertificate.
* @return the current value as a C null terminated string
*/
const char *getTlsCertificateAsCStr() {
return flom_handle_get_tls_certificate(&handle); }
/**
* Get the TLS certificate file name.
* The current value can be altered using method
* @ref setTlsCertificate.
* @return the current value as a C++ standard string
*/
string getTlsCertificate() {
return NULL != flom_handle_get_tls_certificate(&handle) ?
flom_handle_get_tls_certificate(&handle) : ""; }
/**
* Set the TLS certificate name.
* The current value can be inspected using method
* @ref getTlsCertificate.
* @param value (Input): the new value (C null terminted string)
* @return @ref FLOM_RC_OK or @ref FLOM_RC_API_IMMUTABLE_HANDLE
*/
int setTlsCertificate(const char *value) {
return flom_handle_set_tls_certificate(&handle, value); }
/**
* Set the TLS certificate name.
* The current value can be inspected using method
* @ref getTlsCertificate.
* @param value (Input): the new value (C++ standard string)
* @return @ref FLOM_RC_OK or @ref FLOM_RC_API_IMMUTABLE_HANDLE
*/
int setTlsCertificate(const string &value) {
return flom_handle_set_tls_certificate(&handle, value.c_str()); }
/**
* Get the TLS private key file name.
* The current value can be altered using method
* @ref setTlsPrivateKey.
* @return the current value as a C null terminated string
*/
const char *getTlsPrivateKeyAsCStr() {
return flom_handle_get_tls_private_key(&handle); }
/**
* Get the TLS private key file name.
* The current value can be altered using method
* @ref setTlsPrivateKey.
* @return the current value as a C++ standard string
*/
string getTlsPrivateKey() {
return NULL != flom_handle_get_tls_private_key(&handle) ?
flom_handle_get_tls_private_key(&handle) : ""; }
/**
* Set the TLS private key name.
* The current value can be inspected using method
* @ref getTlsPrivateKey.
* @param value (Input): the new value (C null terminted string)
* @return @ref FLOM_RC_OK or @ref FLOM_RC_API_IMMUTABLE_HANDLE
*/
int setTlsPrivateKey(const char *value) {
return flom_handle_set_tls_private_key(&handle, value); }
/**
* Set the TLS private key name.
* The current value can be inspected using method
* @ref getTlsPrivateKey.
* @param value (Input): the new value (C++ standard string)
* @return @ref FLOM_RC_OK or @ref FLOM_RC_API_IMMUTABLE_HANDLE
*/
int setTlsPrivateKey(const string &value) {
return flom_handle_set_tls_private_key(&handle, value.c_str()); }
/**
* Get the TLS CA certificate file name.
* The current value can be altered using method
* @ref setTlsCaCertificate.
* @return the current value as a C null terminated string
*/
const char *getTlsCaCertificateAsCStr() {
return flom_handle_get_tls_ca_certificate(&handle); }
/**
* Get the TLS CA certificate file name.
* The current value can be altered using method
* @ref setTlsCaCertificate.
* @return the current value as a C++ standard string
*/
string getTlsCaCertificate() {
return NULL != flom_handle_get_tls_ca_certificate(&handle) ?
flom_handle_get_tls_ca_certificate(&handle) : ""; }
/**
* Set the TLS CA certificate name.
* The current value can be inspected using method
* @ref getTlsCaCertificate.
* @param value (Input): the new value (C null terminted string)
* @return @ref FLOM_RC_OK or @ref FLOM_RC_API_IMMUTABLE_HANDLE
*/
int setTlsCaCertificate(const char *value) {
return flom_handle_set_tls_ca_certificate(&handle, value); }
/**
* Set the TLS CA certificate name.
* The current value can be inspected using method
* @ref getTlsCaCertificate.
* @param value (Input): the new value (C++ standard string)
* @return @ref FLOM_RC_OK or @ref FLOM_RC_API_IMMUTABLE_HANDLE
*/
int setTlsCaCertificate(const string &value) {
return flom_handle_set_tls_ca_certificate(
&handle, value.c_str()); }
/**
* Get "TLS check peer ID" boolean property
* The current value can be altered using method
* @ref setTlsCheckPeerId.
* @return the current value
*/
int getTlsCheckPeerId() {
return flom_handle_get_tls_check_peer_id(&handle); }
/**
* Set "TLS check peer ID" boolean property
* The current value can be inspected using method
* @ref getTlsCheckPeerId.
* @param value (Input): the new value
* @return @ref FLOM_RC_OK or @ref FLOM_RC_API_IMMUTABLE_HANDLE
*/
int setTlsCheckPeerId(int value) {
return flom_handle_set_tls_check_peer_id(&handle, value); }
}; /* class FlomHandle */
} /* namespace flom */
#endif /* FLOMHANDLE_HH */