Changeset 1897 for trunk/src/common/sendpacket.c
- Timestamp:
- 08/24/07 21:57:38 (17 months ago)
- Files:
-
- 1 modified
-
trunk/src/common/sendpacket.c (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/common/sendpacket.c
r1893 r1897 167 167 168 168 169 /* 169 /** 170 170 * returns number of bytes sent on success or -1 on error 171 171 * Note: it is theoretically possible to get a return code >0 and < len … … 267 267 } 268 268 269 269 /** 270 * Open the given network device name and returns a sendpacket_t struct 271 * pass the error buffer (in case there's a problem) and the direction 272 * that this interface represents 273 */ 270 274 sendpacket_t * 271 275 sendpacket_open(const char *device, char *errbuf, tcpr_dir_t direction) … … 292 296 } 293 297 294 298 /** 299 * Get packet stats for the given sendpacket_t 300 */ 295 301 char * 296 302 sendpacket_getstat(sendpacket_t *sp) … … 310 316 } 311 317 318 /** 319 * close the given sendpacket 320 */ 312 321 int 313 322 sendpacket_close(sendpacket_t *sp) … … 319 328 } 320 329 321 /* 330 /** 322 331 * returns the Layer 2 address of the interface current 323 332 * open. on error, return NULL … … 345 354 } 346 355 347 /* 356 /** 348 357 * returns the error string 349 358 */ … … 355 364 } 356 365 357 /* 366 /** 358 367 * Set's the error string 359 368 */ … … 375 384 376 385 #if defined HAVE_PCAP_INJECT || defined HAVE_PCAP_SENDPACKET 386 /** 387 * Inner sendpacket_open() method for using libpcap 388 */ 377 389 static sendpacket_t * 378 390 sendpacket_open_pcap(const char *device, char *errbuf) … … 407 419 } 408 420 421 /** 422 * Get the hardware MAC address for the given interface using libpcap 423 */ 409 424 static struct tcpr_ether_addr * 410 425 sendpacket_get_hwaddr_pcap(sendpacket_t *sp) … … 417 432 418 433 #if defined HAVE_LIBNET 434 /** 435 * Inner sendpacket_open() method for using libnet 436 */ 419 437 static sendpacket_t * 420 438 sendpacket_open_libnet(const char *device, char *errbuf) … … 437 455 } 438 456 457 /** 458 * Get the hardware MAC address for the given interface using libnet 459 */ 439 460 static struct tcpr_ether_addr * 440 461 sendpacket_get_hwaddr_libnet(sendpacket_t *sp) … … 456 477 457 478 #if defined HAVE_PF_PACKET 479 /** 480 * Inner sendpacket_open() method for using Linux's PF_PACKET 481 */ 458 482 static sendpacket_t * 459 483 sendpacket_open_pf(const char *device, char *errbuf) … … 555 579 } 556 580 557 /* get the interface index (necessary for sending packets w/ PF_PACKET) */ 581 /** 582 * get the interface index (necessary for sending packets w/ PF_PACKET) 583 */ 558 584 static int 559 585 get_iface_index(int fd, const int8_t *device, char *errbuf) { … … 571 597 } 572 598 573 /* 574 * get's the hardware address via Linux's PF packet 575 * interface 599 /** 600 * get's the hardware address via Linux's PF packet interface 576 601 */ 577 602 struct tcpr_ether_addr * … … 611 636 612 637 #if defined HAVE_BPF 638 /** 639 * Inner sendpacket_open() method for using BSD's BPF interface 640 */ 613 641 static sendpacket_t * 614 642 sendpacket_open_bpf(const char *device, char *errbuf) … … 726 754 } 727 755 756 /** 757 * Get the interface hardware MAC address when using BPF 758 */ 728 759 struct tcpr_ether_addr * 729 760 sendpacket_get_hwaddr_bpf(sendpacket_t *sp) … … 774 805 #endif /* HAVE_BPF */ 775 806 776 /* 807 /** 808 * Get the DLT type of the opened sendpacket 777 809 * Return -1 if we can't figure it out, else return the DLT_ value 778 810 */
