version 1.1.1.2, 2013/07/22 11:54:42
|
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 | |
|
|
libnet_t * |
libnet_t * |
libnet_init(int injection_type, const char *device, char *err_buf) |
libnet_init(int injection_type, const char *device, char *err_buf) |
Line 50 libnet_init(int injection_type, const char *device, ch
|
Line 43 libnet_init(int injection_type, const char *device, ch
|
if ((WSAStartup(0x0202, &wsaData)) != 0) |
if ((WSAStartup(0x0202, &wsaData)) != 0) |
{ |
{ |
snprintf(err_buf, LIBNET_ERRBUF_SIZE, |
snprintf(err_buf, LIBNET_ERRBUF_SIZE, |
"%s(): unable to initialize winsock 2\n", __func__); | "%s(): unable to initialize winsock 2", __func__); |
goto bad; |
goto bad; |
} |
} |
#endif |
#endif |
Line 58 libnet_init(int injection_type, const char *device, ch
|
Line 51 libnet_init(int injection_type, const char *device, ch
|
l = (libnet_t *)malloc(sizeof (libnet_t)); |
l = (libnet_t *)malloc(sizeof (libnet_t)); |
if (l == NULL) |
if (l == NULL) |
{ |
{ |
snprintf(err_buf, LIBNET_ERRBUF_SIZE, "%s(): malloc(): %s\n", __func__, | snprintf(err_buf, LIBNET_ERRBUF_SIZE, "%s(): malloc(): %s", __func__, |
strerror(errno)); |
strerror(errno)); |
goto bad; |
goto bad; |
} |
} |
Line 108 libnet_init(int injection_type, const char *device, ch
|
Line 101 libnet_init(int injection_type, const char *device, ch
|
break; |
break; |
default: |
default: |
snprintf(err_buf, LIBNET_ERRBUF_SIZE, |
snprintf(err_buf, LIBNET_ERRBUF_SIZE, |
"%s(): unsupported injection type\n", __func__); | "%s(): unsupported injection type", __func__); |
goto bad; |
goto bad; |
break; |
break; |
} |
} |
Line 128 libnet_destroy(libnet_t *l)
|
Line 121 libnet_destroy(libnet_t *l)
|
{ |
{ |
if (l) |
if (l) |
{ |
{ |
close(l->fd); | if (l->fd != -1) |
| close(l->fd); |
free(l->device); |
free(l->device); |
libnet_clear_packet(l); |
libnet_clear_packet(l); |
free(l); |
free(l); |
Line 175 libnet_getfd(libnet_t *l)
|
Line 169 libnet_getfd(libnet_t *l)
|
return (-1); |
return (-1); |
} |
} |
|
|
return (l->fd); | return (int)(l->fd); |
} |
} |
|
|
const char * |
const char * |
Line 257 libnet_getpacket_size(libnet_t *l)
|
Line 251 libnet_getpacket_size(libnet_t *l)
|
return (n); |
return (n); |
} |
} |
|
|
/* EOF */ | /** |
| * Local Variables: |
| * indent-tabs-mode: nil |
| * c-file-style: "stroustrup" |
| * End: |
| */ |