Subversion Repositories HelenOS

Rev

Rev 4715 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * Copyright (c) 2009 Lukas Mejdrech
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  *
  9.  * - Redistributions of source code must retain the above copyright
  10.  *   notice, this list of conditions and the following disclaimer.
  11.  * - Redistributions in binary form must reproduce the above copyright
  12.  *   notice, this list of conditions and the following disclaimer in the
  13.  *   documentation and/or other materials provided with the distribution.
  14.  * - The name of the author may not be used to endorse or promote products
  15.  *   derived from this software without specific prior written permission.
  16.  *
  17.  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  18.  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  19.  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  20.  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  21.  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  22.  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  23.  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  24.  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  26.  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27.  */
  28.  
  29. /** @addtogroup icmp
  30.  *  @{
  31.  */
  32.  
  33. /** @file
  34.  *  ICMP header definition.
  35.  *  Names according to the linux src/include/linux/icmp.h header file.
  36.  */
  37.  
  38. #ifndef __NET_ICMP_HEADER_H__
  39. #define __NET_ICMP_HEADER_H__
  40.  
  41. #include <sys/types.h>
  42.  
  43. #include "../../include/in.h"
  44. #include "../../include/icmp_codes.h"
  45.  
  46. /** Type definition of the user datagram header.
  47.  *  @see icmp_header
  48.  */
  49. typedef struct icmp_header  icmp_header_t;
  50.  
  51. /** Type definition of the user datagram header pointer.
  52.  *  @see icmp_header
  53.  */
  54. typedef icmp_header_t *     icmp_header_ref;
  55.  
  56. /** User datagram header.
  57.  */
  58. struct icmp_header{
  59.     /** Specifies the type of the message.
  60.      */
  61.     uint8_t type;
  62.     /** Contains the error code for the datagram reported by this ICMP message.
  63.      *  The interpretation is dependent on the message type.
  64.      */
  65.     uint8_t code;
  66.     /** Contains the checksum for the ICMP message starting with the ICMP Type field.
  67.      *  If the checksum does not match the contents, the datagram is discarded.
  68.      */
  69.     uint16_t    checksum;
  70.     /** \todo
  71.      */
  72.     union{
  73.         struct{
  74.             icmp_param_t    id;
  75.             icmp_param_t    sequence;
  76.         } echo;
  77.         in_addr_t           gateway;
  78.         struct{
  79.             icmp_param_t    unused;
  80.             icmp_param_t    mtu;
  81.         } frag;
  82.         struct{
  83.             icmp_param_t    pointer;
  84.             icmp_param_t    unused;
  85.         } param;
  86.     } un;
  87. } __attribute__ ((packed));
  88.  
  89. #endif
  90.  
  91. /** @}
  92.  */
  93.