forked from kay/RouterOS
Neuer Tab: eine Tabelle pro physischem Ethernet/WLAN-Port mit den dort gefundenen Geräten (Name, IP, MAC, Fest/Dynamisch/Kein-DHCP), gebaut aus DHCP-Leases + ARP + Bridge-Host-Tabelle. Rechtsklick auf ein dynamisches Gerät -> "Feste IP zuweisen" (RouterOS' "Make Static", per /ip dhcp-server lease make-static), mit Bestätigungsdialog und Session-Backup vor dem ersten Schreibvorgang (geteilter Mechanismus mit dem Experte-Tab). Vier reale Bugs live gefunden und gefixt (siehe HANDOFF.md Bug 14-17): - "print terse" gibt das "dynamic"-Feld von /ip dhcp-server lease nie aus, in keinem Zustand -> Status kommt jetzt über RouterOS' find/get gegen die interne Eigenschaft, nicht aus gelesenen Feldern. - fetchMenuItems' .id-Positionsüberlagerung ordnete für dieses Menü die falsche .id der falschen Zeile zu -> Erkennung und make-static-Ziel laufen jetzt über die MAC-Adresse statt .id. - Ein SwiftUI-.confirmationDialog löschte sein eigenes Ziel-Objekt vor der Ausführung der bestätigten Aktion (Setter feuert bei jedem Knopfdruck, nicht nur Abbrechen) -> Dialog-Sichtbarkeit und Nutzlast entkoppelt, wie in BackupListView. - Die eigene Verifikations-Abfrage (get [find ...] feld als ein kombinierter Befehl) war selbst eine nie verifizierte Annahme und lieferte falsche Negative -> ersetzt durch :foreach aus zwei einzeln bestätigten Bausteinen (find, get <id> feld). RouterOSCommand bekommt einen neuen .action-Operationstyp für RouterOS-"Menü-spezifische Befehle" jenseits von add/set/remove (aktuell nur make-static). HANDOFF.md/CHATLOG.md mit allen vier Bugs, neuen Milestones M11/M12 und offenen Punkten aktualisiert. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CTgRxJTzaQwaRkngbaE1GJ
33 lines
1.9 KiB
Swift
33 lines
1.9 KiB
Swift
import Foundation
|
|
|
|
enum RouterOSTransportKind: Equatable {
|
|
case rest
|
|
case ssh
|
|
}
|
|
|
|
protocol RouterOSTransport: AnyObject {
|
|
var kind: RouterOSTransportKind { get }
|
|
func connect() async throws
|
|
func fetchDeviceInfo() async throws -> RouterDeviceInfo
|
|
func fetchInterfaces() async throws -> [NetworkInterface]
|
|
func fetchFirewallRuleCounts() async throws -> FirewallRuleCounts
|
|
/// Lists existing items under any RouterOS menu — the generic read side of the Expert tool,
|
|
/// works for menus without a curated `RouterOSMenuSchema` too.
|
|
func fetchMenuItems(menuPath: String, restPath: String) async throws -> [RouterOSMenuItem]
|
|
/// Values of one field across every item matching a `find` filter, via RouterOS' own
|
|
/// `find`/`get` — for properties "print terse" doesn't expose as a key=value field at all.
|
|
/// Confirmed live: a DHCP server lease's "dynamic" state never appears in `print terse`
|
|
/// output in either state (checked against a real hEX lease both before and after converting
|
|
/// it to static via `/ip dhcp-server lease print`'s flags column), even though
|
|
/// `find dynamic=no` can still filter on it directly against RouterOS' internal data model.
|
|
/// Deliberately does NOT return `.id` (an earlier version did) — `fetchMenuItems`' `.id`
|
|
/// overlay pairs two separate commands' output by row position, and that pairing was
|
|
/// confirmed live to mis-assign `.id` to the wrong row for this exact menu (two leases, the
|
|
/// wrong one showed "already static"). `returnField` should be something read directly off
|
|
/// the same `print terse` line (e.g. "mac-address"), so the caller never depends on that
|
|
/// overlay at all for this lookup.
|
|
func fetchFieldValues(menuPath: String, restPath: String, whereField: String, whereValue: String, returnField: String) async throws -> Set<String>
|
|
func apply(_ command: RouterOSCommand) async throws
|
|
func disconnect() async
|
|
}
|