From alex323 at gmail.com Sat May 20 08:58:02 2006 From: alex323 at gmail.com (Alex) Date: Sat, 20 May 2006 08:58:02 -0400 Subject: [OTR-dev] Fragment creation? Message-ID: <446F125A.20205@gmail.com> Hello. I was pondering about how I would go about creating fragmented messages which take into account the size of the header. The header is variable length as strlen("?OTR,1,3,") != strlen("?OTR,1,20,"). A dirty way of working it out would be find out how many packets there would be and then work out how large the headers will be, rework-out how many headers there will be, then rerework out how many headers, then for each of those, take into account how long the variable headers add, then rererework-out... no this is getting nasty. Does anyone know of a solution to this problem? I want to deviate from the protocol slightly and make the headers static length. strlen("?OTR,00001,00003,") == strlen("?OTR,00001,00020,"). Would this break any current implementations? Is this necessary? - Alex From ian at cypherpunks.ca Sat May 20 12:34:58 2006 From: ian at cypherpunks.ca (Ian Goldberg) Date: Sat, 20 May 2006 12:34:58 -0400 Subject: [OTR-dev] Fragment creation? In-Reply-To: <446F125A.20205@gmail.com> References: <446F125A.20205@gmail.com> Message-ID: <20060520163458.GB8086@smtp.paip.net> You could more easily just allocate space for the worst case, based on the length of the message, and if a couple of your fragments are a byte shorter than others, that's fine. - Ian