forked from irwir/eMule
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMMServer.h
80 lines (74 loc) · 2.79 KB
/
MMServer.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//this file is part of eMule
//Copyright (C)2003 Merkur ( [email protected] / http://www.emule-project.net )
//
//This program 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 2 of the License, or (at your option) any later version.
//
//This program 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.
//
//You should have received a copy of the GNU General Public License
//along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#pragma once
class CMMSocket;
class CMMData;
class CMMPacket;
class CListenMMSocket;
class CSearchFile;
class CxImage;
class CKnownFile;
class CPartFile;
#define MMS_BLOCKTIME 600000
#define MMS_SEARCHID 500
class CMMServer
{
public:
CMMServer(void);
~CMMServer(void);
void Init();
void StopServer();
// packet processing
bool PreProcessPacket(char* pPacket, uint32 nSize, CMMSocket* sender);
void ProcessHelloPacket(CMMData* data, CMMSocket* sender);
void ProcessStatusRequest(CMMSocket* sender, CMMPacket* usePacket = NULL);
void ProcessFileListRequest(CMMSocket* sender, CMMPacket* usePacket = NULL);
void ProcessFileCommand(CMMData* data, CMMSocket* sender);
void ProcessDetailRequest(CMMData* data, CMMSocket* socket);
void ProcessCommandRequest(CMMData* data, CMMSocket* sender);
void ProcessSearchRequest(CMMData* data, CMMSocket* sender);
void ProcessPreviewRequest(CMMData* data, CMMSocket* sender);
void ProcessDownloadRequest(CMMData* data, CMMSocket* sender);
void ProcessChangeLimitRequest(CMMData* data, CMMSocket* sender);
void ProcessFinishedListRequest(CMMSocket* sender);
void ProcessStatisticsRequest(CMMData* data, CMMSocket* sender);
// other
void SearchFinished(bool bTimeOut);
void PreviewFinished(CxImage** imgFrames, uint8 nCount);
void Process();
void AddFinishedFile(CKnownFile* file) {m_SentFinishedList.Add(file);}
CStringA GetContentType();
UINT_PTR h_timer;
uint8 m_byPendingCommand;
CMMSocket* m_pPendingCommandSocket;
protected:
static VOID CALLBACK CommandTimer(HWND hWnd, UINT nMsg, UINT nId, DWORD dwTime);
void DeleteSearchFiles();
void WriteFileInfo(CPartFile* selFile, CMMPacket* packet);
private:
CListenMMSocket* m_pSocket;
uint16 m_nSessionID;
CArray<CPartFile*,CPartFile*> m_SentFileList;
CArray<CSearchFile*, CSearchFile*> m_SendSearchList;
CArray<CKnownFile*,CKnownFile*> m_SentFinishedList;
uint8 m_cPWFailed;
uint32 m_dwBlocked;
bool m_bUseFakeContent;
uint16 m_nMaxDownloads;
uint16 m_nMaxBufDownloads;
bool m_bGrabListLogin;
};