NetBurner 3.5.6
PDF Version
tftp_server.h
1/*NB_REVISION*/
2
3/*NB_COPYRIGHT*/
4
15#ifndef _NB_TFTP_SERVER
16#define _NB_TFTP_SERVER
17
18#include <config_server.h>
19#include <servlets.h>
20#include <nettimer.h>
21#include <nbstring.h>
22
23
31class TFTP_active_Records;
33
39class TFTP_Server: public servlet, public TimeOutElement
40{
41 int udp_fd;
42 uint16_t m_port;
43 TFTP_active_Records * m_pRecords;
44 TFTP_Server_source_File * m_pSources;
45
46 protected:
47 //Servlet virtual functions
48 virtual int AddToSelectSet(fd_set &rd_set, fd_set &wr_set, fd_set &er_set);
49 virtual void ProcessSelectResult(fd_set &rd_set, fd_set &wr_set, fd_set &er_set);
50 //Timeout element virtual function
51 virtual void TimeElementEvent();
52
53 public:
59 TFTP_Server( uint16_t port = 69 );
60
67
68 friend class TFTP_active_Records;
69};
70
71
78{
79 TFTP_Server_source_File * pNext_file;
80 NBString m_fname;
81 const uint8_t *pData;
82 uint32_t len;
83
84 public:
85 virtual int GetNextChunk(uint32_t offset, uint32_t max_len, puint8_t destbuffer);
86 //Returns the chunk size, any thing less than requested means end of file.
87 TFTP_Server_source_File(TFTP_Server & server,const char * fname, const uint8_t * buf, uint32_t len);
88
89 friend class TFTP_Server;
90 friend class TFTP_active_Records;
91};
92
93#endif
94
Lightweight alternative to C++ CString class.
Definition nbstring.h:118
TFTP Server Source File.
Definition tftp_server.h:78
TFTP Server Class.
Definition tftp_server.h:40
TFTP_Server(uint16_t port=69)
TFTP server constructor.
void Add(TFTP_Server_source_File &sf)
Specify TFTP Server listen port number, default is 69.