PIByteArray works on binary stream
This commit is contained in:
@@ -115,8 +115,7 @@ private:
|
||||
};
|
||||
# pragma pack(pop)
|
||||
|
||||
friend PIByteArray & operator >>(PIByteArray & s, PIBaseTransfer::StartRequest & v);
|
||||
friend PIByteArray & operator <<(PIByteArray & s, const PIBaseTransfer::StartRequest & v);
|
||||
BINARY_STREAM_FRIEND(PIBaseTransfer::StartRequest);
|
||||
|
||||
void processData(int id, PIByteArray &data);
|
||||
PIByteArray build_packet(int id);
|
||||
@@ -145,14 +144,14 @@ private:
|
||||
PIString pm_string;
|
||||
};
|
||||
|
||||
inline PIByteArray & operator <<(PIByteArray & s, const PIBaseTransfer::PacketHeader & v) {s << v.sig << v.type << v.session_id << v.id << v.crc; return s;}
|
||||
inline PIByteArray & operator >>(PIByteArray & s, PIBaseTransfer::PacketHeader & v) {s >> v.sig >> v.type >> v.session_id >> v.id >> v.crc; return s;}
|
||||
BINARY_STREAM_STORE (PIBaseTransfer::PacketHeader) {s << v.sig << v.type << v.session_id << v.id << v.crc; return s;}
|
||||
BINARY_STREAM_RESTORE(PIBaseTransfer::PacketHeader) {s >> v.sig >> v.type >> v.session_id >> v.id >> v.crc; return s;}
|
||||
|
||||
inline PIByteArray & operator <<(PIByteArray & s, const PIBaseTransfer::Part & v) {s << v.id << v.size << v.start; return s;}
|
||||
inline PIByteArray & operator >>(PIByteArray & s, PIBaseTransfer::Part & v) {s >> v.id >> v.size >> v.start; return s;}
|
||||
BINARY_STREAM_STORE (PIBaseTransfer::Part) {s << v.id << v.size << v.start; return s;}
|
||||
BINARY_STREAM_RESTORE(PIBaseTransfer::Part) {s >> v.id >> v.size >> v.start; return s;}
|
||||
|
||||
inline PIByteArray & operator <<(PIByteArray & s, const PIBaseTransfer::StartRequest & v) {s << v.packets << v.size; return s;}
|
||||
inline PIByteArray & operator >>(PIByteArray & s, PIBaseTransfer::StartRequest & v) {s >> v.packets >> v.size; return s;}
|
||||
BINARY_STREAM_STORE (PIBaseTransfer::StartRequest) {s << v.packets << v.size; return s;}
|
||||
BINARY_STREAM_RESTORE(PIBaseTransfer::StartRequest) {s >> v.packets >> v.size; return s;}
|
||||
|
||||
inline PICout operator <<(PICout s, const PIBaseTransfer::Part & v) {s.setControl(0, true); s << "Part(\"" << v.id << "\", " << PIString::readableSize(v.start) << " b | " << PIString::readableSize(v.size) << " b)"; s.restoreControl(); return s;}
|
||||
|
||||
|
||||
@@ -111,13 +111,19 @@ private:
|
||||
EVENT_HANDLER1(void, receive_finished, bool, ok);
|
||||
};
|
||||
|
||||
inline PIByteArray & operator <<(PIByteArray & s, const PIFileTransfer::PFTHeader & v) {s << v.raw_sig << v.step << v.session_id; return s;}
|
||||
inline PIByteArray & operator >>(PIByteArray & s, PIFileTransfer::PFTHeader & v) {s >> v.raw_sig >> v.step >> v.session_id; return s;}
|
||||
BINARY_STREAM_STORE (PIFileTransfer::PFTHeader) {s << v.raw_sig << v.step << v.session_id; return s;}
|
||||
BINARY_STREAM_RESTORE(PIFileTransfer::PFTHeader) {s >> v.raw_sig >> v.step >> v.session_id; return s;}
|
||||
|
||||
inline PIByteArray & operator <<(PIByteArray & s, const PIFileTransfer::PFTFileInfo & v) {s << v.dest_path << v.size << v.time_access << v.time_modification <<
|
||||
v.flags << v.id_user << v.id_group << v.perm_user.raw << v.perm_group.raw << v.perm_other.raw; return s;}
|
||||
inline PIByteArray & operator >>(PIByteArray & s, PIFileTransfer::PFTFileInfo & v) {s >> v.dest_path >> v.size >> v.time_access >> v.time_modification >>
|
||||
v.flags >> v.id_user >> v.id_group >> v.perm_user.raw >> v.perm_group.raw >> v.perm_other.raw; return s;}
|
||||
BINARY_STREAM_STORE (PIFileTransfer::PFTFileInfo) {
|
||||
s << v.dest_path << v.size << v.time_access << v.time_modification <<
|
||||
v.flags << v.id_user << v.id_group << v.perm_user.raw << v.perm_group.raw << v.perm_other.raw;
|
||||
return s;
|
||||
}
|
||||
BINARY_STREAM_RESTORE(PIFileTransfer::PFTFileInfo) {
|
||||
s >> v.dest_path >> v.size >> v.time_access >> v.time_modification >>
|
||||
v.flags >> v.id_user >> v.id_group >> v.perm_user.raw >> v.perm_group.raw >> v.perm_other.raw;
|
||||
return s;
|
||||
}
|
||||
|
||||
inline PICout operator <<(PICout s, const PIFileTransfer::PFTFileInfo & v) {
|
||||
s.setControl(0, true);
|
||||
|
||||
Reference in New Issue
Block a user