aboutsummaryrefslogtreecommitdiffstats
path: root/ncpd/packet.h
blob: cd025137a3df5379f4bdd363ac67c2f4dc36d771 (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
#ifndef _packet_h
#define _packet_h

#include <stdio.h>

#include "bool.h"
class psiEmul;
class bufferStore;
class IOWatch;

class packet {
	public:
		packet(const char *fname, int baud, IOWatch &iow, bool verbose = false);
		~packet();
		void send(unsigned char type, const bufferStore &b);
		bool get(unsigned char &type, bufferStore &b);
  
	private:
		bool terminated();
		void addToCrc(unsigned short a, unsigned short *crc);
		void opByte(unsigned char a);
		void realWrite();

		unsigned short crcOut;
		unsigned short crcIn;
		unsigned char *inPtr;
		unsigned char *outPtr;
		unsigned char *endPtr;
		unsigned char *inBuffer;
		unsigned char *outBuffer;
		bufferStore rcv;
		int inLen;
		int outLen;
		int termLen;
		int fd;
		bool verbose;
		bool esc;
		char *devname;
		int baud;
		IOWatch &iow;
};

#endif