OnixS C++ CME iLink 3 Binary Order Entry Handler  1.18.0
API Documentation
TcpDirectAttr.h
Go to the documentation of this file.
1 /*
2  * Copyright Onix Solutions Limited [OnixS]. All rights reserved.
3  *
4  * This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
5  * and international copyright treaties.
6  *
7  * Access to and use of the software is governed by the terms of the applicable OnixS Software
8  * Services Agreement (the Agreement) and Customer end user license agreements granting
9  * a non-assignable, non-transferable and non-exclusive license to use the software
10  * for it's own data processing purposes under the terms defined in the Agreement.
11  *
12  * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
13  * of this source code or associated reference material to any other location for further reproduction
14  * or redistribution, and any amendments to this copyright notice, are expressly prohibited.
15  *
16  * Any reproduction or redistribution for sale or hiring of the Software not in accordance with
17  * the terms of the Agreement is a violation of copyright law.
18  */
19 
20 #pragma once
21 
22 #include <OnixS/CME/iLink3/ABI.h>
23 
24 #include <string>
25 #include <stdint.h>
26 
27 namespace OnixS {
28 namespace CME {
29 namespace iLink3 {
30 
31 // Forward declarations
32 class TcpDirectStack;
33 
34 /**
35 * TCPDirect Attributes to pass configuration details (a wrapper around the `zf_attr` struct).
36 *
37 * The default values for attributes may be overridden by setting the
38 * environment variable `ZF_ATTR`. For example:
39 *
40 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.sh}
41 * ZF_ATTR="interface=enp4s0f0;log_level=3;reactor_spin_count=1"
42 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43 */
45 {
46 public:
47  /** Allocates an attribute object.
48  *
49  * \throws std::bad_alloc if memory could not be allocated.
50  * \throws std::runtime_error if the `ZF_ATTR` environment variable is malformed.
51  */
52  TcpDirectAttr();
53 
54  ~TcpDirectAttr();
55 
56  TcpDirectAttr(const TcpDirectAttr & other);
57 
58  TcpDirectAttr & operator=(const TcpDirectAttr & other);
59 
60  /** Gets a string attribute.
61  *
62  * \param name Name of the attribute.
63  *
64  * \throws std::logic_error If @p name is not a valid attribute name or if @p name does not have a string type.
65  */
66  std::string getString(const std::string & name);
67 
68  /** Sets the attribute to the given value.
69  *
70  * \param name Name of the attribute.
71  * \param value New value for the attribute (may be NULL).
72  *
73  * \throws std::logic_error If @p name is not a valid attribute name or if the attribute is not a string attribute.
74  */
75  void set(const std::string & name, const std::string & value);
76 
77  /** Gets an integer attribute.
78  *
79  * \param name Name of the attribute.
80  *
81  * \throws std::logic_error If @p name is not a valid attribute name or if @p name does not have an integer type.
82  */
83  int64_t getInt(const std::string & name);
84 
85  /** Sets the attribute to the given value.
86  *
87  * \param name Name of the attribute.
88  * \param value New value for the attribute.
89  *
90  * \throws std::logic_error If @p name is not a valid attribute name.
91  * \throws std::domain_error If @p value is not within the range of values this attribute can take.
92  */
93  void set(const std::string & name, uint64_t value);
94 
95 private:
96  class Impl;
97  Impl * const impl_;
98 
99  friend class TcpDirectStack;
100 };
101 
102 }
103 }
104 }
A high-level wrapper over the TCPDirect network stack.
Definition: Defines.h:40
#define ONIXS_ILINK3_EXPORTED
Definition: Compiler.h:175
TCPDirect Attributes to pass configuration details (a wrapper around the zf_attr struct).
Definition: TcpDirectAttr.h:44