This shows you the differences between two versions of the page.
rl:labs:02:contents:00 [2023/10/02 16:19] vlad_andrei.badoiu created |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== 00. [10p] Implementare Hub ==== | ||
- | Vom implementa in Python funcționalitatea de baza a unui Hub. Cum am vazut si in cadrul exercitiului anterior, pentru fiecare frame primit, hub-ul îl trimite pe toate interfețele (link sau port). Mai jos gasim o descriere in pseudocod: | ||
- | |||
- | <code> | ||
- | while hub is powered on: | ||
- | for each port: | ||
- | if there is incoming data: | ||
- | read the incoming data | ||
- | for each other port: | ||
- | send the data to that port | ||
- | </code> | ||
- | |||
- | In acest exercițiu vom implementa un Hub in Python pornind de la un API simplu de primire si trimitere de frame-uri Ethernet. Vom porni | ||
- | de la scheletul de la [[https://gitlab.cs.pub.ro/rl/schelet-hub|urmatoarea adresa]]. Implementarea se va face in **hub.py**, in dreptul celor doua TODO-uri. | ||
- | |||
- | <code Python> | ||
- | # data este de tip byte array | ||
- | interface, data, length = recv_from_any_link() | ||
- | send_to_link(interface, data, length) | ||
- | </code> |