-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtftpserver.h
61 lines (47 loc) · 1.55 KB
/
tftpserver.h
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
* This file is part of PXEDHCP.
* Copyright 2013 A. Douglas Gale
*
* PXEDHCP is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PXEDHCP is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef TFTPSERVER_H
#define TFTPSERVER_H
#include <QObject>
#include <QSettings>
#include <QUdpSocket>
#include <QPair>
#include <QList>
class TFTPServer : public QObject
{
Q_OBJECT
QUdpSocket *listener;
bool failed;
QByteArray readBuffer;
void ParseListenerDatagram(int size, QHostAddress &addr, quint16 port);
QString serverRoot;
public:
explicit TFTPServer(const QString &serverRoot, QObject *parent = 0);
void init();
typedef QPair<const char *,const char *> OptionPair;
typedef QList<quint16> OptionOffsetList;
typedef QList<OptionPair> OptionList;
static const char *LookupOption(
const OptionList &options, const char *option);
signals:
void verboseEvent(const QString &msg);
void warningEvent(const QString &msg);
void errorEvent(const QString &msg);
public slots:
void OnPacketReceived();
void OnTransferVerboseEvent(const QString &msg);
void OnTransferErrorEvent(const QString &msg);
};
#endif // TFTPSERVER_H