doIP.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Copyright (C) 2007-2010 Siemens AG
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU Lesser General Public License as published
  6. * by the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. /*******************************************************************
  18. *
  19. * @author Sebastian.Kaebisch.EXT@siemens.com
  20. * @version 0.3
  21. * @contact Joerg.Heuer@siemens.com
  22. *
  23. ********************************************************************/
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. #ifndef DOIP_H_
  28. #define DOIP_H_
  29. /* generic DoIP header length */
  30. #define DOIP_HEADER_LENGTH 8
  31. /* define DoIP Version */
  32. #define DOIP_VERSION 0x01
  33. #define DOIP_VERSION_INV 0xFE
  34. /* define DoIP payload types*/
  35. #define DOIP_NEGATIVE_ACKNOWLEDGE 0x0000
  36. #define DOIP_EXI_TYPE 0xC350 /* == 50000 */
  37. /* Generic DoIP Header NACK codes */
  38. #define DOIP_INCORRECT_PATTERN_FORMAT 0x00
  39. #define DOIP_UNKNOWN_PAYLOAD_TYPE 0x01
  40. #define DOIP_MESSAGE_TOO_LARGE 0x02
  41. #define DOIP_OUT_OF_MEMORY 0x03
  42. #define DOIP_INVALID_PAYLOAD_LENGTH 0x04
  43. /* EXI NACK code */
  44. #define DOIP_INVALID_EXI_MESSAGE 0x05
  45. /* DoIP methods */
  46. int write_doIPNack(uint8_t* outStream, uint32_t* outStreamLength, uint8_t nackCode);
  47. int write_doIPHeader(uint8_t* outStream, uint32_t* outStreamLength, uint16_t payloadType);
  48. int read_doIPHeader(uint8_t* inStream, size_t inStreamLength, uint32_t* payloadLength);
  49. #endif /* DOIP_H_ */
  50. #ifdef __cplusplus
  51. }
  52. #endif