22 #define EC_MAXFOEDATA 512
76 int32 buffersize, packetnumber, prevpacket = 0;
77 uint16 fnsize, maxdata, segmentdata;
95 FOEp->MbxHeader.length =
htoes(0x0006 + fnsize);
96 FOEp->MbxHeader.address =
htoes(0x0000);
97 FOEp->MbxHeader.priority = 0x00;
103 FOEp->Password =
htoel(password);
105 memcpy(&FOEp->FileName[0],
filename, fnsize);
124 segmentdata =
etohs(aFOEp->MbxHeader.length) - 0x0006;
125 packetnumber =
etohl(aFOEp->PacketNumber);
126 if ((packetnumber == ++prevpacket) && (dataread + segmentdata <= buffersize))
128 memcpy(p, &aFOEp->Data[0], segmentdata);
129 dataread += segmentdata;
130 p = (
uint8 *)p + segmentdata;
131 if (segmentdata == maxdata)
135 FOEp->MbxHeader.length =
htoes(0x0006);
136 FOEp->MbxHeader.address =
htoes(0x0000);
137 FOEp->MbxHeader.priority = 0x00;
143 FOEp->PacketNumber =
htoel(packetnumber);
203 int32 packetnumber, sendpacket = 0;
208 boolean worktodo, dofinalzero;
220 if (fnsize > maxdata)
224 FOEp->MbxHeader.length =
htoes(0x0006 + fnsize);
225 FOEp->MbxHeader.address =
htoes(0x0000);
226 FOEp->MbxHeader.priority = 0x00;
232 FOEp->Password =
htoel(password);
234 memcpy(&FOEp->FileName[0],
filename, fnsize);
251 switch (aFOEp->OpCode)
255 packetnumber =
etohl(aFOEp->PacketNumber);
256 if (packetnumber == sendpacket)
267 if(tsize || dofinalzero)
272 psize -= segmentdata;
275 if (!psize && (segmentdata == maxdata))
279 FOEp->MbxHeader.length =
htoes(0x0006 + segmentdata);
280 FOEp->MbxHeader.address =
htoes(0x0000);
281 FOEp->MbxHeader.priority = 0x00;
288 FOEp->PacketNumber =
htoel(sendpacket);
289 memcpy(&FOEp->Data[0], p, segmentdata);
290 p = (
uint8 *)p + segmentdata;
316 psize += segmentdata;
317 p = (
uint8 *)p - segmentdata;
325 if (aFOEp->ErrorCode == 0x8001)