mirror of
https://github.com/Martin-P/OpenV2G.git
synced 2024-11-08 12:45:42 +00:00
fix V2GTP header length from 16 to 32 bits as suggested in https://sourceforge.net/p/openv2g/tickets/10/
git-svn-id: https://svn.code.sf.net/p/openv2g/code/trunk@106 d9f2db14-54d0-4bde-b00c-16405c910529
This commit is contained in:
parent
381511e389
commit
02f5359f3f
6 changed files with 16 additions and 21 deletions
|
@ -20,7 +20,7 @@
|
|||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @author Sebastian.Kaebisch@siemens.com
|
||||
* @version 1.0.0alpha
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
* @contact Richard.Kuntschke@siemens.com
|
||||
*
|
||||
* <p>Switch for sample programs: EXI codec only or for entire V2G example</p>
|
||||
*
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @author Sebastian.Kaebisch@siemens.com
|
||||
* @version 1.0.0alpha
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
* @contact Richard.Kuntschke@siemens.com
|
||||
*
|
||||
*
|
||||
********************************************************************/
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 1.0.0alpha
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
* @contact Richard.Kuntschke@siemens.com
|
||||
*
|
||||
* <p>Code generated by EXIdizer</p>
|
||||
* <p>Schema: V2G_CI_MsgDef.xsd</p>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @author Sebastian.Kaebisch@siemens.com
|
||||
* @version 1.0.0alpha
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
* @contact Richard.Kuntschke@siemens.com
|
||||
*
|
||||
*
|
||||
********************************************************************/
|
||||
|
@ -140,7 +140,7 @@ static int serializeEXI2Stream(struct iso2EXIDocument* exiIn, bitstream_t* strea
|
|||
/* deserializes V2G TP header and decodes right away EXI stream */
|
||||
static int deserializeStream2EXI(bitstream_t* streamIn, struct iso2EXIDocument* exi) {
|
||||
int errn;
|
||||
uint16_t payloadLength;
|
||||
uint32_t payloadLength;
|
||||
|
||||
*streamIn->pos = 0;
|
||||
if ( (errn = read_v2gtpHeader(streamIn->data, &payloadLength)) == 0) {
|
||||
|
@ -157,7 +157,7 @@ static int appHandshakeHandler(bitstream_t* iStream, bitstream_t* oStream) {
|
|||
int i;
|
||||
struct appHandEXIDocument exiDoc;
|
||||
int errn = 0;
|
||||
uint16_t payloadLengthDec;
|
||||
uint32_t payloadLengthDec;
|
||||
|
||||
|
||||
if ( (errn = read_v2gtpHeader(iStream->data, &payloadLengthDec)) == 0) {
|
||||
|
@ -207,7 +207,7 @@ static int appHandshake()
|
|||
bitstream_t stream1;
|
||||
bitstream_t stream2;
|
||||
|
||||
uint16_t payloadLengthDec;
|
||||
uint32_t payloadLengthDec;
|
||||
size_t pos1 = V2GTP_HEADER_LENGTH; /* v2gtp header */
|
||||
size_t pos2 = 0;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* @author Sebastian.Kaebisch@siemens.com
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 1.0.0alpha
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
* @contact Richard.Kuntschke@siemens.com
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
|||
#include "v2gtp.h"
|
||||
|
||||
|
||||
int write_v2gtpHeader(uint8_t* outStream, uint16_t outStreamLength, uint16_t payloadType)
|
||||
int write_v2gtpHeader(uint8_t* outStream, uint32_t outStreamLength, uint16_t payloadType)
|
||||
{
|
||||
|
||||
/* write v2gtp version number 1=byte */
|
||||
|
@ -57,16 +57,13 @@ int write_v2gtpHeader(uint8_t* outStream, uint16_t outStreamLength, uint16_t pay
|
|||
/* write payload length */
|
||||
outStream[7] = (uint8_t)(outStreamLength & 0xFF);
|
||||
outStream[6] = (uint8_t)(outStreamLength>>8 & 0xFF);
|
||||
outStream[5] = (uint8_t) 0; /* uint16 only, no need for (outStreamLength>>16 & 0xFF); */
|
||||
outStream[4] = (uint8_t) 0; /* uint16 only, no need for (outStreamLength>>24 & 0xFF); */
|
||||
|
||||
/* here, the outStream length have to be resized by the v2gtp offset*/
|
||||
/**outStreamLength += V2GTP_HEADER_LENGTH;*/
|
||||
outStream[5] = (uint8_t)(outStreamLength>>16 & 0xFF);
|
||||
outStream[4] = (uint8_t)(outStreamLength>>24 & 0xFF);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int read_v2gtpHeader(uint8_t* inStream, uint16_t* payloadLength)
|
||||
int read_v2gtpHeader(uint8_t* inStream, uint32_t* payloadLength)
|
||||
{
|
||||
uint16_t payloadType=0;
|
||||
|
||||
|
@ -90,9 +87,6 @@ int read_v2gtpHeader(uint8_t* inStream, uint16_t* payloadLength)
|
|||
*payloadLength = (*payloadLength << 8 | inStream[6]);
|
||||
*payloadLength = (*payloadLength << 8 | inStream[7]);
|
||||
|
||||
/* if((*payloadLength+V2GTP_HEADER_LENGTH)!=inStreamLength)
|
||||
return -1; */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,9 @@
|
|||
/*******************************************************************
|
||||
*
|
||||
* @author Sebastian.Kaebisch@siemens.com
|
||||
* @author Daniel.Peintner.EXT@siemens.com
|
||||
* @version 1.0.0alpha
|
||||
* @contact Joerg.Heuer@siemens.com
|
||||
* @contact Richard.Kuntschke@siemens.com
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
|
@ -43,9 +44,9 @@ extern "C" {
|
|||
/* define V2GTP payload types*/
|
||||
#define V2GTP_EXI_TYPE 0x8001
|
||||
|
||||
int write_v2gtpHeader(uint8_t* outStream, uint16_t outStreamLength, uint16_t payloadType);
|
||||
int write_v2gtpHeader(uint8_t* outStream, uint32_t outStreamLength, uint16_t payloadType);
|
||||
|
||||
int read_v2gtpHeader(uint8_t* inStream, uint16_t* payloadLength);
|
||||
int read_v2gtpHeader(uint8_t* inStream, uint32_t* payloadLength);
|
||||
|
||||
#endif /* V2GTP_H_ */
|
||||
|
||||
|
|
Loading…
Reference in a new issue