NetBurner 3.1
tcpserver.h
1
/* Revision: 2.8.7 */
2
3
/******************************************************************************
4
* Copyright 1998-2018 NetBurner, Inc. ALL RIGHTS RESERVED
5
*
6
* Permission is hereby granted to purchasers of NetBurner Hardware to use or
7
* modify this computer program for any use as long as the resultant program
8
* is only executed on NetBurner provided hardware.
9
*
10
* No other rights to use this program or its derivatives in part or in
11
* whole are granted.
12
*
13
* It may be possible to license this or other NetBurner software for use on
14
* non-NetBurner Hardware. Contact sales@Netburner.com for more information.
15
*
16
* NetBurner makes no representation or warranties with respect to the
17
* performance of this computer program, and specifically disclaims any
18
* responsibility for any damages, special or consequential, connected with
19
* the use of this program.
20
*
21
* NetBurner
22
* 5405 Morehouse Dr.
23
* San Diego, CA 92121
24
* www.netburner.com
25
******************************************************************************/
26
27
#ifndef _TCPSERVER_H_
28
#define _TCPSERVER_H_
29
30
#define TCP_LISTEN_PORT 23 // Telnet port number
31
#define FDNET_RX_BUFSIZE 4096
32
#define MAX_CMD_LEN 12//MAX_BUFFER_LEN + 8 // +8 to accommodate for '#', cmds, and '\n'
33
#define BEGIN_CMD_CHAR '#'
34
#define END_CMD_CHAR '\n'
35
#define EOT_CHAR 4
36
#define MENU_CHAR '?'
37
38
#define BEGIN_CMD_CHARS 1 // represented by '#'
39
#define END_CMD_CHARS 1 // represented by '\n'
40
#define CMD_CHARS 2 // represented by the two cmd chars, ex: WA, WB, etc
41
#define NON_PARAM_CHARS BEGIN_CMD_CHARS + END_CMD_CHARS + CMD_CHARS
42
#define FDNET_READ_CHARS 1
43
#define MAX_FDNET_READ_CHARS 8
44
45
// Character count for each command. Used for verifying the correct input
46
#define WR_PARAM_CHARS 4 // 2 address chars + 2 data chars
47
#define WA_PARAM_CHARS 6 // 2 address chars + 2 data chars + 2 length chars
48
#define WW_PARAM_CHARS 4 // 2 address chars + 2 length chars, need to add data seperately
49
#define WB_PARAM_CHARS 4 // 2 address chars + 2 data chars
50
#define RB_PARAM_CHARS 2 // 2 address chars
51
#define RR_PARAM_CHARS 4 // 2 address chars + 2 length chars
52
#define SE_PARAM_CHARS 2 // 2 new address chars
53
#define SV_PARAM_CHARS 2 // 2 new address chars
54
#define ST_PARAM_CHARS 0 // no parameters required
55
#define RE_PARAM_CHARS 0 // no parameters required
56
#define SC_PARAM_CHARS 0 // no parameters required
57
#define TM_PARAM_CHARS 0 // no parameters required
58
59
60
extern
const
char
*statusMsgs[];
61
62
63
#ifdef __cplusplus
64
extern
"C"
65
{
66
#endif
67
68
void
checkCmdBuf(
char
*cmdBuf);
69
bool
checkCmdLength(
char
*cmdBuf,
int
cmdParamChars);
70
bool
checkEndCmdChar(
char
*cmdBuf,
int
nTotalBytesRead,
int
nBytesRead);
71
bool
checkEOTChar(
int
nTotalBytesRead,
int
&nBytesRead);
72
bool
checkMenuChar(
char
*cmdBuf,
int
nTotalBytesRead,
volatile
int
&nBytesRead);
73
void
checkRXBuffer(
int
nTotalBytesRead,
int
nBytesRead);
74
bool
checkStartCmdChar(
char
*cmdBuf,
int
nTotalBytesRead,
int
nBytesRead);
75
void
IPtoString(
IPADDR
ia,
char
*s);
76
void
MainMenu(
int
fdnet);
77
void
TcpServerTask(
void
* pd);
78
bool
parseTelnetInput(
char
*cmdBuf,
int
nTotalBytesRead,
int
&nBytesRead);
79
void
printI2CStatusErrorMsg();
80
int
processCmd(
int
fdnet,
char
* cmdBuf);
81
unsigned
char
processI2CAddress(
char
* cmdBuf,
unsigned
char
*asciiBuf);
82
unsigned
char
processI2CDataByte(
char
*cmdBuf,
unsigned
char
*asciiBuf);
83
bool
processI2CReadLength(
char
*cmdBuf,
unsigned
char
*asciiBuf,
unsigned
char
&length);
84
bool
processI2CWriteLength(
char
*cmdBuf,
unsigned
char
*asciiBuf,
unsigned
char
&length);
85
unsigned
char
processWR(
int
fdnet,
char
* cmdBuf);
86
unsigned
char
processWA(
int
fdnet,
char
* cmdBuf);
87
unsigned
char
processWW(
int
fdnet,
char
* cmdBuf);
88
unsigned
char
processWB(
int
fdnet,
char
* cmdBuf);
89
unsigned
char
processRB(
int
fdnet,
char
* cmdBuf);
90
unsigned
char
processRR(
int
fdnet,
char
* cmdBuf);
91
unsigned
char
processSE(
int
fdnet,
char
* cmdBuf);
92
unsigned
char
processSV(
int
fdnet,
char
* cmdBuf);
93
unsigned
char
processST(
int
fdnet,
char
* cmdBuf);
94
unsigned
char
processRE(
int
fdnet,
char
* cmdBuf);
95
unsigned
char
processSC(
int
fdnet,
char
* cmdBuf);
96
void
storeCmdChars(
char
*cmdBuf,
int
nTotalBytesRead,
int
nBytesRead);
97
98
#ifdef __cplusplus
99
}
100
#endif
101
102
#endif // _TCPSERVER_H_
IPADDR6
Used to hold and manipulate IPv4 and IPv6 addresses in dual stack mode.
Definition:
ipv6_addr.h:28
examples
SSH
SecureSerToEthFactoryApp
tcpserver.h
Generated by
1.8.14