1nettool(n) nettool nettool(n)
2
3
4
5______________________________________________________________________________
6
8 nettool - Tools for networked applications
9
11 package require Tcl 8.5
12
13 package require nettool ?0.5.2?
14
15 package require twapi 3.1
16
17 package require ip 0.1
18
19 package require platform 0.1
20
21 ::cat filename
22
23 ::nettool::allocate_port startingport
24
25 ::nettool::arp_table
26
27 ::nettool::broadcast_list
28
29 ::nettool::claim_port port ?protocol?
30
31 ::nettool::cpuinfo args
32
33 ::nettool::find_port startingport
34
35 ::nettool::hwid_list
36
37 ::nettool::ip_list
38
39 ::nettool::mac_list
40
41 ::nettool::network_list
42
43 ::nettool::port_busy port
44
45 ::nettool::release_port port ?protocol?
46
47 ::nettool::status
48
49 ::nettool::user_data_root appname
50
51______________________________________________________________________________
52
54 The nettool package consists of a Pure-tcl set of tools to perform com‐
55 mon network functions that would normally require different packages or
56 calls to exec, in a standard Tcl interface. At present nettool has
57 reference implementations for the following operating systems: Windows,
58 MacOSX, and Linux (debian).
59
61 ::cat filename
62 Dump the contents of a file as a result.
63
64 ::nettool::allocate_port startingport
65 Attempt to allocate startingport, or, if busy, advance the port
66 number sequentially until a free port is found, and claim that
67 port. This command uses a built-in database of known ports to
68 avoid returning a port which is in common use. (For example:
69 http (80))
70
71 ::nettool::arp_table
72 Dump the contents of this computer's Address Resolution Protocol
73 (ARP) table. The result will be a Tcl formatted list: macid
74 ipaddrlist ...
75
76 ::nettool::broadcast_list
77 Returns a list of broadcast addresses (suitable for UDP multi‐
78 cast) that this computer is associated with.
79
80 ::nettool::claim_port port ?protocol?
81 Mark port as busy, optionally as either tcp (default) or udp.
82
83 ::nettool::cpuinfo args
84 If no arguments are given, return a key/value list describing
85 the CPU of the present machine. Included in the matrix is info
86 on the number of cores/processors that are available for paral‐
87 lel tasking, installed physical RAM, and processor family.
88
89 The exact contents are platform specific.
90
91 For Linux, information is drawn from /proc/cpuinfo and
92 /proc/meminfo.
93
94 For MacOSX, information is drawn from sysctl
95
96 For Windows, information is draw from TWAPI.
97
98 If arguments are given, the result with be a key/value list lim‐
99 ited to the fields requested.
100
101 Canonical fields for all platforms:
102
103 cpus Count of CPUs/cores/execution units
104
105 speed Clock speed of processor(s) in Mhz
106
107 memory Installed RAM (in MB)
108
109 vendor Manufacturer
110
111 ::nettool::find_port startingport
112 Return startingport if it is available, or the next free port
113 after startingport. Note: Unlike ::nettool::allocate_port, this
114 command does not claim the port.
115
116 This command uses a built-in database of known ports to avoid
117 returning a port which is in common use. (For example: http
118 (80))
119
120 ::nettool::hwid_list
121 Return a list of hardware specific identifiers from this com‐
122 puter. The source and content will vary by platform.
123
124 For MacOSX, the motherboard serial number and macids for all
125 network devices is returned.
126
127 For Windows, the volume serial number of C and macids for all
128 network devices is returned.
129
130 For Linux, macids for all network devices is returned.
131
132 ::nettool::ip_list
133 Return a list of IP addresses associated with this computer.
134
135 ::nettool::mac_list
136 Return a list of MACIDs for the network cards attached to this
137 machine. The MACID of the primary network card is returned
138 first.
139
140 ::nettool::network_list
141 Return a list of networks associated with this computer. Net‐
142 works are formated with ip::nativeToPrefix.
143
144 ::nettool::port_busy port
145 Return true if port is claimed, false otherwise.
146
147 ::nettool::release_port port ?protocol?
148 Mark port as not busy, optionally as either tcp (default) or
149 udp.
150
151 ::nettool::status
152 Return a key/value list describing the status of the computer.
153 The output is designed to be comparable to the output of top for
154 all platforms.
155
156 Common fields include:
157
158 load Processes per processing unit
159
160 memory_total
161 Total physical RAM (MB)
162
163 memory_free
164 Total physical RAM unused (MB)
165
166 ::nettool::user_data_root appname
167 Return a fully qualified path to a folder where appname should
168 store it's data. The path is not created, only computed, by
169 this command.
170
172 This document, and the package it describes, will undoubtedly contain
173 bugs and other problems. Please report such in the category odie of
174 the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist]. Please
175 also report any ideas for enhancements you may have for either package
176 and/or documentation.
177
178 When proposing code changes, please provide unified diffs, i.e the out‐
179 put of diff -u.
180
181 Note further that attachments are strongly preferred over inlined
182 patches. Attachments can be made by going to the Edit form of the
183 ticket immediately after its creation, and then using the left-most
184 button in the secondary navigation bar.
185
187 nettool, odie
188
190 System
191
193 Copyright (c) 2015-2018 Sean Woods <yoda@etoyoc.com>
194
195
196
197
198tcllib 0.5.2 nettool(n)