Adding lldp.json to the simulator

Moving the global on/off onto the LLDP page

Building a table of LLDP status from the S ports. Later on, if
we wish to implement an lldp receiver we can display the remote
details here

Adding support to the cmd parser for the lldp commands
This commit is contained in:
Rob Emery committed 2026-10-10 09:50:01 +01:00
1 parent 4f1a2f04d8
commit 58fd1a3ccc
9 files changed
+100 -20

No files matched your search

+17 -1
View File
@@ -454,6 +454,16 @@ void send_mtu(int s)
json_object_put(mtus);
}
void send_lldp(int s)
{
char *header = "HTTP/1.1 200 OK\r\n"
"Content-Type: application/json; charset=UTF-8\r\n\r\n";
char *body = "{\"on\": true, \"port_status\":[true,true,false,true,true,true,true,false,false]}";
write(s, header, strlen(header));
write(s, body, strlen(body));
}
void send_cmd_log(int s)
{
@@ -468,7 +478,6 @@ void send_cmd_log(int s)
}
}
void send_config(int s)
{
char *header = "HTTP/1.1 200 OK\r\n"
@@ -701,6 +710,13 @@ void launch(struct Server *server)
else
send_vlan(new_socket, vlan);
goto done;
} else if (!strncmp(&buffer[4], "/lldp.json", 10)) {
printf("LLDP request");
if (!authenticated)
send_unauthorized(new_socket);
else
send_lldp(new_socket);
goto done;
} else if (!strncmp(&buffer[4], "/cmd_log", 8)) {
printf("Request cmd_log\n");
if (!authenticated)