00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef PACKET_H
00015 #define PACKET_H
00016
00017 #ifdef HAVE_CONFIG_H
00018 #include "config.h"
00019 #endif
00020
00021 #include "packets.h"
00022 #include "Logger.h"
00023
00024 class Packet
00025 {
00026 public:
00027 static int encode (DdtpPacket* pkt, char* buf, int bufSize);
00028 static int decode (DdtpPacket* pkt, char* buf, int bufSize);
00029
00030 static int decrypt (DdtpPacket* pkt, char* md5_password);
00031 static int encrypt (DdtpPacket* pkt, char* md5_password);
00032
00033 static int getAccountId (DdtpPacket* pkt);
00034
00035 static int createUpdateQuery(
00036 DdtpPacket* ddtpPacket,
00037 ProtocolVersion protocolVersion,
00038 EncryptionType encryptionType,
00039 int accountId,
00040 DDTPv1UpdateQueryOpCode opCode,
00041 unsigned long ipAddress,
00042 char* updatePassword);
00043
00044 static int createAliveQuery(
00045 DdtpPacket* ddtpPacket,
00046 ProtocolVersion protocolVersion,
00047 int accountId);
00048
00049 static int createAliveReply(
00050 DdtpPacket* ddtpPacket,
00051 ProtocolVersion protocolVersion,
00052 int accountId);
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 private:
00063 static int decryptDDTPv1Plaintext (DDTPv1Plaintext* ptmsg);
00064 static int encryptDDTPv1Plaintext (DDTPv1Plaintext* ptmsg);
00065 static int decryptDDTPv1Blowfish (DDTPv1Blowfish* bfmsg, char* md5_password);
00066 static int encryptDDTPv1Blowfish (DDTPv1Blowfish* bfmsg, char* md5_password);
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096 };
00097 #endif // PACKET_H