Send packets at layer 2 :param x: the packets :param inter: time (in s) between two packets (default 0) :param loop: send packet indefinitely (default 0) :param count: number of packets to send (default None=1) :param verbose: verbose mode (default None=conf.verb) :para
(x, # type: _PacketIterable
iface=None, # type: Optional[_GlobInterfaceType]
iface_hint=None, # type: Optional[str]
socket=None, # type: Optional[SuperSocket]
**kargs # type: Any
)
| 499 | |
| 500 | @conf.commands.register |
| 501 | def sendp(x, # type: _PacketIterable |
| 502 | iface=None, # type: Optional[_GlobInterfaceType] |
| 503 | iface_hint=None, # type: Optional[str] |
| 504 | socket=None, # type: Optional[SuperSocket] |
| 505 | **kargs # type: Any |
| 506 | ): |
| 507 | # type: (...) -> Optional[PacketList] |
| 508 | """ |
| 509 | Send packets at layer 2 |
| 510 | |
| 511 | :param x: the packets |
| 512 | :param inter: time (in s) between two packets (default 0) |
| 513 | :param loop: send packet indefinitely (default 0) |
| 514 | :param count: number of packets to send (default None=1) |
| 515 | :param verbose: verbose mode (default None=conf.verb) |
| 516 | :param realtime: check that a packet was sent before sending the next one |
| 517 | :param return_packets: return the sent packets |
| 518 | :param socket: the socket to use (default is conf.L3socket(kargs)) |
| 519 | :param iface: the interface to send the packets on |
| 520 | :param monitor: (not on linux) send in monitor mode |
| 521 | :returns: None |
| 522 | """ |
| 523 | if iface is None and iface_hint is not None and socket is None: |
| 524 | iface = conf.route.route(iface_hint)[0] |
| 525 | return _send( |
| 526 | x, |
| 527 | lambda iface: iface.l2socket(), |
| 528 | iface=iface, |
| 529 | socket=socket, |
| 530 | **kargs |
| 531 | ) |
| 532 | |
| 533 | |
| 534 | @conf.commands.register |
no test coverage detected