summaryrefslogtreecommitdiff
path: root/devdocs/elisp/misc-network.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/elisp/misc-network.html
new repository
Diffstat (limited to 'devdocs/elisp/misc-network.html')
-rw-r--r--devdocs/elisp/misc-network.html56
1 files changed, 56 insertions, 0 deletions
diff --git a/devdocs/elisp/misc-network.html b/devdocs/elisp/misc-network.html
new file mode 100644
index 00000000..0bc550f5
--- /dev/null
+++ b/devdocs/elisp/misc-network.html
@@ -0,0 +1,56 @@
+ <h3 class="section">Misc Network Facilities</h3> <p>These additional functions are useful for creating and operating on network connections. Note that they are supported only on some systems. </p> <dl> <dt id="network-interface-list">Function: <strong>network-interface-list</strong> <em>&amp;optional full family</em>
+</dt> <dd>
+<p>This function returns a list describing the network interfaces of the machine you are using. The value is an alist whose elements have the form <code>(<var>ifname</var> . <var>address</var>)</code>. <var>ifname</var> is a string naming the interface, <var>address</var> has the same form as the <var>local-address</var> and <var>remote-address</var> arguments to <code>make-network-process</code>, i.e. a vector of integers. By default both IPv4 and IPv6 addresses are returned if possible. </p> <p>Optional argument <var>full</var> non-<code>nil</code> means to instead return a list of one or more elements of the form <code>(<var>ifname</var> <var>addr</var> <var>bcast</var> <var>netmask</var>)</code>. <var>ifname</var> is a non-unique string naming the interface. <var>addr</var>, <var>bcast</var>, and <var>netmask</var> are vectors of integers detailing the IP address, broadcast address, and network mask. </p> <p>Optional argument <var>family</var> specified as symbol <code>ipv4</code> or <code>ipv6</code> restricts the returned information to IPv4 and IPv6 addresses respectively, independently of the value of <var>full</var>. Specifying <code>ipv6</code> when IPv6 support is not available will result in an error being signaled. </p> <p>Some examples: </p> <div class="example"> <pre class="example">(network-interface-list) ⇒
+(("vmnet8" .
+ [172 16 76 1 0])
+ ("vmnet1" .
+ [172 16 206 1 0])
+ ("lo0" .
+ [65152 0 0 0 0 0 0 1 0])
+ ("lo0" .
+ [0 0 0 0 0 0 0 1 0])
+ ("lo0" .
+ [127 0 0 1 0]))
+</pre>
+</div> <div class="example"> <pre class="example">(network-interface-list t) ⇒
+(("vmnet8"
+ [172 16 76 1 0]
+ [172 16 76 255 0]
+ [255 255 255 0 0])
+ ("vmnet1"
+ [172 16 206 1 0]
+ [172 16 206 255 0]
+ [255 255 255 0 0])
+ ("lo0"
+ [65152 0 0 0 0 0 0 1 0]
+ [65152 0 0 0 65535 65535 65535 65535 0]
+ [65535 65535 65535 65535 0 0 0 0 0])
+ ("lo0"
+ [0 0 0 0 0 0 0 1 0]
+ [0 0 0 0 0 0 0 1 0]
+ [65535 65535 65535 65535 65535 65535 65535 65535 0])
+ ("lo0"
+ [127 0 0 1 0]
+ [127 255 255 255 0]
+ [255 0 0 0 0]))
+</pre>
+</div> </dd>
+</dl> <dl> <dt id="network-interface-info">Function: <strong>network-interface-info</strong> <em>ifname</em>
+</dt> <dd>
+<p>This function returns information about the network interface named <var>ifname</var>. The value is a list of the form <code>(<var>addr</var> <var>bcast</var> <var>netmask</var> <var>hwaddr</var> <var>flags</var>)</code>. </p> <dl compact> <dt><var>addr</var></dt> <dd><p>The Internet protocol address. </p></dd> <dt><var>bcast</var></dt> <dd><p>The broadcast address. </p></dd> <dt><var>netmask</var></dt> <dd><p>The network mask. </p></dd> <dt><var>hwaddr</var></dt> <dd><p>The layer 2 address (Ethernet MAC address, for instance). </p></dd> <dt><var>flags</var></dt> <dd><p>The current flags of the interface. </p></dd> </dl> <p>Note that this function returns only IPv4 information. </p>
+</dd>
+</dl> <dl> <dt id="format-network-address">Function: <strong>format-network-address</strong> <em>address &amp;optional omit-port</em>
+</dt> <dd>
+<p>This function converts the Lisp representation of a network address to a string. </p> <p>A five-element vector <code>[<var>a</var> <var>b</var> <var>c</var> <var>d</var> <var>p</var>]</code> represents an IPv4 address <var>a</var>.<var>b</var>.<var>c</var>.<var>d</var> and port number <var>p</var>. <code>format-network-address</code> converts that to the string <code>"<var>a</var>.<var>b</var>.<var>c</var>.<var>d</var>:<var>p</var>"</code>. </p> <p>A nine-element vector <code>[<var>a</var> <var>b</var> <var>c</var> <var>d</var> <var>e</var>
+<var>f</var> <var>g</var> <var>h</var> <var>p</var>]</code> represents an IPv6 address along with a port number. <code>format-network-address</code> converts that to the string <code>"[<var>a</var>:<var>b</var>:<var>c</var>:<var>d</var>:<var>e</var>:<var>f</var>:<var>g</var>:<var>h</var>]:<var>p</var>"</code>. </p> <p>If the vector does not include the port number, <var>p</var>, or if <var>omit-port</var> is non-<code>nil</code>, the result does not include the <code>:<var>p</var></code> suffix. </p>
+</dd>
+</dl> <dl> <dt id="network-lookup-address-info">Function: <strong>network-lookup-address-info</strong> <em>name &amp;optional family</em>
+</dt> <dd>
+<p>This function is used to perform hostname lookups on <var>name</var>, which is expected to be an ASCII-only string, otherwise an error is signaled. Call <code>puny-encode-domain</code> on <var>name</var> first if you wish to lookup internationalized hostnames. </p> <p>If successful it returns a list of Lisp representations of network addresses, otherwise it returns <code>nil</code>. In the latter case, it also displays the error message hopefully explaining what went wrong. </p> <p>By default both IPv4 and IPv6 lookups are attempted. The optional argument <var>family</var> controls this behavior, specifying the symbol <code>ipv4</code> or <code>ipv6</code> restricts lookups to IPv4 and IPv6 respectively. </p>
+</dd>
+</dl><div class="_attribution">
+ <p class="_attribution-p">
+ Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
+ <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Misc-Network.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Misc-Network.html</a>
+ </p>
+</div>