MLDv1 router-side protocol implementation for Python
Project description
MLD
This repository stores the implementation of MLDv1 router-side state machines. This can be used to detect multicast interest of directly connected hosts.
The goal of this repository/module is to facilitate maintainability of this MLD implementation since its code is used by other Python projects/modules:
Requirements
- Linux machine
- Python3 (we have written all code to be compatible with at least Python v3.3)
- pip (to install all dependencies)
Installation
pip3 install py-mld
How to use it?
# import module
from mld import InterfaceMLD
intf = InterfaceMLD(interface_name="eth0")
intf.enable() # start receiving MLD packets
# get information from a given multicast group
multicast_group_obj = intf.interface_state.get_group_state(group_ip="ff05::10:11:12")
interest = multicast_group_obj.has_members() # boolean that informs if there is
# multicast interest in this group
group_state = multicast_group_obj.state.print_state() # get string identifying
# the state in which this
# group is at
# get notified of interest changes on this group
class MulticastGroupNotifier:
def notify_membership(self, has_members):
print(has_members)
notifier = MulticastGroupNotifier()
multicast_group_obj.add_multicast_routing_entry(notifier)
# when there is a change of multicast interest (for example group ff05::10:11:12
# gets interested receivers), the object associated to this object is notified
# through "notify_membership" method with has_members=True
# if you no longer want to monitor the interest of ff05::10:11:12, remove the
# notifier from the group
multicast_group_obj.remove_multicast_routing_entry(notifier)
intf.remove() # stop receiving MLD packets
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py-mld-1.0.3.tar.gz.
File metadata
- Download URL: py-mld-1.0.3.tar.gz
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92028b2c45243d44aee30417395d9916fba01d6259b960c68bad42b9dd224956
|
|
| MD5 |
4eb210b1ae66c45712e8c0dd41391b74
|
|
| BLAKE2b-256 |
4ce901e8889f2055ef7017da47bf5c46615c4c38db2d818a2679de074c2c2169
|
File details
Details for the file py_mld-1.0.3-py3-none-any.whl.
File metadata
- Download URL: py_mld-1.0.3-py3-none-any.whl
- Upload date:
- Size: 24.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e0254323b38b383598d4361166f0b33f8b3657684d63de25928fc3e0d9772b2
|
|
| MD5 |
2fb2a455196bde0ef73761790ce74128
|
|
| BLAKE2b-256 |
fb56628376ddd5b89bb464c1f98d17480b2d0b16776c128dc56a51f701479187
|