aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee/include/net/levin_client.inl
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/epee/include/net/levin_client.inl')
-rw-r--r--contrib/epee/include/net/levin_client.inl41
1 files changed, 21 insertions, 20 deletions
diff --git a/contrib/epee/include/net/levin_client.inl b/contrib/epee/include/net/levin_client.inl
index ab7c32c32..a580e81fd 100644
--- a/contrib/epee/include/net/levin_client.inl
+++ b/contrib/epee/include/net/levin_client.inl
@@ -80,10 +80,10 @@ int levin_client_impl::invoke(int command, const std::string& in_buff, std::stri
return -1;
bucket_head head = {0};
- head.m_signature = LEVIN_SIGNATURE;
- head.m_cb = in_buff.size();
+ head.m_signature = SWAP64LE(LEVIN_SIGNATURE);
+ head.m_cb = SWAP64LE(in_buff.size());
head.m_have_to_return_data = true;
- head.m_command = command;
+ head.m_command = SWAP32LE(command);
if(!m_transport.send(&head, sizeof(head)))
return -1;
@@ -97,7 +97,7 @@ int levin_client_impl::invoke(int command, const std::string& in_buff, std::stri
head = *(bucket_head*)local_buff.data();
- if(head.m_signature!=LEVIN_SIGNATURE)
+ if(head.m_signature!=SWAP64LE(LEVIN_SIGNATURE))
{
LOG_PRINT_L1("Signature mismatch in response");
return -1;
@@ -116,10 +116,10 @@ int levin_client_impl::notify(int command, const std::string& in_buff)
return -1;
bucket_head head = {0};
- head.m_signature = LEVIN_SIGNATURE;
- head.m_cb = in_buff.size();
+ head.m_signature = SWAP64LE(LEVIN_SIGNATURE);
+ head.m_cb = SWAP64LE(in_buff.size());
head.m_have_to_return_data = false;
- head.m_command = command;
+ head.m_command = SWAP32LE(command);
if(!m_transport.send((const char*)&head, sizeof(head)))
return -1;
@@ -139,12 +139,13 @@ inline
return -1;
bucket_head2 head = {0};
- head.m_signature = LEVIN_SIGNATURE;
- head.m_cb = in_buff.size();
+ head.m_signature = SWAP64LE(LEVIN_SIGNATURE);
+ head.m_cb = SWAP64LE(in_buff.size());
head.m_have_to_return_data = true;
- head.m_command = command;
- head.m_protocol_version = LEVIN_PROTOCOL_VER_1;
- head.m_flags = LEVIN_PACKET_REQUEST;
+ head.m_command = SWAP32LE(command);
+ head.m_return_code = SWAP32LE(0);
+ head.m_flags = SWAP32LE(LEVIN_PACKET_REQUEST);
+ head.m_protocol_version = SWAP32LE(LEVIN_PROTOCOL_VER_1);
if(!m_transport.send(&head, sizeof(head)))
return -1;
@@ -157,14 +158,13 @@ inline
head = *(bucket_head2*)local_buff.data();
-
- if(head.m_signature!=LEVIN_SIGNATURE)
+ if(head.m_signature != SWAP64LE(LEVIN_SIGNATURE))
{
LOG_PRINT_L1("Signature mismatch in response");
return -1;
}
- if(!m_transport.recv_n(buff_out, head.m_cb))
+ if(!m_transport.recv_n(buff_out, SWAP64LE(head.m_cb)))
return -1;
return head.m_return_code;
@@ -177,12 +177,13 @@ inline
return -1;
bucket_head2 head = {0};
- head.m_signature = LEVIN_SIGNATURE;
- head.m_cb = in_buff.size();
+ head.m_signature = SWAP64LE(LEVIN_SIGNATURE);
+ head.m_cb = SWAP64LE(in_buff.size());
head.m_have_to_return_data = false;
- head.m_command = command;
- head.m_protocol_version = LEVIN_PROTOCOL_VER_1;
- head.m_flags = LEVIN_PACKET_REQUEST;
+ head.m_command = SWAP32LE(command);
+ head.m_return_code = SWAP32LE(0);
+ head.m_flags = SWAP32LE(LEVIN_PACKET_REQUEST);
+ head.m_protocol_version = SWAP32LE(LEVIN_PROTOCOL_VER_1);
if(!m_transport.send((const char*)&head, sizeof(head)))
return -1;