Network.sleela
lib/telephony-skya/Network.sleela · 113 line(s) · sleela
<< lib/telephony-skya/Network.sleela
SLeeLa Standard Library Definition.
Definition: Defines Network, the Skya transport-reachability Master Class —
local/public address and a careful, non-destructive NAT posture.
Network is an emblematic Skya module and a NATURAL / LOADABLE MODULE sharing
the common module contract (load / loaded / moduleName / describe). It is
deliberately descriptive and non-destructive: it never opens a firewall or
asserts a public mapping — authoritative NAT/firewall lifecycle stays with
the native SLeeLa port-awareness subsystem. The sockets live in Servers and
Communication; Network only describes the shape of reach. The runnable
orchestration example lives in telephony-skya/sleela/Network.sleela.
Family: telephony-skya. Native VM/OS work crosses an explicit bridge. >>
#sleela 2.5
material;
< Unified SLeeLa SDK front-end object. >
class Network {
< ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
<< Eleven catalogued attributes with getter/setter pairs, so a GUI, loader,
or catalog can read and (where appropriate) override this record.
Values are faithful to the subject's real origin where publicly known. >>
String metaVersion = "1.0.0";
int metaId = 10338;
String metaAuthor = "Kiro Agent";
String metaDate = "2026-10-16";
String metaCopyright = "SLeeLa project";
String metaTrademark = "none";
String metaCorporation = "none";
< metaOrigin: National | <nation> | International | Galactic >
String metaOrigin = "International";
String metaBirthDate = "2026-10-07";
< metaScienceRating: maturity/robustness on a 1..10 scale >
int metaScienceRating = 9;
< metaNationalSchedule: a real, citable instrument or "none" >
String metaNationalSchedule = "none";
String getMetaVersion() { return metaVersion; }
void setMetaVersion(String v) { metaVersion = v; }
int getMetaId() { return metaId; }
void setMetaId(int v) { metaId = v; }
String getAuthor() { return metaAuthor; }
void setAuthor(String v) { metaAuthor = v; }
String getDate() { return metaDate; }
void setDate(String v) { metaDate = v; }
String getCopyright() { return metaCopyright; }
void setCopyright(String v) { metaCopyright = v; }
String getTrademark() { return metaTrademark; }
void setTrademark(String v) { metaTrademark = v; }
String getCorporation() { return metaCorporation; }
void setCorporation(String v) { metaCorporation = v; }
String getOrigin() { return metaOrigin; }
void setOrigin(String v) { metaOrigin = v; }
String getBirthDate() { return metaBirthDate; }
void setBirthDate(String v) { metaBirthDate = v; }
int getScienceRating() { return metaScienceRating; }
void setScienceRating(int v) { metaScienceRating = v; }
String getNationalSchedule() { return metaNationalSchedule; }
void setNationalSchedule(String v) { metaNationalSchedule = v; }
static final String MODULE = "Network";
< reachability unknown; let PINGs decide >
static final int NAT_UNKNOWN = 0;
< reachable after local reflexive discovery >
static final int NAT_REFLEXIVE = 1;
< inbound feasibly reachable / already-mapped >
static final int NAT_DIRECT = 2;
int loadedFlag;
String localHost;
String publicHost;
int natPosture;
int routes;
void load() {
loadedFlag = 1;
localHost = "127.0.0.1";
publicHost = "";
natPosture = NAT_UNKNOWN;
routes = 0;
}
boolean loaded() { return loadedFlag == 1; }
String moduleName() { return MODULE; }
void bindLocal(String host) { localHost = host; }
void observePublic(String host) { publicHost = host; }
void observeNat(int posture) {
if (posture < NAT_UNKNOWN) { natPosture = NAT_UNKNOWN; }
else if (posture > NAT_DIRECT) { natPosture = NAT_DIRECT; }
else { natPosture = posture; }
}
void addRoute() { routes = routes + 1; }
boolean inboundFeasible() {
if (localHost == "127.0.0.1") { return true; }
return natPosture == NAT_DIRECT;
}
int posture() { return natPosture; }
int routeCount() { return routes; }
String local() { return localHost; }
String publicAddr() { return publicHost; }
String describe() {
return MODULE + " local=" + localHost + " public=" + publicHost
+ " nat=" + natPosture + " routes=" + routes
+ " inboundFeasible=" + inboundFeasible();
}
}