Add network unit 18 on switch forwarding in detail.

Cover CAM learning plus cut-through, store-and-forward and fragment-free modes.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
pepaskopec-blip 2026-09-14 12:39:49 +02:00
commit 07631f7837
5 changed files with 139 additions and 18 deletions

View file

@ -31,7 +31,7 @@ GTK 4 interface.
German learning path German learning path
- **Správa počítačových sítí / Computer Network Administration** is open too - **Správa počítačových sítí / Computer Network Administration** is open too
(shown with a Wi-Fi icon) and leads to a 30-unit computer-networks path; (shown with a Wi-Fi icon) and leads to a 30-unit computer-networks path;
**units 1–17 are playable**, units 18–30 are locked placeholders **units 1–18 are playable**, units 19–30 are locked placeholders
- **Technické vybavení / Computer Hardware** is open (chip icon) and leads - **Technické vybavení / Computer Hardware** is open (chip icon) and leads
to a 10-unit hardware path; **units 1–3 are playable**, units 4–10 are to a 10-unit hardware path; **units 1–3 are playable**, units 4–10 are
locked placeholders locked placeholders
@ -62,7 +62,7 @@ GTK 4 interface.
- **Hints & model answers** – in exercises where you write or complete a German - **Hints & model answers** – in exercises where you write or complete a German
sentence the Czech meaning is shown right away as a hint, and clicking the sentence the Czech meaning is shown right away as a hint, and clicking the
check button also reveals the correct German sentence so you can compare check button also reveals the correct German sentence so you can compare
- **Computer networks path** – seventeen unlocked units (theory slides + practice): - **Computer networks path** – eighteen unlocked units (theory slides + practice):
1. **Výpočet IP adres / IP Address Calculation** – 4-slide VLSM walkthrough 1. **Výpočet IP adres / IP Address Calculation** – 4-slide VLSM walkthrough
and four interactive subnetting tasks (prefix, network, broadcast, host and four interactive subnetting tasks (prefix, network, broadcast, host
range) with check and “show solution” range) with check and “show solution”
@ -81,7 +81,8 @@ GTK 4 interface.
14. Optika – slides + quiz 14. Optika – slides + quiz
15. Ochrana a montáž optiky – slides + quiz 15. Ochrana a montáž optiky – slides + quiz
16. Metody přístupu – slides + quiz 16. Metody přístupu – slides + quiz
17. Aktivní prvky – slides + quiz 17. Aktivní prvky – slides + quiz
18. Switch (podrobně) – slides + quiz
Progress for networks is saved to `progress/net.conf` (one flag per unit); Progress for networks is saved to `progress/net.conf` (one flag per unit);
completed network units show a checkmark on the path and count in Statistics completed network units show a checkmark on the path and count in Statistics
- **Computer hardware path** – three unlocked units (theory slides + quiz): - **Computer hardware path** – three unlocked units (theory slides + quiz):
@ -304,11 +305,11 @@ When launched, the application shows the welcome screen. From there:
unit 2 or **"Bei uns zu Hause"** for unit 3, then pick any bubble to start unit 2 or **"Bei uns zu Hause"** for unit 3, then pick any bubble to start
an exercise. Units 2 and 3 are available even if the earlier units are not an exercise. Units 2 and 3 are available even if the earlier units are not
finished yet. finished yet.
5. On the networks path, units **1–17** are open. Unit 1 (**Výpočet IP adres**) 5. On the networks path, units **1–18** are open. Unit 1 (**Výpočet IP adres**)
walks through four VLSM slides and then four interactive subnetting tasks walks through four VLSM slides and then four interactive subnetting tasks
with check / “show solution”. Units 2–17 each have theory slides followed by with check / “show solution”. Units 2–18 each have theory slides followed by
a multiple-choice quiz (basic concepts through active devices like switches a multiple-choice quiz (basic concepts through switch forwarding modes).
and routers). Units 18–30 stay locked placeholders. Units 19–30 stay locked placeholders.
6. On the hardware path, units **1–3** are open (architecture / von Neumann, 6. On the hardware path, units **1–3** are open (architecture / von Neumann,
computer history generations, bit & byte), each with slides and a quiz. computer history generations, bit & byte), each with slides and a quiz.
Units 4–10 stay locked. Units 4–10 stay locked.
@ -459,7 +460,7 @@ moderním GTK 4 rozhraním stylovaným přes CSS.
- **Deutsch** je otevřený (bublina s německou vlajkou) a vede na německou - **Deutsch** je otevřený (bublina s německou vlajkou) a vede na německou
učební cestu učební cestu
- **Správa počítačových sítí** je také otevřená (ikona Wi‑Fi) a vede na cestu - **Správa počítačových sítí** je také otevřená (ikona Wi‑Fi) a vede na cestu
s 30 jednotkami; **jednotky 1–17 jsou hratelné**, 18–30 jsou zamčené s 30 jednotkami; **jednotky 1–18 jsou hratelné**, 19–30 jsou zamčené
placeholdery placeholdery
- **Technické vybavení** je otevřené (ikona čipu) a vede na cestu - **Technické vybavení** je otevřené (ikona čipu) a vede na cestu
s 10 jednotkami; **jednotky 1–3 jsou hratelné**, 4–10 jsou zamčené s 10 jednotkami; **jednotky 1–3 jsou hratelné**, 4–10 jsou zamčené
@ -485,7 +486,7 @@ moderním GTK 4 rozhraním stylovaným přes CSS.
„Was siehst du?“, řazení vět, chybějící písmena) „Was siehst du?“, řazení vět, chybějící písmena)
- **Nápovědy a vzorové odpovědi** – u psaných / doplňovaných vět je hned - **Nápovědy a vzorové odpovědi** – u psaných / doplňovaných vět je hned
český význam; po kontrole se ukáže i správná německá věta český význam; po kontrole se ukáže i správná německá věta
- **Cesta počítačových sítí** – sedmnáct odemčených jednotek (snímky + cvičení): - **Cesta počítačových sítí** – osmnáct odemčených jednotek (snímky + cvičení):
1. **Výpočet IP adres** – 4 snímky VLSM a čtyři interaktivní úlohy 1. **Výpočet IP adres** – 4 snímky VLSM a čtyři interaktivní úlohy
(prefix, síť, broadcast, rozsah uzlů) s kontrolou a „ukázat řešení“ (prefix, síť, broadcast, rozsah uzlů) s kontrolou a „ukázat řešení“
2. Základní pojmy a rozdělení sítí – snímky + kvíz 2. Základní pojmy a rozdělení sítí – snímky + kvíz
@ -503,7 +504,8 @@ moderním GTK 4 rozhraním stylovaným přes CSS.
14. Optika – snímky + kvíz 14. Optika – snímky + kvíz
15. Ochrana a montáž optiky – snímky + kvíz 15. Ochrana a montáž optiky – snímky + kvíz
16. Metody přístupu – snímky + kvíz 16. Metody přístupu – snímky + kvíz
17. Aktivní prvky – snímky + kvíz 17. Aktivní prvky – snímky + kvíz
18. Switch (podrobně) – snímky + kvíz
Postup u sítí se ukládá do `progress/net.conf` (příznak na jednotku); Postup u sítí se ukládá do `progress/net.conf` (příznak na jednotku);
dokončené jednotky mají fajfku na cestě a počítají se ve Statistikách dokončené jednotky mají fajfku na cestě a počítají se ve Statistikách
- **Cesta technického vybavení** – tři odemčené jednotky (snímky + kvíz): - **Cesta technického vybavení** – tři odemčené jednotky (snímky + kvíz):
@ -724,10 +726,10 @@ Po spuštění se zobrazí úvodní obrazovka. Odtud:
4. Otevřete **"Neue Freunde"** (jednotka 1), **"Aus aller Welt"** (2) nebo 4. Otevřete **"Neue Freunde"** (jednotka 1), **"Aus aller Welt"** (2) nebo
**"Bei uns zu Hause"** (3) a vyberte bublinu cvičení. Jednotky 2 a 3 jdou **"Bei uns zu Hause"** (3) a vyberte bublinu cvičení. Jednotky 2 a 3 jdou
otevřít i bez dokončení předchozích. otevřít i bez dokončení předchozích.
5. Na síťové cestě jsou otevřené jednotky **1–17**. Jednotka 1 (**Výpočet IP 5. Na síťové cestě jsou otevřené jednotky **1–18**. Jednotka 1 (**Výpočet IP
adres**) má 4 snímky VLSM a pak 4 interaktivní úlohy s kontrolou / adres**) má 4 snímky VLSM a pak 4 interaktivní úlohy s kontrolou /
„ukázat řešení“. Jednotky 2–17 mají snímky teorie a kvíz s výběrem „ukázat řešení“. Jednotky 2–18 mají snímky teorie a kvíz s výběrem
(od základních pojmů po aktivní prvky). Jednotky 18–30 zůstávají zamčené. (od základních pojmů po switch podrobně). Jednotky 19–30 zůstávají zamčené.
6. Na cestě technického vybavení jsou otevřené jednotky **1–3** (architektura / 6. Na cestě technického vybavení jsou otevřené jednotky **1–3** (architektura /
von Neumann, historie generací, bit a byte), každá se snímky a kvízem. von Neumann, historie generací, bit a byte), každá se snímky a kvízem.
Jednotky 4–10 zůstávají zamčené. Jednotky 4–10 zůstávají zamčené.
@ -771,8 +773,8 @@ exercise_u1.c cvičení jednotky 1 („Neue Freunde“)
exercise_u2.c cvičení jednotky 2 („Aus aller Welt“) exercise_u2.c cvičení jednotky 2 („Aus aller Welt“)
exercise_u3.c cvičení jednotky 3 („Bei uns zu Hause“) exercise_u3.c cvičení jednotky 3 („Bei uns zu Hause“)
settings.c panel nastavení (režim, téma, jazyk) settings.c panel nastavení (režim, téma, jazyk)
net.c cesta počítačových sítí (30 uzlů), jednotky 1–17 net.c cesta počítačových sítí (30 uzlů), jednotky 1–18
(1: VLSM cvičení; 2–17: kvízy s výběrem) (1: VLSM cvičení; 2–18: kvízy s výběrem)
hw.c cesta technického vybavení (10 uzlů), jednotky 1–3 hw.c cesta technického vybavení (10 uzlů), jednotky 1–3
(architektura, historie, bit/byte + kvízy) (architektura, historie, bit/byte + kvízy)
main.c vstupní bod aplikace a zapojení stránek main.c vstupní bod aplikace a zapojení stránek

