An IP address is a self evaluating native data type in Inlab Scheme. The tag of an IP address is IPADDR_TYPE where a pointer points to a struct in6_addr which is kept in constant memory at a fixed address (as long as referenced).
The following external representations are supported by (read) and (print):
If an external representation cannot be interpreted as an IP address, it is read like an ordinary, non self-evaluating symbol.
> (define addr1 ::ffff:127.0.0.1) addr1 > (define addr2 '10.1.2.3) addr2 > (define addr3 2001:DB8::1:1) addr3 > (list addr1 addr2 addr3) (127.0.0.1 10.1.2.3 2001:db8::1:1) > (ipv4addr? addr1) #t > (ipv4addr? addr3) #f > (ipaddr? addr3) #t >
The data type IP Address Range (in short ipaddr-range) internally consists of two IP addresses:
IPv4 addresses are alway mapped to their 16 byte IPv6 equivalent with a prefix of ::ffff.
The start IP address is required to be less or equal to the end IP address, otherwise an error is signalled.
IP address ranges are self evaluating.
Here some valid examples for (read):
fe80::18b6:417b:3344:1170-fe80::18b6:417b:3344:ffff 10.10.10.0-10.10.10.10 ::ffff:127.0.0.0-::ffff:127.255.255.255
A MAC address is a self evaluating native data type in Inlab Scheme. The parser (read) accepts the usual 6-octet hexadecimal notation for Ethernet MAC addresses (case insensitive).
> a1:b2:b3:b4:c5:ff a1:b2:b3:b4:c5:ff > a1:b2:b3:b4:c5:Ff a1:b2:b3:b4:c5:ff > (macaddr? a1:b2:b3:b4:c5:ff) #t > (macaddr? 'a1:b2:b3:b4:c5:ff) #t > a1:b2:b3:b4:c5 ERROR! message : variable not found irritant : a1:b2:b3:b4:c5 expression: a1:b2:b3:b4:c5 continue : possible, continue with value as obtained from variable Error (? for help) >>
The data type Mac Address Range (in short macaddr-range) internally consists of two MAC addresses:
The start MAC address is required to be less or equal to the end MAC address, otherwise an error is signalled.
Mac address ranges are self evaluating.
Here some valid examples:
> 00:00:00:00:00:00-00:00:00:00:00:00 00:00:00:00:00:00-00:00:00:00:00:00 > '00:00:00:00:00:00-00:00:00:00:00:00 00:00:00:00:00:00-00:00:00:00:00:00 > 00:12:22:00:44:55-00:13:22:33:00:5f 00:12:22:00:44:55-00:13:22:33:00:5f
The data type interface allows the Scheme interpreter to access physical interfaces for packet reading and packet injection.
Networking frames are simply kept as strings within Inlab Scheme. This is possible since strings are byte vectors which can hold arbitrary data.