- Moved linux specific TCP implementation to a seperate folder and removed it from default build. Does not yet build correctly if you want that.

- Fixed conversion warnings from <some integer> type to uint32_t, which happens a lot around here. This is no functional change, just making it explicit so the compiler doesn't warn.
This commit is contained in:
Aart Stuurman 2018-01-23 16:47:53 +01:00
parent b25bd583a3
commit 001dfaa7e0
55 changed files with 189 additions and 227 deletions

2
.gitignore vendored
View File

@ -13,3 +13,5 @@
*.la
*.a
*.a.*
/build
/.vscode

View File

@ -1,10 +1,9 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.1)
project(amqpcpp)
# ensure c++11 on all compilers
include(set_cxx_norm.cmake)
set_cxx_norm (${CXX_NORM_CXX11})
set (CMAKE_CXX_STANDARD 11)
macro (add_sources)
file (RELATIVE_PATH _relPath "${PROJECT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
@ -22,7 +21,9 @@ macro (add_sources)
endmacro()
add_subdirectory(src)
add_subdirectory(include)
if(AMQPCPP_BUILD_TCP)
add_subdirectory(src/tcpconnection)
endif()
option(BUILD_SHARED "build shared library" OFF)

View File

@ -72,6 +72,3 @@
#include <amqpcpp/connectionhandler.h>
#include <amqpcpp/connectionimpl.h>
#include <amqpcpp/connection.h>
#include <amqpcpp/tcphandler.h>
#include <amqpcpp/tcpconnection.h>
#include <amqpcpp/tcpchannel.h>

View File

@ -1,54 +0,0 @@
add_sources(
address.h
addresses.h
array.h
booleanset.h
buffer.h
bytebuffer.h
callbacks.h
channel.h
channelimpl.h
classes.h
connection.h
connectionhandler.h
connectionimpl.h
copiedbuffer.h
decimalfield.h
deferred.h
deferredcancel.h
deferredconsumer.h
deferredconsumerbase.h
deferreddelete.h
deferredget.h
deferredqueue.h
endian.h
entityimpl.h
envelope.h
exception.h
exchangetype.h
field.h
fieldproxy.h
flags.h
frame.h
libboostasio.h
libev.h
libevent.h
libuv.h
login.h
message.h
metadata.h
monitor.h
numericfield.h
outbuffer.h
protocolexception.h
receivedframe.h
stack_ptr.h
stringfield.h
table.h
tcpchannel.h
tcpconnection.h
tcpdefines.h
tcphandler.h
watchable.h
)

View File

@ -21,6 +21,7 @@
#include "envelope.h"
#include <limits>
#include <stdexcept>
#include <algorithm>
/**
* Set up namespace

View File

@ -302,20 +302,20 @@ public:
// the result (2 for the two boolean sets)
uint32_t result = 2;
if (hasExpiration()) result += _expiration.size();
if (hasReplyTo()) result += _replyTo.size();
if (hasCorrelationID()) result += _correlationID.size();
if (hasPriority()) result += _priority.size();
if (hasDeliveryMode()) result += _deliveryMode.size();
if (hasHeaders()) result += _headers.size();
if (hasContentEncoding()) result += _contentEncoding.size();
if (hasContentType()) result += _contentType.size();
if (hasClusterID()) result += _clusterID.size();
if (hasAppID()) result += _appID.size();
if (hasUserID()) result += _userID.size();
if (hasTypeName()) result += _typeName.size();
if (hasTimestamp()) result += _timestamp.size();
if (hasMessageID()) result += _messageID.size();
if (hasExpiration()) result += (uint32_t)_expiration.size();
if (hasReplyTo()) result += (uint32_t)_replyTo.size();
if (hasCorrelationID()) result += (uint32_t)_correlationID.size();
if (hasPriority()) result += (uint32_t)_priority.size();
if (hasDeliveryMode()) result += (uint32_t)_deliveryMode.size();
if (hasHeaders()) result += (uint32_t)_headers.size();
if (hasContentEncoding()) result += (uint32_t)_contentEncoding.size();
if (hasContentType()) result += (uint32_t)_contentType.size();
if (hasClusterID()) result += (uint32_t)_clusterID.size();
if (hasAppID()) result += (uint32_t)_appID.size();
if (hasUserID()) result += (uint32_t)_userID.size();
if (hasTypeName()) result += (uint32_t)_typeName.size();
if (hasTimestamp()) result += (uint32_t)_timestamp.size();
if (hasMessageID()) result += (uint32_t)_messageID.size();
// done
return result;

View File

@ -42,6 +42,8 @@ private:
T _value;
public:
using Type = T;
/**
* Default constructor, assign 0
*/
@ -116,14 +118,14 @@ public:
* Get the value
* @return mixed
*/
operator uint8_t () const override { return _value; }
operator uint16_t() const override { return _value; }
operator uint32_t() const override { return _value; }
operator uint64_t() const override { return _value; }
operator int8_t () const override { return _value; }
operator int16_t () const override { return _value; }
operator int32_t () const override { return _value; }
operator int64_t () const override { return _value; }
operator uint8_t () const override { return (uint8_t)_value; }
operator uint16_t() const override { return (uint16_t)_value; }
operator uint32_t() const override { return (uint32_t)_value; }
operator uint64_t() const override { return (uint64_t)_value; }
operator int8_t () const override { return (int8_t)_value; }
operator int16_t () const override { return (int16_t)_value; }
operator int32_t () const override { return (int32_t)_value; }
operator int64_t () const override { return (int64_t)_value; }
/**
* Get the value

View File

@ -119,7 +119,7 @@ public:
virtual size_t size() const override
{
// find out size of the size parameter
T size(_data.size());
T size((T::Type)_data.size());
// size of the uint8 or uint32 + the actual string size
return size.size() + _data.size();
@ -160,7 +160,7 @@ public:
virtual void fill(OutBuffer& buffer) const override
{
// create size
T size(_data.size());
T size((T::Type)_data.size());
// first, write down the size of the string
size.fill(buffer);

1
src/.gitignore vendored
View File

@ -1 +0,0 @@
*.d

View File

@ -1,100 +1,14 @@
add_sources(
addressinfo.h
array.cpp
basicackframe.h
basiccancelframe.h
basiccancelokframe.h
basicconsumeframe.h
basicconsumeokframe.h
basicdeliverframe.h
basicframe.h
basicgetemptyframe.h
basicgetframe.h
basicgetokframe.h
basicheaderframe.h
basicnackframe.h
basicpublishframe.h
basicqosframe.h
basicqosokframe.h
basicrecoverasyncframe.h
basicrecoverframe.h
basicrecoverokframe.h
basicrejectframe.h
basicreturnframe.h
bodyframe.h
channelcloseframe.h
channelcloseokframe.h
channelflowframe.h
channelflowokframe.h
channelframe.h
channelimpl.cpp
channelopenframe.h
channelopenokframe.h
connectioncloseframe.h
connectioncloseokframe.h
connectionframe.h
connectionimpl.cpp
connectionopenframe.h
connectionopenokframe.h
connectionsecureframe.h
connectionsecureokframe.h
connectionstartframe.h
connectionstartokframe.h
connectiontuneframe.h
connectiontuneokframe.h
consumedmessage.h
deferredcancel.cpp
deferredconsumer.cpp
deferredconsumerbase.cpp
deferredget.cpp
exchangebindframe.h
exchangebindokframe.h
exchangedeclareframe.h
exchangedeclareokframe.h
exchangedeleteframe.h
exchangedeleteokframe.h
exchangeframe.h
exchangeunbindframe.h
exchangeunbindokframe.h
extframe.h
field.cpp
flags.cpp
framecheck.h
headerframe.h
heartbeatframe.h
includes.h
methodframe.h
passthroughbuffer.h
pipe.h
protocolheaderframe.h
queuebindframe.h
queuebindokframe.h
queuedeclareframe.h
queuedeclareokframe.h
queuedeleteframe.h
queuedeleteokframe.h
queueframe.h
queuepurgeframe.h
queuepurgeokframe.h
queueunbindframe.h
queueunbindokframe.h
receivedframe.cpp
reducedbuffer.h
returnedmessage.h
table.cpp
tcpclosed.h
tcpconnected.h
tcpconnection.cpp
tcpinbuffer.h
tcpoutbuffer.h
tcpresolver.h
tcpstate.h
transactioncommitframe.h
transactioncommitokframe.h
transactionframe.h
transactionrollbackframe.h
transactionrollbackokframe.h
transactionselectframe.h
transactionselectokframe.h
watchable.cpp
array.cpp
channelimpl.cpp
connectionimpl.cpp
deferredcancel.cpp
deferredconsumer.cpp
deferredconsumerbase.cpp
deferredget.cpp
field.cpp
flags.cpp
receivedframe.cpp
table.cpp
watchable.cpp
)

View File

@ -29,7 +29,7 @@ Array::Array(ReceivedFrame &frame)
if (!field) continue;
// less bytes to read
charsToRead -= field->size();
charsToRead -= (uint32_t)field->size();
// add the additional field
_fields.push_back(std::shared_ptr<Field>(field));
@ -76,7 +76,7 @@ const Field &Array::get(uint8_t index) const
*/
uint32_t Array::count() const
{
return _fields.size();
return (uint32_t)_fields.size();
}
/**

View File

@ -59,7 +59,7 @@ public:
* @param noWait whether to wait for a response.
*/
BasicCancelFrame(uint16_t channel, const std::string& consumerTag, bool noWait = false) :
BasicFrame(channel, consumerTag.size() + 2), // 1 for extra string size, 1 for bool
BasicFrame(channel, (uint32_t)(consumerTag.size() + 2)), // 1 for extra string size, 1 for bool
_consumerTag(consumerTag),
_noWait(noWait) {}

View File

@ -53,7 +53,7 @@ public:
* @param consumerTag holds the consumertag specified by client or server
*/
BasicCancelOKFrame(uint16_t channel, std::string& consumerTag) :
BasicFrame(channel, consumerTag.length() + 1), // add 1 byte for encoding the size of consumer tag
BasicFrame(channel, (uint32_t)(consumerTag.length() + 1)), // add 1 byte for encoding the size of consumer tag
_consumerTag(consumerTag)
{}

View File

@ -86,7 +86,7 @@ public:
* @param filter additional arguments
*/
BasicConsumeFrame(uint16_t channel, const std::string& queueName, const std::string& consumerTag, bool noLocal = false, bool noAck = false, bool exclusive = false, bool noWait = false, const Table& filter = {}) :
BasicFrame(channel, (queueName.length() + consumerTag.length() + 5 + filter.size())), // size of vars, +1 for each shortstring size, +1 for bools, +2 for deprecated value
BasicFrame(channel, (uint32_t)(queueName.length() + consumerTag.length() + 5 + filter.size())), // size of vars, +1 for each shortstring size, +1 for bools, +2 for deprecated value
_queueName(queueName),
_consumerTag(consumerTag),
_bools(noLocal, noAck, exclusive, noWait),

View File

@ -43,7 +43,7 @@ public:
* @param consumerTag consumertag specified by client of provided by server
*/
BasicConsumeOKFrame(uint16_t channel, const std::string& consumerTag) :
BasicFrame(channel, consumerTag.length() + 1), // length of string + 1 for encoding of stringsize
BasicFrame(channel, (uint32_t)(consumerTag.length() + 1)), // length of string + 1 for encoding of stringsize
_consumerTag(consumerTag)
{}

View File

@ -87,7 +87,7 @@ public:
* @param routingKey message routing key
*/
BasicDeliverFrame(uint16_t channel, const std::string& consumerTag, uint64_t deliveryTag, bool redelivered = false, const std::string& exchange = "", const std::string& routingKey = "") :
BasicFrame(channel, (consumerTag.length() + exchange.length() + routingKey.length() + 12)),
BasicFrame(channel, (uint32_t)(consumerTag.length() + exchange.length() + routingKey.length() + 12)),
// length of strings + 1 byte per string for stringsize, 8 bytes for uint64_t and 1 for bools
_consumerTag(consumerTag),
_deliveryTag(deliveryTag),

View File

@ -59,7 +59,7 @@ public:
* @param noAck whether server expects acknowledgements for messages
*/
BasicGetFrame(uint16_t channel, const std::string& queue, bool noAck = false) :
BasicFrame(channel, queue.length() + 4), // 1 for bool, 1 for string size, 2 for deprecated field
BasicFrame(channel, (uint32_t)(queue.length() + 4)), // 1 for bool, 1 for string size, 2 for deprecated field
_queue(queue),
_noAck(noAck)
{}

View File

@ -76,7 +76,7 @@ public:
* @param messageCount number of messages in the queue
*/
BasicGetOKFrame(uint16_t channel, uint64_t deliveryTag, bool redelivered, const std::string& exchange, const std::string& routingKey, uint32_t messageCount) :
BasicFrame(channel, (exchange.length() + routingKey.length() + 15)), // string length, +1 for each shortsrting length + 8 (uint64_t) + 4 (uint32_t) + 1 (bool)
BasicFrame(channel, (uint32_t)(exchange.length() + routingKey.length() + 15)), // string length, +1 for each shortsrting length + 8 (uint64_t) + 4 (uint32_t) + 1 (bool)
_deliveryTag(deliveryTag),
_redelivered(redelivered),
_exchange(exchange),

View File

@ -70,7 +70,7 @@ public:
* @param immediate request immediate delivery @default = false
*/
BasicPublishFrame(uint16_t channel, const std::string& exchange = "", const std::string& routingKey = "", bool mandatory = false, bool immediate = false) :
BasicFrame(channel, exchange.length() + routingKey.length() + 5), // 1 extra per string (for the size), 1 for bools, 2 for deprecated field
BasicFrame(channel, (uint32_t)(exchange.length() + routingKey.length() + 5)), // 1 extra per string (for the size), 1 for bools, 2 for deprecated field
_exchange(exchange),
_routingKey(routingKey),
_bools(mandatory, immediate)

View File

@ -67,7 +67,7 @@ public:
* @param routingKey message routing key
*/
BasicReturnFrame(uint16_t channel, int16_t replyCode, const std::string& replyText = "", const std::string& exchange = "", const std::string& routingKey = "") :
BasicFrame(channel, replyText.length() + exchange.length() + routingKey.length() + 5), // 3 for each string (extra size byte), 2 for uint16_t
BasicFrame(channel, (uint32_t)(replyText.length() + exchange.length() + routingKey.length() + 5)), // 3 for each string (extra size byte), 2 for uint16_t
_replyCode(replyCode),
_replyText(replyText),
_exchange(exchange),

View File

@ -82,7 +82,7 @@ public:
* @param failingMethod failing method id if applicable
*/
ChannelCloseFrame(uint16_t channel, uint16_t code = 0, const std::string& text = "", uint16_t failingClass = 0, uint16_t failingMethod = 0) :
ChannelFrame(channel, (text.length() + 7)), // sizeof code, failingclass, failingmethod (2byte + 2byte + 2byte) + text length + text length byte
ChannelFrame(channel, (uint32_t)(text.length() + 7)), // sizeof code, failingclass, failingmethod (2byte + 2byte + 2byte) + text length + text length byte
_code(code),
_text(text),
_failingClass(failingClass),

View File

@ -481,7 +481,7 @@ bool ChannelImpl::publish(const std::string &exchange, const std::string &routin
uint64_t chunksize = std::min(static_cast<uint64_t>(maxpayload), bytesleft);
// send out a body frame
if (!send(BodyFrame(_id, data + bytessent, chunksize))) return false;
if (!send(BodyFrame(_id, data + bytessent, (uint32_t)chunksize))) return false;
// channel still valid?
if (!monitor.valid()) return false;

View File

@ -82,7 +82,7 @@ public:
* @param failingMethod id of the failing method if applicable
*/
ConnectionCloseFrame(uint16_t code, const std::string &text, uint16_t failingClass = 0, uint16_t failingMethod = 0) :
ConnectionFrame(text.length() + 7), // 1 for extra string byte, 2 for each uint16
ConnectionFrame((uint32_t)(text.length() + 7)), // 1 for extra string byte, 2 for each uint16
_code(code),
_text(text),
_failingClass(failingClass),

View File

@ -146,7 +146,7 @@ uint64_t ConnectionImpl::parse(const Buffer &buffer)
// have the initial bytes of the header, we already know how much
// data we need for the next frame, otherwise we need at least 7
// bytes for processing the header of the next frame
_expected = receivedFrame.header() ? receivedFrame.totalSize() : 7;
_expected = receivedFrame.header() ? (uint32_t)receivedFrame.totalSize() : 7;
// we're ready for now
return processed;

View File

@ -60,7 +60,7 @@ public:
* @param vhost name of virtual host to open
*/
ConnectionOpenFrame(const std::string &vhost) :
ConnectionFrame(vhost.length() + 3), // length of vhost + byte to encode this length + deprecated shortstring size + deprecated bool
ConnectionFrame((uint32_t)(vhost.length() + 3)), // length of vhost + byte to encode this length + deprecated shortstring size + deprecated bool
_vhost(vhost),
_deprecatedCapabilities(""),
_deprecatedInsist()

View File

@ -43,7 +43,7 @@ public:
* @param challenge the challenge
*/
ConnectionSecureFrame(const std::string& challenge) :
ConnectionFrame(challenge.length() + 4), // 4 for the length of the challenge (uint32_t)
ConnectionFrame((uint32_t)(challenge.length() + 4)), // 4 for the length of the challenge (uint32_t)
_challenge(challenge)
{}

View File

@ -43,7 +43,7 @@ public:
* @param response the challenge response
*/
ConnectionSecureOKFrame(const std::string& response) :
ConnectionFrame(response.length() + 4), //response length + uint32_t for encoding the length
ConnectionFrame((uint32_t)(response.length() + 4)), //response length + uint32_t for encoding the length
_response(response)
{}

View File

@ -81,7 +81,7 @@ public:
* @param locales available locales
*/
ConnectionStartFrame(uint8_t major, uint8_t minor, const Table& properties, const std::string& mechanisms, const std::string& locales) :
ConnectionFrame((properties.size() + mechanisms.length() + locales.length() + 10)), // 4 for each longstring (size-uint32), 2 major/minor
ConnectionFrame((uint32_t)(properties.size() + mechanisms.length() + locales.length() + 10)), // 4 for each longstring (size-uint32), 2 major/minor
_major(major),
_minor(minor),
_properties(properties),

View File

@ -82,7 +82,7 @@ public:
* @param locale selected locale.
*/
ConnectionStartOKFrame(const Table& properties, const std::string& mechanism, const std::string& response, const std::string& locale) :
ConnectionFrame((properties.size() + mechanism.length() + response.length() + locale.length() + 6)), // 1 byte extra per shortstring, 4 per longstring
ConnectionFrame((uint32_t)(properties.size() + mechanism.length() + response.length() + locale.length() + 6)), // 1 byte extra per shortstring, 4 per longstring
_properties(properties),
_mechanism(mechanism),
_response(response),

View File

@ -95,7 +95,7 @@ public:
* @param arguments
*/
ExchangeBindFrame(uint16_t channel, const std::string &destination, const std::string &source, const std::string &routingKey, bool noWait, const Table &arguments) :
ExchangeFrame(channel, (destination.length() + source.length() + routingKey.length() + arguments.size() + 6)), // 1 for each string, 1 for booleanset, 2 for deprecated field
ExchangeFrame(channel, (uint32_t)(destination.length() + source.length() + routingKey.length() + arguments.size() + 6)), // 1 for each string, 1 for booleanset, 2 for deprecated field
_destination(destination),
_source(source),
_routingKey(routingKey),

View File

@ -81,7 +81,7 @@ public:
* @param arguments additional arguments
*/
ExchangeDeclareFrame(uint16_t channel, const std::string& name, const std::string& type, bool passive, bool durable, bool noWait, const Table& arguments) :
ExchangeFrame(channel, (name.length() + type.length() + arguments.size() + 5)), // size of name, type and arguments + 1 (all booleans are stored in 1 byte) + 2 (deprecated short) + 2 (string sizes)
ExchangeFrame(channel, (uint32_t)(name.length() + type.length() + arguments.size() + 5)), // size of name, type and arguments + 1 (all booleans are stored in 1 byte) + 2 (deprecated short) + 2 (string sizes)
_name(name),
_type(type),
_bools(passive, durable, false, false, noWait),

View File

@ -73,7 +73,7 @@ public:
* @param bool noWait Do not wait for a response
*/
ExchangeDeleteFrame(uint16_t channel, const std::string& name, bool ifUnused = false, bool noWait = false) :
ExchangeFrame(channel, name.length() + 4), // length of the name, 1 byte for encoding this length, 1 for bools, 2 for deprecated short
ExchangeFrame(channel, (uint32_t)(name.length() + 4)), // length of the name, 1 byte for encoding this length, 1 for bools, 2 for deprecated short
_name(name),
_bools(ifUnused, noWait)
{}

View File

@ -95,7 +95,7 @@ public:
* @param arguments
*/
ExchangeUnbindFrame(uint16_t channel, const std::string &destination, const std::string &source, const std::string &routingKey, bool noWait, const Table &arguments) :
ExchangeFrame(channel, (destination.length() + source.length() + routingKey.length() + arguments.size() + 6)), // 1 for each string, 1 for booleanset, 2 for deprecated field
ExchangeFrame(channel, (uint32_t)(destination.length() + source.length() + routingKey.length() + arguments.size() + 6)), // 1 for each string, 1 for booleanset, 2 for deprecated field
_destination(destination),
_source(source),
_routingKey(routingKey),

View File

@ -50,7 +50,7 @@ public:
virtual ~FrameCheck()
{
// update the number of bytes to skip
_frame->_skip += _size;
_frame->_skip += (uint32_t)_size;
}
};

View File

@ -9,7 +9,7 @@
// c and c++ dependencies
#include <stdlib.h>
#include <string.h>
#include <string.h> // TODO cstring
#include <stdint.h>
#include <string>
#include <memory>
@ -21,14 +21,19 @@
#include <unordered_map>
#include <vector>
#include <queue>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <unistd.h>
#include <netinet/tcp.h>
#include <sys/types.h> // TODO is this needed
#include <functional>
#include <stdexcept>
// TODO make this nice
#ifdef _MSC_VER
//not #if defined(_WIN32) || defined(_WIN64) because we have strncasecmp in mingw
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#endif
// forward declarations
#include "../include/classes.h"
@ -41,7 +46,6 @@
#include "../include/copiedbuffer.h"
#include "../include/watchable.h"
#include "../include/monitor.h"
#include "../include/tcpdefines.h"
// amqp types
#include "../include/field.h"
@ -75,8 +79,6 @@
#include "../include/connectionhandler.h"
#include "../include/connectionimpl.h"
#include "../include/connection.h"
#include "../include/tcphandler.h"
#include "../include/tcpconnection.h"
// classes that are very commonly used
#include "../include/exception.h"
@ -91,6 +93,5 @@
#include "queueframe.h"
#include "basicframe.h"
#include "transactionframe.h"
#include "addressinfo.h"

View File

@ -87,7 +87,7 @@ public:
* @param Table arguments additional arguments
*/
QueueBindFrame(uint16_t channel, const std::string& name, const std::string& exchange, const std::string& routingKey = "", bool noWait = false, const Table& arguments = {}) :
QueueFrame(channel, (name.length() + exchange.length() + routingKey.length() + arguments.size() + 6) ), // 3 extra per string, 1 for bools, 2 for deprecated field
QueueFrame(channel, (uint32_t)(name.length() + exchange.length() + routingKey.length() + arguments.size() + 6) ), // 3 extra per string, 1 for bools, 2 for deprecated field
_name(name),
_exchange(exchange),
_routingKey(routingKey),

View File

@ -80,7 +80,7 @@ public:
* @param Table arguments additional arguments, implementation dependent
*/
QueueDeclareFrame(uint16_t channel, const std::string& name = "", bool passive = false, bool durable = false, bool exclusive = false, bool autoDelete = false, bool noWait = false, const Table& arguments = {}) :
QueueFrame(channel, (name.length() + arguments.size() + 4 ) ), // 1 extra for string size, 1 for bools, 2 for deprecated value
QueueFrame(channel, (uint32_t)(name.length() + arguments.size() + 4 ) ), // 1 extra for string size, 1 for bools, 2 for deprecated value
_name(name),
_bools(passive, durable, exclusive, autoDelete, noWait),
_arguments(arguments)

View File

@ -62,7 +62,7 @@ public:
* @param failingMethod failing method id if applicable
*/
QueueDeclareOKFrame(uint16_t channel, const std::string& name, int32_t messageCount, int32_t consumerCount) :
QueueFrame(channel, name.length() + 9), // 4 per int, 1 for string size
QueueFrame(channel, (uint32_t)(name.length() + 9)), // 4 per int, 1 for string size
_name(name),
_messageCount(messageCount),
_consumerCount(consumerCount)

View File

@ -69,7 +69,7 @@ public:
* @param noWait do not wait on response
*/
QueueDeleteFrame(uint16_t channel, const std::string& name, bool ifUnused = false, bool ifEmpty = false, bool noWait = false) :
QueueFrame(channel, name.length() + 4), // 1 for string length, 1 for bools, 2 for deprecated field
QueueFrame(channel, (uint32_t)(name.length() + 4)), // 1 for string length, 1 for bools, 2 for deprecated field
_name(name),
_bools(ifUnused, ifEmpty, noWait)
{}

View File

@ -65,7 +65,7 @@ public:
* @return newly created Queuepurgeframe
*/
QueuePurgeFrame(uint16_t channel, const std::string& name, bool noWait = false) :
QueueFrame(channel, name.length() + 4), // 1 extra for string length, 1 for bool, 2 for deprecated field
QueueFrame(channel, (uint32_t)(name.length() + 4)), // 1 extra for string length, 1 for bool, 2 for deprecated field
_name(name),
_noWait(noWait)
{}

View File

@ -80,7 +80,7 @@ public:
* @param arguments additional arguments, implementation dependant.
*/
QueueUnbindFrame(uint16_t channel, const std::string& name, const std::string& exchange, const std::string& routingKey = "", const Table& arguments = {} ) :
QueueFrame(channel, (name.length() + exchange.length() + routingKey.length() + arguments.size() + 5) ), // 1 per string, 2 for deprecated field
QueueFrame(channel, (uint32_t)(name.length() + exchange.length() + routingKey.length() + arguments.size() + 5) ), // 1 per string, 2 for deprecated field
_name(name),
_exchange(exchange),
_routingKey(routingKey),

View File

@ -21,7 +21,7 @@ Table::Table(ReceivedFrame &frame)
ShortString name(frame);
// subtract number of bytes to read, plus one byte for the decoded type
bytesToRead -= (name.size() + 1);
bytesToRead -= (uint32_t)(name.size() + 1);
// get the field
Field *field = Field::decode(frame);
@ -31,7 +31,7 @@ Table::Table(ReceivedFrame &frame)
_fields[name] = std::shared_ptr<Field>(field);
// subtract size
bytesToRead -= field->size();
bytesToRead -= (uint32_t)field->size();
}
}

