1
2[//000000001]: # (nettool \- nettool)
3[//000000002]: # (Generated from file 'nettool\.man' by tcllib/doctools with format 'markdown')
4[//000000003]: # (Copyright &copy; 2015\-2018 Sean Woods <yoda@etoyoc\.com>)
5[//000000004]: # (nettool\(n\) 0\.5\.2 tcllib "nettool")
6
7<hr> [ <a href="../../../../toc.md">Main Table Of Contents</a> &#124; <a
8href="../../../toc.md">Table Of Contents</a> &#124; <a
9href="../../../../index.md">Keyword Index</a> &#124; <a
10href="../../../../toc0.md">Categories</a> &#124; <a
11href="../../../../toc1.md">Modules</a> &#124; <a
12href="../../../../toc2.md">Applications</a> ] <hr>
13
14# NAME
15
16nettool \- Tools for networked applications
17
18# <a name='toc'></a>Table Of Contents
19
20  - [Table Of Contents](#toc)
21
22  - [Synopsis](#synopsis)
23
24  - [Description](#section1)
25
26  - [Commands](#section2)
27
28  - [Bugs, Ideas, Feedback](#section3)
29
30  - [Keywords](#keywords)
31
32  - [Category](#category)
33
34  - [Copyright](#copyright)
35
36# <a name='synopsis'></a>SYNOPSIS
37
38package require Tcl 8\.5
39package require nettool ?0\.5\.2?
40package require twapi 3\.1
41package require ip 0\.1
42package require platform 0\.1
43
44[__::cat__ *filename*](#1)
45[__::nettool::allocate\_port__ *startingport*](#2)
46[__::nettool::arp\_table__](#3)
47[__::nettool::broadcast\_list__](#4)
48[__::nettool::claim\_port__ *port* ?*protocol*?](#5)
49[__::nettool::cpuinfo__ *args*](#6)
50[__::nettool::find\_port__ *startingport*](#7)
51[__::nettool::hwid\_list__](#8)
52[__::nettool::ip\_list__](#9)
53[__::nettool::mac\_list__](#10)
54[__::nettool::network\_list__](#11)
55[__::nettool::port\_busy__ *port*](#12)
56[__::nettool::release\_port__ *port* ?*protocol*?](#13)
57[__::nettool::status__](#14)
58[__::nettool::user\_data\_root__ *appname*](#15)
59
60# <a name='description'></a>DESCRIPTION
61
62The __nettool__ package consists of a Pure\-tcl set of tools to perform
63common network functions that would normally require different packages or calls
64to exec, in a standard Tcl interface\. At present nettool has reference
65implementations for the following operating systems: Windows, MacOSX, and Linux
66\(debian\)\.
67
68# <a name='section2'></a>Commands
69
70  - <a name='1'></a>__::cat__ *filename*
71
72    Dump the contents of a file as a result\.
73
74  - <a name='2'></a>__::nettool::allocate\_port__ *startingport*
75
76    Attempt to allocate *startingport*, or, if busy, advance the port number
77    sequentially until a free port is found, and claim that port\. This command
78    uses a built\-in database of known ports to avoid returning a port which is
79    in common use\. \(For example: http \(80\)\)
80
81  - <a name='3'></a>__::nettool::arp\_table__
82
83    Dump the contents of this computer's Address Resolution Protocol \(ARP\)
84    table\. The result will be a Tcl formatted list: *macid* *ipaddrlist* \.\.\.
85
86  - <a name='4'></a>__::nettool::broadcast\_list__
87
88    Returns a list of broadcast addresses \(suitable for UDP multicast\) that this
89    computer is associated with\.
90
91  - <a name='5'></a>__::nettool::claim\_port__ *port* ?*protocol*?
92
93    Mark *port* as busy, optionally as either __tcp__ \(default\) or
94    __udp__\.
95
96  - <a name='6'></a>__::nettool::cpuinfo__ *args*
97
98    If no arguments are given, return a key/value list describing the CPU of the
99    present machine\. Included in the matrix is info on the number of
100    cores/processors that are available for parallel tasking, installed physical
101    RAM, and processor family\.
102
103    The exact contents are platform specific\.
104
105    For Linux, information is drawn from /proc/cpuinfo and /proc/meminfo\.
106
107    For MacOSX, information is drawn from sysctl
108
109    For Windows, information is draw from TWAPI\.
110
111    If arguments are given, the result with be a key/value list limited to the
112    fields requested\.
113
114    Canonical fields for all platforms:
115
116      * cpus
117
118        Count of CPUs/cores/execution units
119
120      * speed
121
122        Clock speed of processor\(s\) in Mhz
123
124      * memory
125
126        Installed RAM \(in MB\)
127
128      * vendor
129
130        Manufacturer
131
132  - <a name='7'></a>__::nettool::find\_port__ *startingport*
133
134    Return *startingport* if it is available, or the next free port after
135    *startingport*\. Note: Unlike __::nettool::allocate\_port__, this
136    command does not claim the port\.
137
138    This command uses a built\-in database of known ports to avoid returning a
139    port which is in common use\. \(For example: http \(80\)\)
140
141  - <a name='8'></a>__::nettool::hwid\_list__
142
143    Return a list of hardware specific identifiers from this computer\. The
144    source and content will vary by platform\.
145
146    For MacOSX, the motherboard serial number and macids for all network devices
147    is returned\.
148
149    For Windows, the volume serial number of C and macids for all network
150    devices is returned\.
151
152    For Linux, macids for all network devices is returned\.
153
154  - <a name='9'></a>__::nettool::ip\_list__
155
156    Return a list of IP addresses associated with this computer\.
157
158  - <a name='10'></a>__::nettool::mac\_list__
159
160    Return a list of MACIDs for the network cards attached to this machine\. The
161    MACID of the primary network card is returned first\.
162
163  - <a name='11'></a>__::nettool::network\_list__
164
165    Return a list of networks associated with this computer\. Networks are
166    formated with __ip::nativeToPrefix__\.
167
168  - <a name='12'></a>__::nettool::port\_busy__ *port*
169
170    Return true if *port* is claimed, false otherwise\.
171
172  - <a name='13'></a>__::nettool::release\_port__ *port* ?*protocol*?
173
174    Mark *port* as not busy, optionally as either __tcp__ \(default\) or
175    __udp__\.
176
177  - <a name='14'></a>__::nettool::status__
178
179    Return a key/value list describing the status of the computer\. The output is
180    designed to be comparable to the output of __top__ for all platforms\.
181
182    Common fields include:
183
184      * load
185
186        Processes per processing unit
187
188      * memory\_total
189
190        Total physical RAM \(MB\)
191
192      * memory\_free
193
194        Total physical RAM unused \(MB\)
195
196  - <a name='15'></a>__::nettool::user\_data\_root__ *appname*
197
198    Return a fully qualified path to a folder where *appname* should store
199    it's data\. The path is not created, only computed, by this command\.
200
201# <a name='section3'></a>Bugs, Ideas, Feedback
202
203This document, and the package it describes, will undoubtedly contain bugs and
204other problems\. Please report such in the category *odie* of the [Tcllib
205Trackers](http://core\.tcl\.tk/tcllib/reportlist)\. Please also report any ideas
206for enhancements you may have for either package and/or documentation\.
207
208When proposing code changes, please provide *unified diffs*, i\.e the output of
209__diff \-u__\.
210
211Note further that *attachments* are strongly preferred over inlined patches\.
212Attachments can be made by going to the __Edit__ form of the ticket
213immediately after its creation, and then using the left\-most button in the
214secondary navigation bar\.
215
216# <a name='keywords'></a>KEYWORDS
217
218[nettool](\.\./\.\./\.\./\.\./index\.md\#nettool),
219[odie](\.\./\.\./\.\./\.\./index\.md\#odie)
220
221# <a name='category'></a>CATEGORY
222
223System
224
225# <a name='copyright'></a>COPYRIGHT
226
227Copyright &copy; 2015\-2018 Sean Woods <yoda@etoyoc\.com>
228