20
i18n.c
View file

@ -299,6 +299,12 @@ const TrEntry tr_ui[] = {
"7 slides about hubs, switches and routers, then a quiz."}, "7 slides about hubs, switches and routers, then a quiz."},
{"net_ex17_title", "Kvíz: aktivní prvky", {"net_ex17_title", "Kvíz: aktivní prvky",
"Quiz: active network devices"}, "Quiz: active network devices"},
{"net_unit18", "Switch (podrobně)",
"Switch in detail"},
{"net_unit18_sub", "5 snímků o CAM a přepínání a pak kvíz.",
"5 slides about CAM and switching modes, then a quiz."},
{"net_ex18_title", "Kvíz: switch podrobně",
"Quiz: switch in detail"},
{"net_quiz_intro", {"net_quiz_intro",
"Vyberte u každé otázky jednu správnou odpověď a stiskněte Zkontrolovat.", "Vyberte u každé otázky jednu správnou odpověď a stiskněte Zkontrolovat.",
"Choose one correct answer for each question and press Check."}, "Choose one correct answer for each question and press Check."},
@ -334,6 +340,8 @@ const TrEntry tr_ui[] = {
"Quiz on access methods"}, "Quiz on access methods"},
{"net_quiz17_head", "Kvíz k aktivním prvkům", {"net_quiz17_head", "Kvíz k aktivním prvkům",
"Quiz on active network devices"}, "Quiz on active network devices"},
{"net_quiz18_head", "Kvíz ke switchi podrobně",
"Quiz on switches in detail"},
{"net_slide_next", "Další", "Next"}, {"net_slide_next", "Další", "Next"},
{"net_slide_prev", "Zpět", "Back"}, {"net_slide_prev", "Zpět", "Back"},
{"net_slide_start", "Přejít na cvičení", "Go to the exercise"}, {"net_slide_start", "Přejít na cvičení", "Go to the exercise"},
@ -607,6 +615,18 @@ const TrEntry tr_content[] = {
"A router = network layer, packets and IP, connects networks"}, "A router = network layer, packets and IP, connects networks"},
{"Gateway převádí mezi odlišnými architekturami/protokoly", NULL, {"Gateway převádí mezi odlišnými architekturami/protokoly", NULL,
"A gateway converts between different architectures/protocols"}, "A gateway converts between different architectures/protocols"},
{"MAC adresy switch ukládá do CAM tabulky", NULL,
"A switch stores MAC addresses in the CAM table"},
{"Podle CAM tabulky posílá rámec jen na cílový port", NULL,
"Using the CAM table, it forwards a frame only to the target port"},
{"Cut-through čte adresu příjemce a hned přeposílá", NULL,
"Cut-through reads the destination address and forwards immediately"},
{"Cut-through je rychlý, ale propustí i chyby", NULL,
"Cut-through is fast but also forwards errors"},
{"Store-and-forward kontroluje celý rámec včetně CRC", NULL,
"Store-and-forward checks the whole frame including CRC"},
{"Fragment-free čte prvních 64 bytů kvůli kolizím", NULL,
"Fragment-free reads the first 64 bytes for collision detection"},
{"čtrnáct", NULL, "fourteen"}, {"čtrnáct", NULL, "fourteen"},
{"sedmnáct", NULL, "seventeen"}, {"sedmnáct", NULL, "seventeen"},
{"dvacet", NULL, "twenty"}, {"dvacet", NULL, "twenty"},

