NetBurner 3.5.6
PDF Version
i2cserver.h
1
/*NB_REVISION*/
2
3
/*NB_COPYRIGHT*/
4
5
#ifndef _I2CSERVER_H_
6
#define _I2CSERVER_H_
7
8
#include <nettypes.h>
9
10
#define TCP_LISTEN_PORT 23
// Telnet port number
11
#define FDNET_RX_BUFSIZE 1024
12
#define MAX_CMD_LEN 1024
// Maximum command buffer length
13
#define BEGIN_CMD_CHAR '#'
14
#define END_CMD_CHAR_LF '\n'
15
#define END_CMD_CHAR_CR '\r'
16
#define EOT_CHAR 4
17
#define MENU_CHAR '?'
18
19
#define BEGIN_CMD_CHARS 1
// represented by '#'
20
#define END_CMD_CHARS 1
// represented by '\n'
21
#define CMD_CHARS 2
// represented by the two cmd chars, ex: WA, WB, etc
22
#define NON_PARAM_CHARS BEGIN_CMD_CHARS + END_CMD_CHARS + CMD_CHARS
23
#define FDNET_READ_CHARS 1
24
#define MAX_FDNET_READ_CHARS 8
25
26
// Character count for each command. Used for verifying the correct input
27
#define WR_PARAM_CHARS 4
// 2 address chars + 2 data chars
28
#define WA_PARAM_CHARS 6
// 2 address chars + 2 data chars + 2 length chars
29
#define WW_PARAM_CHARS 4
// 2 address chars + 2 length chars, need to add data seperately
30
#define WB_PARAM_CHARS 4
// 2 address chars + 2 data chars
31
#define RB_PARAM_CHARS 2
// 2 address chars
32
#define RR_PARAM_CHARS 4
// 2 address chars + 2 length chars
33
#define SE_PARAM_CHARS 2
// 2 new address chars
34
#define SV_PARAM_CHARS 2
// 2 new address chars
35
#define ST_PARAM_CHARS 0
// no parameters required
36
#define RE_PARAM_CHARS 0
// no parameters required
37
#define SC_PARAM_CHARS 0
// no parameters required
38
#define TM_PARAM_CHARS 0
// no parameters required
39
40
extern
const
char
*statusMsgs[];
41
42
#ifdef __cplusplus
43
extern
"C"
44
{
45
#endif
46
47
void
checkCmdBuf(
char
*cmdBuf);
48
bool
checkCmdLength(
char
*cmdBuf,
int
cmdParamChars);
49
bool
checkEndCmdChar(
char
*cmdBuf,
int
nTotalBytesRead,
int
nBytesRead);
50
bool
checkEOTChar(
int
nTotalBytesRead,
int
&nBytesRead);
51
bool
checkMenuChar(
char
*cmdBuf,
int
nTotalBytesRead,
volatile
int
&nBytesRead);
52
void
checkRXBuffer(
int
nTotalBytesRead,
int
nBytesRead);
53
bool
checkStartCmdChar(
char
*cmdBuf,
int
nTotalBytesRead,
int
nBytesRead);
54
void
IPtoString(
IPADDR
ia,
char
*s);
55
void
MainMenu(
int
fdnet);
56
void
I2CServerTask(
void
*pd);
57
bool
parseTelnetInput(
char
*cmdBuf,
int
nTotalBytesRead,
int
&nBytesRead);
58
void
printI2CStatusErrorMsg();
59
int
processCmd(
int
fdnet,
char
*cmdBuf);
60
unsigned
char
processI2CAddress(
char
*cmdBuf,
unsigned
char
*asciiBuf);
61
unsigned
char
processI2CDataByte(
char
*cmdBuf,
unsigned
char
*asciiBuf);
62
bool
processI2CReadLength(
char
*cmdBuf,
unsigned
char
*asciiBuf,
unsigned
char
&length);
63
bool
processI2CWriteLength(
char
*cmdBuf,
unsigned
char
*asciiBuf,
unsigned
char
&length);
64
unsigned
char
processWR(
int
fdnet,
char
*cmdBuf);
65
unsigned
char
processWA(
int
fdnet,
char
*cmdBuf);
66
unsigned
char
processWW(
int
fdnet,
char
*cmdBuf);
67
unsigned
char
processWB(
int
fdnet,
char
*cmdBuf);
68
unsigned
char
processRB(
int
fdnet,
char
*cmdBuf);
69
unsigned
char
processRR(
int
fdnet,
char
*cmdBuf);
70
unsigned
char
processSE(
int
fdnet,
char
*cmdBuf);
71
unsigned
char
processSV(
int
fdnet,
char
*cmdBuf);
72
unsigned
char
processST(
int
fdnet,
char
*cmdBuf);
73
unsigned
char
processRE(
int
fdnet,
char
*cmdBuf);
74
unsigned
char
processSC(
int
fdnet,
char
*cmdBuf);
75
void
storeCmdChars(
char
*cmdBuf,
int
nTotalBytesRead,
int
nBytesRead);
76
77
#ifdef __cplusplus
78
}
79
#endif
80
81
#endif
// _TCPSERVER_H_
IPADDR6
Used to hold and manipulate IPv4 and IPv6 addresses in dual stack mode.
Definition
ipv6_addr.h:41