/usr/include/odil/message/Message.h is in libodil0-dev 0.4.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | /*************************************************************************
* odil - Copyright (C) Universite de Strasbourg
* Distributed under the terms of the CeCILL-B license, as published by
* the CEA-CNRS-INRIA. Refer to the LICENSE file or to
* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
* for details.
************************************************************************/
#ifndef _dcfa5213_ad7e_4194_8b4b_e630aa0df2e8
#define _dcfa5213_ad7e_4194_8b4b_e630aa0df2e8
#include "odil/DataSet.h"
#include "odil/registry.h"
#include "odil/Value.h"
namespace odil
{
namespace message
{
#define ODIL_MESSAGE_MANDATORY_FIELD_MACRO(name, tag, TValueType, function) \
/** @brief Return the tag element of the command set. */ \
TValueType const & get_##name() const \
{ \
auto const & data = this->_command_set.function(tag); \
if(data.empty()) \
{ \
throw Exception("Empty element"); \
} \
return data[0]; \
} \
/** @brief Set the tag element of the command set. */ \
void set_##name(TValueType const & value) \
{ \
if(!this->_command_set.has(tag)) \
{ \
this->_command_set.add(tag); \
} \
this->_command_set.function(tag) = { value }; \
}
#define ODIL_MESSAGE_OPTIONAL_FIELD_MACRO(name, tag, TValueType, function) \
ODIL_MESSAGE_MANDATORY_FIELD_MACRO(name, tag, TValueType, function) \
bool has_##name() const \
{ \
return this->_command_set.has(tag);; \
} \
void delete_##name() \
{ \
this->_command_set.remove(tag); \
}
#define ODIL_MESSAGE_SET_OPTIONAL_FIELD_MACRO(dataset, name, tag, function) \
if(dataset.has(tag)) \
{ \
this->set_##name(dataset.function(tag, 0)); \
}
#define ODIL_MESSAGE_MANDATORY_FIELD_INTEGER_MACRO(name, tag) \
ODIL_MESSAGE_MANDATORY_FIELD_MACRO(name, tag, Value::Integer, as_int)
#define ODIL_MESSAGE_MANDATORY_FIELD_STRING_MACRO(name, tag) \
ODIL_MESSAGE_MANDATORY_FIELD_MACRO(name, tag, Value::String, as_string)
#define ODIL_MESSAGE_OPTIONAL_FIELD_INTEGER_MACRO(name, tag) \
ODIL_MESSAGE_OPTIONAL_FIELD_MACRO(name, tag, Value::Integer, as_int)
#define ODIL_MESSAGE_OPTIONAL_FIELD_STRING_MACRO(name, tag) \
ODIL_MESSAGE_OPTIONAL_FIELD_MACRO(name, tag, Value::String, as_string)
/**
* @brief Base class for all DIMSE messages.
*/
class Message
{
public:
struct Command
{
enum Type
{
C_STORE_RQ = 0x0001,
C_STORE_RSP = 0x8001,
C_FIND_RQ = 0x0020,
C_FIND_RSP = 0x8020,
C_CANCEL_RQ = 0x0FFF,
C_GET_RQ = 0x0010,
C_GET_RSP = 0x8010,
C_MOVE_RQ = 0x0021,
C_MOVE_RSP = 0x8021,
C_ECHO_RQ = 0x0030,
C_ECHO_RSP = 0x8030,
N_EVENT_REPORT_RQ = 0x0100,
N_EVENT_REPORT_RSP = 0x8100,
N_GET_RQ = 0x0110,
N_GET_RSP = 0x8110,
N_SET_RQ = 0x0120,
N_SET_RSP = 0x8120,
N_ACTION_RQ = 0x0130,
N_ACTION_RSP = 0x8130,
N_CREATE_RQ = 0x0140,
N_CREATE_RSP = 0x8140,
N_DELETE_RQ = 0x0150,
N_DELETE_RSP = 0x8150,
};
};
struct Priority
{
enum Type
{
LOW = 0x0002,
MEDIUM = 0x0000,
HIGH = 0x0001,
};
};
struct DataSetType
{
enum Type
{
PRESENT = 0x0000,
ABSENT = 0x0101,
};
};
/// @brief Create a message with an empty command set and an empty data set.
Message();
/// @brief Create a message from existing data.
Message(DataSet const & command_set);
/// @brief Create a message from existing data.
Message(DataSet const & command_set, DataSet const & data_set);
/// @brief Destructor;
virtual ~Message();
/// @brief Return the command set of the message.
DataSet const & get_command_set() const;
/// @brief Test whether as data set is present in the message.
bool has_data_set() const;
/**
* @brief Return the data set of the message, raise an exception if no
* data set is present.
*/
DataSet const & get_data_set() const;
/// @brief Set the data set of the message.
void set_data_set(DataSet const & data_set);
/// @brief Delete the data set in this message.
void delete_data_set();
ODIL_MESSAGE_MANDATORY_FIELD_INTEGER_MACRO(
command_field, registry::CommandField)
protected:
/// @brief Command set of the message.
DataSet _command_set;
/// @brief Data set of the message.
DataSet _data_set;
};
}
}
#endif // _dcfa5213_ad7e_4194_8b4b_e630aa0df2e8
|