summaryrefslogtreecommitdiffstats
path: root/Master/Masterarbeit/src/common/inc/protocol.h
blob: e3e21ef38028061e657e0c2dfbc6e1fc6879fed1 (plain)
1
2
3
4
5
6
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
/*!
 * \file protocol.h
 * \author S. Eisenhauer
 * \date 31.08.2011
 * \brief Network protocol definition
 *
 * This file defines the network protocol used between XORAYA Connect and CanEasy
 *
 */
#ifndef PROTOCOL_H_SEI
#define PROTOCOL_H_SEI

#include <boost/array.hpp>
#include "global.h"

/// default IP of the XORAYA connect
#define nDEFAULT_IP         _T("192.168.1.214")

/// network port for communication
#define nPORT				(7010)

/// size of network buffers in bytes
#define nNETWORK_BUFFSIZE	(512)

/*!
 * \brief type definition for network data buffer
 */
typedef boost::array<uint8_t,nNETWORK_BUFFSIZE> tNetworkBuffer;

/*!
 * \brief Enumeration of Network message types
 */
enum tenNetworkMessageType
{
    nenReqStartPlugin //!< Request for starting a target plugin
    ,nenReqStopPlugin //!< Request for stopping a target plugin
    ,nenReqShutdown //!< Request for shutting down all target components
    ,nenReqImportLog //!< Request for importing a log file
    ,nenReqEnumerateLogs //!< Request for enumerating available log files
    ,nenReqEnumerateInterfaces //!< Request for enumerating hardware interfaces
    ,nenReqChangeMsgData //!< Request for changing the data of a CAN TX message
    ,nenReqUploadLogMsg //!< Request with log data
    ,nenRespStartPlugin //!< Response for a start plugin request
    ,nenRespStopPlugin //!< Response for a stop plugin request
    ,nenRespShutdown //!< Response for a shutdown request
    ,nenRespImportLog //!< Response for a import log request
    ,nenRespEnumerateLogs //!< Response for a enumerate logs request
    ,nenRespEnumerateInterfaces //!< Response for a enumerate interfaces request
    ,nenRespChangeMsgData //!< Response for a change message data request
    ,nenRespUploadLogMsg //!< Response for a upload log request
    ,nenRespUnknownReq //!< Response for a unknown request
    ,nenRespInvalidArg //!< Response for a request with invalid arguments
    ,nenNumberOfNetworkMessageTypes //!< must be last
};

/*!
 * \brief structure of network message header
 */
struct tstNetworkMessageHeader
{
	tenNetworkMessageType enMessageType; //!< type of the message
	uint32_t u32MessageLength; //!< total length of network message. less or equal nNETWORK_BUFFSIZE
};

/// maximum length of the data part in a network message
/// data size = message size - header size
#define nNETWORK_DATALENGTH (nNETWORK_BUFFSIZE - sizeof(tstNetworkMessageHeader))


#endif /* PROTOCOL_H_SEI */