"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/base/netstring.cpp" between
icinga2-2.11.5.tar.gz and icinga2-2.12.0.tar.gz

About: Icinga 2 is an enterprise grade monitoring system which keeps watch over networks and any conceivable network resource.

netstring.cpp  (icinga2-2.11.5):netstring.cpp  (icinga2-2.12.0)
skipping to change at line 129 skipping to change at line 129
} }
/** /**
* Reads data from a stream in netstring format. * Reads data from a stream in netstring format.
* *
* @param stream The stream to read from. * @param stream The stream to read from.
* @returns The String that has been read from the IOQueue. * @returns The String that has been read from the IOQueue.
* @exception invalid_argument The input stream is invalid. * @exception invalid_argument The input stream is invalid.
* @see https://github.com/PeterScott/netstring-c/blob/master/netstring.c * @see https://github.com/PeterScott/netstring-c/blob/master/netstring.c
*/ */
String NetString::ReadStringFromStream(const std::shared_ptr<AsioTlsStream>& str eam, String NetString::ReadStringFromStream(const Shared<AsioTlsStream>::Ptr& stream,
ssize_t maxMessageLength) ssize_t maxMessageLength)
{ {
namespace asio = boost::asio; namespace asio = boost::asio;
size_t len = 0; size_t len = 0;
bool leadingZero = false; bool leadingZero = false;
for (uint_fast8_t readBytes = 0;; ++readBytes) { for (uint_fast8_t readBytes = 0;; ++readBytes) {
char byte = 0; char byte = 0;
skipping to change at line 208 skipping to change at line 208
} }
/** /**
* Reads data from a stream in netstring format. * Reads data from a stream in netstring format.
* *
* @param stream The stream to read from. * @param stream The stream to read from.
* @returns The String that has been read from the IOQueue. * @returns The String that has been read from the IOQueue.
* @exception invalid_argument The input stream is invalid. * @exception invalid_argument The input stream is invalid.
* @see https://github.com/PeterScott/netstring-c/blob/master/netstring.c * @see https://github.com/PeterScott/netstring-c/blob/master/netstring.c
*/ */
String NetString::ReadStringFromStream(const std::shared_ptr<AsioTlsStream>& str eam, String NetString::ReadStringFromStream(const Shared<AsioTlsStream>::Ptr& stream,
boost::asio::yield_context yc, ssize_t maxMessageLength) boost::asio::yield_context yc, ssize_t maxMessageLength)
{ {
namespace asio = boost::asio; namespace asio = boost::asio;
size_t len = 0; size_t len = 0;
bool leadingZero = false; bool leadingZero = false;
for (uint_fast8_t readBytes = 0;; ++readBytes) { for (uint_fast8_t readBytes = 0;; ++readBytes) {
char byte = 0; char byte = 0;
skipping to change at line 287 skipping to change at line 287
} }
/** /**
* Writes data into a stream using the netstring format and returns bytes writte n. * Writes data into a stream using the netstring format and returns bytes writte n.
* *
* @param stream The stream. * @param stream The stream.
* @param str The String that is to be written. * @param str The String that is to be written.
* *
* @return The amount of bytes written. * @return The amount of bytes written.
*/ */
size_t NetString::WriteStringToStream(const std::shared_ptr<AsioTlsStream>& stre am, const String& str) size_t NetString::WriteStringToStream(const Shared<AsioTlsStream>::Ptr& stream, const String& str)
{ {
namespace asio = boost::asio; namespace asio = boost::asio;
std::ostringstream msgbuf; std::ostringstream msgbuf;
WriteStringToStream(msgbuf, str); WriteStringToStream(msgbuf, str);
String msg = msgbuf.str(); String msg = msgbuf.str();
asio::const_buffer msgBuf (msg.CStr(), msg.GetLength()); asio::const_buffer msgBuf (msg.CStr(), msg.GetLength());
asio::write(*stream, msgBuf); asio::write(*stream, msgBuf);
skipping to change at line 310 skipping to change at line 310
} }
/** /**
* Writes data into a stream using the netstring format and returns bytes writte n. * Writes data into a stream using the netstring format and returns bytes writte n.
* *
* @param stream The stream. * @param stream The stream.
* @param str The String that is to be written. * @param str The String that is to be written.
* *
* @return The amount of bytes written. * @return The amount of bytes written.
*/ */
size_t NetString::WriteStringToStream(const std::shared_ptr<AsioTlsStream>& stre am, const String& str, boost::asio::yield_context yc) size_t NetString::WriteStringToStream(const Shared<AsioTlsStream>::Ptr& stream, const String& str, boost::asio::yield_context yc)
{ {
namespace asio = boost::asio; namespace asio = boost::asio;
std::ostringstream msgbuf; std::ostringstream msgbuf;
WriteStringToStream(msgbuf, str); WriteStringToStream(msgbuf, str);
String msg = msgbuf.str(); String msg = msgbuf.str();
asio::const_buffer msgBuf (msg.CStr(), msg.GetLength()); asio::const_buffer msgBuf (msg.CStr(), msg.GetLength());
asio::async_write(*stream, msgBuf, yc); asio::async_write(*stream, msgBuf, yc);
 End of changes. 4 change blocks. 
4 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)