/**

    MIT License

    Copyright (c) 2015 Eugene Grobbelaar (email : koh.jaen@yahoo.de)

    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in all
    copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    SOFTWARE.

*/

#pragma once
#include "basetypes.h"

namespace XKoJen
{
    /** IMsgReceiver is an interface that receives full messages (only knowing sMsgHeader), but still in a byte stream (i.e. it doesnt know of the particular protocol).
        The base implementation of IConnection, who knows how to handle sMsgHeader based messages in bytestreams,
        uses this to pass full messages to autogenerated handlers who know of the protocol.
    */
    class KOJEN_API IMsgReceiver
    {
    public:
        /// Full messages will be passed here.
        virtual void OnMessageReceived( const uint8* data_buffer, const uint32& number_of_bytes ) = 0;

        /// Preamble, i.e. the identify word of message start / marker in the byte stream
        virtual uint16 Preamble() const = 0;

#ifdef __arm__
        /// ARM only : 	PC based message handling accepts messages with array types -> which means that
        ///				there is dynamic memory handling, and that the connection buffers also are dynamic

        /// For safety : generated specific interface receivers will return the largest message byte count.
        virtual uint16 LargestMessageSize() = 0;
#endif
    };
}