Diff for /embedaddon/libnet/src/libnet_build_data.c between versions 1.1.1.1 and 1.1.1.3

version 1.1.1.1, 2012/02/21 22:14:23 version 1.1.1.3, 2023/09/27 11:11:38
Line 30 Line 30
  *   *
  */   */
   
#if (HAVE_CONFIG_H)#include "common.h"
#include "../include/config.h" 
#endif 
#if (!(_WIN32) || (__CYGWIN__))  
#include "../include/libnet.h" 
#else 
#include "../include/win32/libnet.h" 
#endif 
   
/* FIXME this won't work with TCP or IPv4 data, which is probably a bug */
 libnet_ptag_t  libnet_ptag_t
libnet_build_data(u_int8_t *payload, u_int32_t payload_s, libnet_t *l,libnet_build_data(const uint8_t *payload, uint32_t payload_s, libnet_t *l,
            libnet_ptag_t ptag)libnet_ptag_t ptag)
 {  {
    u_int32_t n, h;    uint32_t n, h;
     libnet_pblock_t *p;      libnet_pblock_t *p;
   
     if (l == NULL)      if (l == NULL)
Line 65  libnet_build_data(u_int8_t *payload, u_int32_t payload Line 58  libnet_build_data(u_int8_t *payload, u_int32_t payload
         return (-1);          return (-1);
     }      }
   
    if ((payload && !payload_s) || (!payload && payload_s))    /* boilerplate payload sanity check / append macro */
    {    LIBNET_DO_PAYLOAD(l, p);
         snprintf(l->err_buf, LIBNET_ERRBUF_SIZE, 
                             "%s(): payload inconsistency\n", __func__); 
        goto bad; 
    } 
   
     if (payload && payload_s)  
     {  
         n = libnet_pblock_append(l, p, payload, payload_s);  
         if (n == -1)  
         {  
             goto bad;  
         }  
     }  
   
     return (ptag ? ptag : libnet_pblock_update(l, p, h, LIBNET_PBLOCK_DATA_H));      return (ptag ? ptag : libnet_pblock_update(l, p, h, LIBNET_PBLOCK_DATA_H));
 bad:  bad:
     libnet_pblock_delete(l, p);      libnet_pblock_delete(l, p);
     return (-1);      return (-1);
 }  }
   
/* EOF *//**
  * Local Variables:
  *  indent-tabs-mode: nil
  *  c-file-style: "stroustrup"
  * End:
  */

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.3


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>