View File

@ -0,0 +1,3 @@
add_sources(
tcpconnection.cpp
)

View File

@ -0,0 +1,96 @@
/**
* Includes.h
*
* The includes that are necessary to compile the AMQP library
* This file also holds includes that may not be necessary for including the library
*
* @documentation private
*/
// c and c++ dependencies
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <string>
#include <memory>
#include <limits>
#include <ostream>
#include <math.h>
#include <map>
#include <algorithm>
#include <unordered_map>
#include <vector>
#include <queue>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <unistd.h>
#include <netinet/tcp.h>
#include <functional>
#include <stdexcept>
// forward declarations
#include "../include/classes.h"
// utility classes
#include "../include/endian.h"
#include "../include/buffer.h"
#include "../include/bytebuffer.h"
#include "../include/receivedframe.h"
#include "../include/outbuffer.h"
#include "../include/copiedbuffer.h"
#include "../include/watchable.h"
#include "../include/monitor.h"
#include "../include/tcpdefines.h"
// amqp types
#include "../include/field.h"
#include "../include/numericfield.h"
#include "../include/decimalfield.h"
#include "../include/stringfield.h"
#include "../include/booleanset.h"
#include "../include/fieldproxy.h"
#include "../include/table.h"
#include "../include/array.h"
// envelope for publishing and consuming
#include "../include/metadata.h"
#include "../include/envelope.h"
#include "../include/message.h"
// mid level includes
#include "../include/exchangetype.h"
#include "../include/flags.h"
#include "../include/callbacks.h"
#include "../include/deferred.h"
#include "../include/deferredconsumer.h"
#include "../include/deferredqueue.h"
#include "../include/deferreddelete.h"
#include "../include/deferredcancel.h"
#include "../include/deferredget.h"
#include "../include/channelimpl.h"
#include "../include/channel.h"
#include "../include/login.h"
#include "../include/address.h"
#include "../include/connectionhandler.h"
#include "../include/connectionimpl.h"
#include "../include/connection.h"
#include "../include/tcphandler.h"
#include "../include/tcpconnection.h"
// classes that are very commonly used
#include "../include/exception.h"
#include "../include/protocolexception.h"
#include "../include/frame.h"
#include "extframe.h"
#include "methodframe.h"
#include "headerframe.h"
#include "connectionframe.h"
#include "channelframe.h"
#include "exchangeframe.h"
#include "queueframe.h"
#include "basicframe.h"
#include "transactionframe.h"
#include "addressinfo.h"