00001 /*========================================================================= 00002 00003 Program: OpenIGTLink Library 00004 Module: $HeadURL: http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink/Source/igtlutil/igtl_header.h $ 00005 Language: C 00006 Date: $Date: 2009-11-13 11:37:44 -0500 (Fri, 13 Nov 2009) $ 00007 Version: $Revision: 5335 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 00011 This software is distributed WITHOUT ANY WARRANTY; without even 00012 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00013 PURPOSE. See the above copyright notices for more information. 00014 00015 =========================================================================*/ 00016 00017 #ifndef __IGTL_HEADER_H 00018 #define __IGTL_HEADER_H 00019 00020 #define IGTL_HEADER_VERSION 1 00021 #define IGTL_HEADER_SIZE 58 00022 00023 #define IGTL_HEADER_NAMESIZE 12 00024 #define IGTL_HEADER_DEVSIZE 20 00025 00026 #include "igtl_types.h" 00027 #include "igtl_win32header.h" 00028 00029 #ifdef __cplusplus 00030 extern "C" { 00031 #endif 00032 00033 #pragma pack(1) /* For 1-byte boundary in memroy */ 00034 00035 /* 00036 * Message header of OpenIGTLink message. 00037 * 00038 * igtl_header is an overall data header for OpenIGTLink protocol. 00039 * It is transfered at beginning of every OpenIGTLink message to give 00040 * type and size of following data body to a receiver. 00041 * These parameters allow the receiver to parse or skip the data body. 00042 */ 00043 00044 typedef struct { 00045 igtl_uint16 version; /* protocol version number */ 00046 char name[IGTL_HEADER_NAMESIZE]; /* data type name */ 00047 char device_name[IGTL_HEADER_DEVSIZE]; /* device name */ 00048 igtl_uint64 timestamp; /* time stamp message */ 00049 igtl_uint64 body_size; /* size of the body */ 00050 igtl_uint64 crc; /* CRC */ 00051 } igtl_header; 00052 00053 #pragma pack() 00054 00055 /* 00056 * Byte order converter for the header structre 00057 * 00058 * igtl_header_convert_byte_order convers endianness of each 00059 * member variable in igtl_header structre from host byte order 00060 * to network byte order, or vice versa. 00061 * 00062 */ 00063 void igtl_export igtl_header_convert_byte_order(igtl_header * header); 00064 00065 #ifdef __cplusplus 00066 } 00067 #endif 00068 00069 #endif /* __IGTL_HEADER_H */ 00070 00071