summaryrefslogtreecommitdiffstats
path: root/src/device/protocol_device_private.h
blob: 0fb46c7f3039be2015062847babceb30cc9a8387 (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
#ifndef PROTOCOL_DEVICE_PRIVATE_H
#define PROTOCOL_DEVICE_PRIVATE_H

#define MAX_PACKET_SIZE_OUT     (64)
#define MAX_PACKET_SIZE_IN	(512)
#define MAX_CONNECTIONS		(1UL)

/**
 * Device's view of connection to daemon.
 */
struct connection_t {
        /**
	 * Initially 0, non-zero when connection is open, 0 when connection
	 * is closed again.
	 */
        int is_live;

        /** Daemon IP adress */
        IPAddress address;

        /** Time last packet was reveived */
        time_t last_packet_sec;

        /** Incoming packet buffer */
        char inp_buf[MAX_PACKET_SIZE_IN];

        /** Incoming packet cursor */
        size_t inp_crs;

        /** Outgoing packet buffer */
        char outp_buf[MAX_PACKET_SIZE_OUT];

        /** Outgoing packet cursor */
        size_t outp_crs;
};

#endif /* PROTOCOL_DEVICE_PRIVATE_H */