1
main.c
View file

@ -262,6 +262,7 @@ void activate(GtkApplication *app, gpointer user_data) {
{"netunit15", "netex15", build_net_unit15_page, build_net_unit15_exercise_page}, {"netunit15", "netex15", build_net_unit15_page, build_net_unit15_exercise_page},
{"netunit16", "netex16", build_net_unit16_page, build_net_unit16_exercise_page}, {"netunit16", "netex16", build_net_unit16_page, build_net_unit16_exercise_page},
{"netunit17", "netex17", build_net_unit17_page, build_net_unit17_exercise_page}, {"netunit17", "netex17", build_net_unit17_page, build_net_unit17_exercise_page},
{"netunit18", "netex18", build_net_unit18_page, build_net_unit18_exercise_page},
}; };
for (guint i = 0; i < G_N_ELEMENTS(net_pages); i++) { for (guint i = 0; i < G_N_ELEMENTS(net_pages); i++) {

View file

@ -65,7 +65,8 @@
#define NET15_SLIDES 3 #define NET15_SLIDES 3
#define NET16_SLIDES 4 #define NET16_SLIDES 4
#define NET17_SLIDES 7 #define NET17_SLIDES 7
#define NET_LESSONS 17 #define NET18_SLIDES 5
#define NET_LESSONS 18
#define HW_UNITS 10 #define HW_UNITS 10
#define HW_LESSONS 3 #define HW_LESSONS 3
#define HW_SLIDES 3 #define HW_SLIDES 3
@ -1092,6 +1093,7 @@ GtkWidget *build_net_unit14_page(void);
GtkWidget *build_net_unit15_page(void); GtkWidget *build_net_unit15_page(void);
GtkWidget *build_net_unit16_page(void); GtkWidget *build_net_unit16_page(void);
GtkWidget *build_net_unit17_page(void); GtkWidget *build_net_unit17_page(void);
GtkWidget *build_net_unit18_page(void);
GtkWidget *net_qz_combo(void); GtkWidget *net_qz_combo(void);
void net_qz_set_prefix(GtkComboBoxText *c, int pfx); void net_qz_set_prefix(GtkComboBoxText *c, int pfx);
int net_qz_prefix(GtkComboBoxText *c); int net_qz_prefix(GtkComboBoxText *c);
@ -1122,6 +1124,7 @@ GtkWidget *build_net_unit14_exercise_page(void);
GtkWidget *build_net_unit15_exercise_page(void); GtkWidget *build_net_unit15_exercise_page(void);
GtkWidget *build_net_unit16_exercise_page(void); GtkWidget *build_net_unit16_exercise_page(void);
GtkWidget *build_net_unit17_exercise_page(void); GtkWidget *build_net_unit17_exercise_page(void);
GtkWidget *build_net_unit18_exercise_page(void);
void activate(GtkApplication *app, gpointer user_data); void activate(GtkApplication *app, gpointer user_data);
int main(int argc, char **argv); int main(int argc, char **argv);

99
net.c
View file

@ -5,7 +5,7 @@
NetLesson net_lessons[NET_LESSONS] = { NetLesson net_lessons[NET_LESSONS] = {
/* UI unit N maps to lesson content: unit 1 = IP/VLSM (extra); /* UI unit N maps to lesson content: unit 1 = IP/VLSM (extra);
* units 2–17 = source topics (Základní pojmy … aktivní prvky). */ * units 2–18 = source topics (Základní pojmy … switch podrobně). */
{ .n_slides = NET_SLIDES, .unit_page = "netunit1", .ex_page = "netex1" }, { .n_slides = NET_SLIDES, .unit_page = "netunit1", .ex_page = "netex1" },
{ .n_slides = NET2_SLIDES, .unit_page = "netunit2", .ex_page = "netex2" }, { .n_slides = NET2_SLIDES, .unit_page = "netunit2", .ex_page = "netex2" },
{ .n_slides = NET3_SLIDES, .unit_page = "netunit3", .ex_page = "netex3" }, { .n_slides = NET3_SLIDES, .unit_page = "netunit3", .ex_page = "netex3" },
@ -23,6 +23,7 @@ NetLesson net_lessons[NET_LESSONS] = {
{ .n_slides = NET15_SLIDES, .unit_page = "netunit15", .ex_page = "netex15" }, { .n_slides = NET15_SLIDES, .unit_page = "netunit15", .ex_page = "netex15" },
{ .n_slides = NET16_SLIDES, .unit_page = "netunit16", .ex_page = "netex16" }, { .n_slides = NET16_SLIDES, .unit_page = "netunit16", .ex_page = "netex16" },
{ .n_slides = NET17_SLIDES, .unit_page = "netunit17", .ex_page = "netex17" }, { .n_slides = NET17_SLIDES, .unit_page = "netunit17", .ex_page = "netex17" },
{ .n_slides = NET18_SLIDES, .unit_page = "netunit18", .ex_page = "netex18" },
}; };
void net_paragraph(GtkWidget *box, const char *text) { void net_paragraph(GtkWidget *box, const char *text) {
@ -464,7 +465,7 @@ void net_add_node(GtkFixed *fixed, int index) {
"net_unit1", "net_unit2", "net_unit3", "net_unit4", "net_unit5", "net_unit1", "net_unit2", "net_unit3", "net_unit4", "net_unit5",
"net_unit6", "net_unit7", "net_unit8", "net_unit9", "net_unit10", "net_unit6", "net_unit7", "net_unit8", "net_unit9", "net_unit10",
"net_unit11", "net_unit12", "net_unit13", "net_unit14", "net_unit15", "net_unit11", "net_unit12", "net_unit13", "net_unit14", "net_unit15",
"net_unit16", "net_unit17" "net_unit16", "net_unit17", "net_unit18"
}; };
card = gtk_button_new(); card = gtk_button_new();
@ -1583,6 +1584,63 @@ GtkWidget *build_net_unit17_page(void) {
slides, NET17_SLIDES); slides, NET17_SLIDES);
} }
GtkWidget *build_net_unit18_page(void) {
static const NetSlide slides[NET18_SLIDES] = {
{
"1 / 5 • Funkce", "Učení MAC adres",
"Tip: CAM tabulka = adresa → port",
{
"Switch se učí MAC adresy odesílatelů.",
"Ukládá je do CAM tabulky.",
"Rámce pak posílá jen na konkrétní port.",
NULL,
},
},
{
"2 / 5 • Metody", "Tři způsoby přepínání",
NULL,
{
"Cut-through, store-and-forward a fragment-free.",
"Liší se rychlostí a kontrolou chyb.",
NULL,
},
},
{
"3 / 5 • Cut-through", "Hned po adrese",
NULL,
{
"Čte jen adresu příjemce a hned posílá dál.",
"Nejrychlejší metoda.",
"Nevýhoda: posílá i chybné rámce.",
NULL,
},
},
{
"4 / 5 • Store-and-forward", "Celý rámec + CRC",
NULL,
{
"Přijme celý rámec a zkontroluje CRC.",
"Teprve pak rámec pošle.",
"Nejpomalejší, ale nejbezpečnější metoda.",
NULL,
},
},
{
"5 / 5 • Fragment-free", "Modifikovaný cut-through",
"Tip: prvních 64 bytů = detekce kolizí",
{
"Čte prvních 64 bytů rámce.",
"To stačí k odhalení kolizních fragmentů.",
"Kompromis mezi rychlostí a bezpečností.",
NULL,
},
},
};
return build_net_unit_page(&net_lessons[17], "net_unit18", "net_unit18_sub",
slides, NET18_SLIDES);
}
/* Solutions below are the canonical "largest subnet first, in order A–D" /* Solutions below are the canonical "largest subnet first, in order A–D"
* allocation. Scenario 3 does not fit into a /24 as written, which is why * allocation. Scenario 3 does not fit into a /24 as written, which is why
* its "solution" explains that instead. */ * its "solution" explains that instead. */
@ -2746,3 +2804,40 @@ GtkWidget *build_net_unit17_exercise_page(void) {
(int)G_N_ELEMENTS(net17_qs)); (int)G_N_ELEMENTS(net17_qs));
} }
const ChoiceQ net18_qs[] = {
{"Switch se učí MAC adresy a ukládá je do:",
{"CAM tabulky", "Jen DNS cache", "Jen ARP bez portů", "Jen OSPF"}, 4, 0},
{"Díky CAM tabulce switch posílá rámce:",
{"Jen na konkrétní port", "Vždy na všechny porty jako hub",
"Jen na routery", "Jen přes laser"}, 4, 0},
{"Cut-through přepínání:",
{"Čte jen adresu příjemce a hned posílá",
"Vždy čeká na celé CRC", "Nikdy neposílá rámce",
"Pracuje jen s IP směrováním"}, 4, 0},
{"Nevýhoda cut-through je:",
{"Že posílá i chybné rámce", "Že je nejpomalejší",
"Že nemá MAC adresy", "Že vyžaduje gateway"}, 4, 0},
{"Store-and-forward:",
{"Přijme celý rámec, zkontroluje CRC a pak pošle",
"Čte jen první 2 byty", "Nikdy nekontroluje chyby",
"Funguje jen jako Aloha"}, 4, 0},
{"Fragment-free (modifikovaný cut-through) čte:",
{"Prvních 64 bytů (detekce kolizí)", "Jen poslední byte",
"Celý paket IP včetně směrování", "Jen SMTP hlavičku"}, 4, 0},
};
const char *net18_hints[] = {
"MAC adresy switch ukládá do CAM tabulky",
"Podle CAM tabulky posílá rámec jen na cílový port",
"Cut-through čte adresu příjemce a hned přeposílá",
"Cut-through je rychlý, ale propustí i chyby",
"Store-and-forward kontroluje celý rámec včetně CRC",
"Fragment-free čte prvních 64 bytů kvůli kolizím",
};
GtkWidget *build_net_unit18_exercise_page(void) {
return build_net_mcq_page(17, "netunit18", "net_ex18_title", "net_quiz18_head",
net18_qs, net18_hints,
(int)G_N_ELEMENTS(net18_qs));
}