Newer
Older
#include "LibItsBtp_EncdecDeclarations.hh"
namespace LibItsBtp__EncdecDeclarations {
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
/****************************************************
* @desc External function to encode a BtpPayload type
* @param value to encode
* @return encoded value
****************************************************/
BITSTRING fx__enc__BtpPayload(const LibItsBtp__TypesAndValues::BtpPayload& p)
{
return int2bit(0,8);
}
/****************************************************
* @desc External function to decode a BtpPayload type
* @param value to encode
* @return encoded value
****************************************************/
/* TODO RGy function not implemented! (decvalue() not used by test suite @29-06-2016)
INTEGER fx__dec__BtpPayload(BITSTRING& b, LibItsBtp__TypesAndValues::BtpPayload& p)
{
return -1;
}
*/
/****************************************************
* @desc External function to encode a BtpReq type
* @param value to encode
* @return encoded value
****************************************************/
BITSTRING fx__enc__BtpReq(LibItsBtp__TestSystem::BtpReq const& p_btpReq)
{
loggers::get_instance().log_msg(">>> fx__enc__BtpReq: ", p_btpReq);
BTPCodec codec;
OCTETSTRING os;
if (codec.encode(p_btpReq.msgOut(), os) == -1) {
loggers::get_instance().warning("fx__enc__BtpReq: -1 result code was returned");
return int2bit(0, 1);
}
return oct2bit(os);
}
/****************************************************
* @desc External function to decode a BtpReq type
* @param value to encode
* @return encoded value
****************************************************/
INTEGER fx__dec__BtpReq(BITSTRING& b, LibItsBtp__TestSystem::BtpReq& p)
{
loggers::get_instance().log(">>> fx__dec__BtpReq");
BTPCodec codec;
LibItsBtp__TypesAndValues::BtpPacket pdu;
OCTETSTRING is = bit2oct(b);
if (codec.decode(is, pdu) == -1) {
loggers::get_instance().warning("fx__dec__BtpReq: -1 result code was returned");
return -1;
}
p.msgOut() = pdu;
return 0;
}
/****************************************************
* @desc External function to encode a BtpInd type
* @param value to encode
* @return encoded value
****************************************************/
BITSTRING fx__enc__BtpInd(LibItsBtp__TestSystem::BtpInd const& p_btpInd)
{
loggers::get_instance().log_msg(">>> fx__enc__BtpInd: ", p_btpInd);
BTPCodec codec;
OCTETSTRING os;
if (codec.encode(p_btpInd.msgIn(), os) == -1) {
loggers::get_instance().warning("fx__enc__BtpInd: -1 result code was returned");
return int2bit(0, 1);
}
return oct2bit(os);
}
/****************************************************
* @desc External function to decode a BtpInd type
* @param value to encode
* @return encoded value
****************************************************/
INTEGER fx__dec__BtpInd(BITSTRING& b, LibItsBtp__TestSystem::BtpInd& p_btpInd)
{
loggers::get_instance().log(">>> fx__dec__BtpInd");
BTPCodec codec;
LibItsBtp__TypesAndValues::BtpPacket pdu;
OCTETSTRING is = bit2oct(b);
// Calculate the size of the lower layers information
if (codec.decode(is, pdu) == -1) {
loggers::get_instance().warning("fx__dec__BtpInd: -1 result code was returned");
return -1;
}
p_btpInd.msgIn() = pdu;
loggers::get_instance().log_msg("<<< fx__dec__BtpInd: ", p_btpInd);
return 0;
}
/****************************************************
* @desc External function to encode a BtpPacket type
* @param value to encode
* @return encoded value
****************************************************/
BITSTRING fx__enc__BtpPacket(LibItsBtp__TypesAndValues::BtpPacket const& p_btpPacket)
{
loggers::get_instance().log_msg(">>> fx__enc__BtpPacket: ", p_btpPacket);
BTPCodec codec;
OCTETSTRING os;
codec.encode(p_btpPacket, os);
return oct2bit(os);
}
/****************************************************
* @desc External function to decode a BtpPacket type
* @param value to encode
* @return encoded value
****************************************************/
INTEGER fx__dec__BtpPacket(BITSTRING& b, LibItsBtp__TypesAndValues::BtpPacket& p_btpPacket)
{
loggers::get_instance().log(">>> fx__dec__BtpPacket");
BTPCodec codec;
OCTETSTRING is = bit2oct(b);
if (codec.decode(is, p_btpPacket) == -1) {
loggers::get_instance().warning("fx__dec__BtpPacket: -1 result code was returned");
return -1;
}
return 0;
}