NetBurner 3.1
serialrecord.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 
28 #ifndef _SERIAL_RECORD_H_
29 #define _SERIAL_RECORD_H_
30 #pragma once
31 
32 #include <basictypes.h>
33 #include <buffers.h>
34 #include <iosys.h>
35 #include <nettypes.h>
36 #include <system.h>
37 
38 #include "nbfactory.h"
39 #include "serialburnerdata.h"
40 
46 {
47  /*
48  * Data
49  */
50  // File descriptor of serial port
51  int FD_SerialPort;
52 
53  // File descriptor of listening socket
54  int FD_ListeningSocket;
55 
56  // File descriptor of connected socket
57  int FD_ConnectedSocket;
58 
59  // TRUE if we established the connection
60  BOOL bWeInitiatedConnection;
61 
62  // Time of last network sourced data in seconds since last boot
63  DWORD LastNetWorkDataRxed;
64 
65  // Time of last transmitted data in seconds since last boot
66  DWORD LastNetWorkDataTxed;
67 
68  // Time of last attempted outgoing connection in seconds since last boot
69  DWORD LastConnectTry;
70 
71  BOOL bSerialBoundDataBlocked;
72  BOOL bNetWorkBoundDataBlocked;
73 
74  // Circular buffer from serial port to network
75  char Buffer_From_S2N[ BUFFER_SIZE ];
76  int Buf_S2N_Start;
77  int Buf_S2N_End;
78 
79  // Circular buffer from network to serial port
80  char Buffer_From_N2S[ BUFFER_SIZE ];
81  int Buf_N2S_Start;
82  int Buf_N2S_End;
83 
84  IPADDR LearnedUdp;
85  int RxBufferCount;
86  int port_index; // A global PortRecord array will be declared
87  int uart_num; // Physical UART number
88  int conn_try;
89 
90  // Flag verification and tick time-stamping for keep-alive implementation
91  BOOL tcpKeepAliveSent;
92  DWORD tcpLastRxTicks;
93  DWORD tcpkeepAliveTicks;
94 
98  void AssignUartNumber( void );
99 
100  void ProcessUdpSerialRead( void );
101  void ProcessUdpRead( void );
102  void ProcessUdpTxTo( void );
103  void SetUdpReadFD( fd_set& fd_rd );
104 
105  void SetTcpFDs( fd_set& fd_rd, fd_set& fd_wr, fd_set& fd_err );
106  void ProcessTcpFDs( fd_set& fd_rd, fd_set& fd_wr, fd_set& fd_err );
107  void ProcessTCPReadSerialData( void );
109 
111  void ProcessSpecialFrameWriteTimeout( void );
112  void MakeTcpConnection( void );
113 
114  #ifdef SB700EX
115  void TestDSR( void );
116  void TestCD( void );
117  #endif // SB700EX
118 
119  void SendSerialMessage( const char* msg );
120  int SerialBreakWrite( char* start, int len );
121  void CloseListenPort( void );
122  void MakeUdpConnection( void );
123  BOOL OkToListen( void );
124  void ProcessTimeouts( void );
125  void ProcessAccept( void );
126  void OpenSerialPort( void );
127  void ProcessReadNetworkData( void );
128  void OpenListenPort( void );
129  void ProcessWriteNetworkData( void );
130  void ProcessWriteSerialData( void );
131 
132  void ProcessSerialError( void );
133  void ProcessListenError( void );
134  void ProcessNetworkError( void );
135  void EnableATCommands();
136  void DisableATCommands();
137  void GetCurrentChannelStatus( char* buffer );
138 };
139 
140 #endif
NetBurner I/O System Library API.
void ProcessSerialError(void)
Definition: serialrecord.cpp:1303
void ProcessSpecialFrameTCPReadSerialData(void)
Definition: serialrecord.cpp:1790
void ProcessTimeouts(void)
Definition: serialrecord.cpp:757
void GetCurrentChannelStatus(char *buffer)
Definition: serialrecord.cpp:109
Used to hold and manipulate IPv4 and IPv6 addresses in dual stack mode.
Definition: ipv6_addr.h:28
void OpenSerialPort(void)
Definition: serialrecord.cpp:1439
void MakeTcpConnection(void)
Definition: serialrecord.cpp:488
BOOL OkToListen(void)
Definition: serialrecord.cpp:730
void MakeUdpConnection(void)
Definition: serialrecord.cpp:681
void ProcessSpecialFrameWriteNetworkData(void)
Definition: serialrecord.cpp:1935
void ProcessListenError(void)
Definition: serialrecord.cpp:1316
void ProcessSpecialFrameWriteTimeout(void)
Definition: serialrecord.cpp:1947
void OpenListenPort(void)
Definition: serialrecord.cpp:400
void CloseListenPort(void)
Definition: serialrecord.cpp:418
void ProcessTCPReadSerialData(void)
Definition: serialrecord.cpp:1001
void AssignUartNumber(void)
Definition: serialrecord.cpp:1380
void ProcessNetworkError(void)
Definition: serialrecord.cpp:1335
Definition: serialrecord.h:45
void ProcessReadNetworkData(void)
Definition: serialrecord.cpp:1117
NetBurner System Functions.
void ProcessWriteSerialData(void)
Definition: serialrecord.cpp:1263
NetBurner Buffers API.
void ProcessAccept(void)
Definition: serialrecord.cpp:900
void ProcessWriteNetworkData(void)
Definition: serialrecord.cpp:1199