main index

section index




/*-------------------------------------------------------------*/
/***************************************************************
 * RFC 792 does not indicate if header length is 4 or 8 bytes. *
 * I choose to end after the checksum (so only 4 bytes).       *
 ***************************************************************/

/*-------------------------------------------------------------*/
/* ICMP4 header */
typedef struct {
  netwib_icmp4type type;
  netwib_icmp4code code;
  netwib_uint16 check;
} netwib_icmp4hdr;
typedef const netwib_icmp4hdr netwib_consticmp4hdr;
#define NETWIB_ICMP4HDR_LEN 4

/*-------------------------------------------------------------*/
/* Name : netwib_icmp4hdr_initdefault
   Description :
     Initialize a netwib_icmp4hdr with default values.
   Input parameter(s) :
   Input/output parameter(s) :
   Output parameter(s) :
     *picmp4hdr : netwib_icmp4hdr to initialize
   Normal return values :
     NETWIB_ERR_OK : ok
*/
netwib_err netwib_icmp4hdr_initdefault(netwib_icmp4hdr *picmp4hdr);

/*-------------------------------------------------------------*/
/* Name : netwib_pkt_append_icmp4hdr
   Description :
     Initialize physical data from a netwib_icmp4hdr.
   Input parameter(s) :
     *picmp4hdr : netwib_icmp4hdr
   Input/output parameter(s) :
     *ppht : buffer to initialize
   Output parameter(s) :
   Normal return values :
     NETWIB_ERR_OK : ok
*/
netwib_err netwib_pkt_append_icmp4hdr(netwib_consticmp4hdr *picmp4hdr,
                                      netwib_buf *ppkt);
netwib_err netwib_pkt_prepend_icmp4hdr(netwib_consticmp4hdr *picmp4hdr,
                                       netwib_buf *ppkt);

/*-------------------------------------------------------------*/
/* Name : netwib_pkt_decode_icmp4hdr
   Description :
     Decode a netwib_icmp4hdr from physical data.
   Input parameter(s) :
     *ppkt : buffer containing physical data
   Input/output parameter(s) :
   Output parameter(s) :
     *picmp4hdr : netwib_icmp4hdr contained in pkt
     *pskipsize : size to use to skip this header
   Normal return values :
     NETWIB_ERR_OK : ok
     NETWIB_ERR_OKNOTDECODED : pkt could not be decoded
*/
netwib_err netwib_pkt_decode_icmp4hdr(netwib_constbuf *ppkt,
                                      netwib_icmp4hdr *picmp4hdr,
                                      netwib_uint32 *pskipsize);

/*-------------------------------------------------------------*/
/* Name : netwib_buf_append_icmp4hdr
   Description :
     Print a netwib_icmp4hdr.
   Input parameter(s) :
     *picmp4hdr : netwib_icmp4hdr to print
     encodetype : netwib_encodetype to use
   Input/output parameter(s) :
   Output parameter(s) :
     *pbuf : netwib_buf receiving data
   Normal return values :
     NETWIB_ERR_OK : ok
*/
netwib_err netwib_buf_append_icmp4hdr(netwib_consticmp4hdr *picmp4hdr,
                                      netwib_encodetype encodetype,
                                      netwib_buf *pbuf);




main index

section index