mirror of
https://frontier.innolan.net/rainlance/amiga-dnstracer.git
synced 2025-10-06 07:00:10 +00:00
Updated documentation
This commit is contained in:
88
CHANGES
88
CHANGES
@ -1,88 +0,0 @@
|
|||||||
$Id: CHANGES,v 1.26 2004/07/08 08:19:58 mavetju Exp $
|
|
||||||
|
|
||||||
Version 1.9:
|
|
||||||
- With the rollout of IPv6 for a.root-servers.net, it always
|
|
||||||
took the IPv6 address even if you used the -4 option.
|
|
||||||
- Fix false lame server issues with domains which have the
|
|
||||||
higher domain in it (command.com for example).
|
|
||||||
|
|
||||||
Version 1.8.1:
|
|
||||||
- Put back timeout command line parameter, it will be the
|
|
||||||
maximum time to wait instead of an increasing one.
|
|
||||||
|
|
||||||
Version 1.8:
|
|
||||||
- Better handling of timeout (instead of a static value,
|
|
||||||
start with five seconds and double it each retry)
|
|
||||||
- Warnings are printed if you receive a different RR type
|
|
||||||
than the one you asked for (for example when you ask for
|
|
||||||
an A record and receive a CNAME)
|
|
||||||
- Fixed problems when records received in the authority
|
|
||||||
field are shorter than the domain the nameserver is
|
|
||||||
authoritative for.
|
|
||||||
- When compiled without IPv6 support on an IPv6 capable
|
|
||||||
machine the machine tried to query the IPv6 translated
|
|
||||||
IPv5 address anyway.
|
|
||||||
- -C caches hosts which haven't answered too.
|
|
||||||
|
|
||||||
Version 1.7.1:
|
|
||||||
- Fix display of SOA serial number, by Janne Snabb
|
|
||||||
<snabb@epipe.com>
|
|
||||||
- Non-IPv6 builds should not use gethostbyname2()
|
|
||||||
|
|
||||||
Version 1.7:
|
|
||||||
- Removed a debug-line while doing PTR requests.
|
|
||||||
- Now IPv6 servers are traced too. Use -4 to disable it.
|
|
||||||
- Added -S option for specifying source IP address.
|
|
||||||
|
|
||||||
version 1.6:
|
|
||||||
- Added SOA record tracing
|
|
||||||
- Fixed a debug duplicate variable printing.
|
|
||||||
|
|
||||||
version 1.5:
|
|
||||||
- Sometimes it happened while tracing a name without
|
|
||||||
specifying a server it would return immediatly without
|
|
||||||
printing any information.
|
|
||||||
- names with a trailing dot are now handled correctly.
|
|
||||||
- warning from Kris Kennaway <kris@obsecurity.org> regarding
|
|
||||||
sprintf()'s without format-strings (yes, I feel ashamed).
|
|
||||||
- On request of Anthony DeRobertis <asd@suespammers.org>,
|
|
||||||
via Thomas Seyrat <tomasera@debian.org>, support for PTR
|
|
||||||
records.
|
|
||||||
|
|
||||||
version 1.4:
|
|
||||||
- Added -Wall to Makefile.am so at least I would get warnings
|
|
||||||
from my C compiler thank you. Removed some stupid unused
|
|
||||||
variables.
|
|
||||||
- Fixed big/little endian problem in the structs so that the
|
|
||||||
flags are looking allright now.
|
|
||||||
- Answers are displayed as authoritative or normal.
|
|
||||||
- Digging goes on until we have hit an authorative server.
|
|
||||||
- Info about which zone is being queried now.
|
|
||||||
|
|
||||||
version 1.3:
|
|
||||||
- added win32 support by Mike Black <mblack@csihq.com>
|
|
||||||
- fixed bug where the IP addresses in the resource records
|
|
||||||
wouldn't be used.
|
|
||||||
- when an authority NS record wouldn't have an additional
|
|
||||||
A record it can get multiple IP addresses when it resolves
|
|
||||||
the hostname in the gethostbyname(). This is now handled
|
|
||||||
correctly.
|
|
||||||
|
|
||||||
version 1.2:
|
|
||||||
- renamed into dnstracer due to clash with DJBDNS's dnstracer.
|
|
||||||
- dnstracer would segfault if nameserver name couldn't be
|
|
||||||
resolved (by Vilhelm Bergman <d96v@dtek.chalmers.se>)
|
|
||||||
- support for /etc/resolv.conf via a patch from Moritz
|
|
||||||
Barsnick <moritz@barsnick.net>
|
|
||||||
- -s . will take A.ROOT-SERVERS.NET
|
|
||||||
- autoconf/automake support... *shudder*
|
|
||||||
- support for different query-classes.
|
|
||||||
- Gerd v. Egidy <egidy@deam.de> gave it RPM capabilities
|
|
||||||
and checked the automake/autoconf construction.
|
|
||||||
|
|
||||||
version 1.1:
|
|
||||||
- fixed problems for big-endian little-endian machines.
|
|
||||||
- fixed linking problem on Solaris. Use Makefile.sun for them.
|
|
||||||
|
|
||||||
version 1.0:
|
|
||||||
- initial release
|
|
15
CONTACT
15
CONTACT
@ -1,15 +0,0 @@
|
|||||||
$Id: CONTACT,v 1.1 2002/01/21 00:40:23 mavetju Exp $
|
|
||||||
|
|
||||||
HOW TO CONTACT
|
|
||||||
|
|
||||||
Via email: edwin@mavetju.org
|
|
||||||
Via snail-mail: Edwin Groothuis
|
|
||||||
7 Islington Crescent
|
|
||||||
Greenacre NSW2190
|
|
||||||
AUSTRALIA
|
|
||||||
|
|
||||||
I have two mailing-lists:
|
|
||||||
announce@lists.mavetju.org <- low traffic announcements only
|
|
||||||
questions@lists.mavetju.org <- general questions
|
|
||||||
|
|
||||||
See http://www.mavetju.org/contacts.php on how to subscribe to them.
|
|
40
FILES
40
FILES
@ -1,40 +0,0 @@
|
|||||||
$Id: FILES,v 1.1 2002/01/25 01:40:09 mavetju Exp $
|
|
||||||
|
|
||||||
General
|
|
||||||
-------
|
|
||||||
CHANGES - Change log
|
|
||||||
CONTACT - How to contact me
|
|
||||||
FILES - This file
|
|
||||||
LICENSE - License under which this software is distributed
|
|
||||||
README - Small manual
|
|
||||||
|
|
||||||
Auto-configuration
|
|
||||||
------------------
|
|
||||||
Makefile.am - My Makefile-template
|
|
||||||
configure.in - My configure-template
|
|
||||||
Makefile.in - (Created by automake)
|
|
||||||
aclocal.m4 - (Needed by autoconf)
|
|
||||||
config.guess - (Needed by configure)
|
|
||||||
config.sub - (Needed by configure)
|
|
||||||
configure - Configure-file
|
|
||||||
depcomp - (Needed by configure)
|
|
||||||
install-sh - (Needed by configure)
|
|
||||||
missing - (Needed by configure)
|
|
||||||
mkinstalldirs - (Needed by configure)
|
|
||||||
|
|
||||||
Source-file
|
|
||||||
-----------
|
|
||||||
dnstracer.8 - Man-page, obtained from dnstracer.pod
|
|
||||||
dnstracer.c - The source-file
|
|
||||||
dnstracer.pod - The original man-file
|
|
||||||
dnstracer.spec - Needed for RPM creation
|
|
||||||
dnstracer_broken.h - Contains values for enumerations in case they
|
|
||||||
are not defined in arpa/nameser.h
|
|
||||||
|
|
||||||
WIN32 compatibility
|
|
||||||
-------------------
|
|
||||||
MSVC.BAT - Microsoft Visual C++ mini-makefile
|
|
||||||
getopt.c - Visual C++ doesn't provide these routines
|
|
||||||
getopt.h - Visual C++ doesn't provide these routines
|
|
||||||
|
|
||||||
(between brackets: not important, part of autoconfigure)
|
|
@ -22,3 +22,5 @@ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|||||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
SUCH DAMAGE.
|
SUCH DAMAGE.
|
||||||
|
|
||||||
|
Detailed license info can be found in supplied source files.
|
33
README
33
README
@ -1,33 +0,0 @@
|
|||||||
$Id: README,v 1.8 2003/01/06 22:40:31 mavetju Exp $
|
|
||||||
|
|
||||||
WHAT IS DNSTRACER?
|
|
||||||
|
|
||||||
Dnstracer determines where a given Domain Name Server (DNS) gets
|
|
||||||
its information from, and follows the chain of DNS servers back to
|
|
||||||
the servers which know the data.
|
|
||||||
|
|
||||||
Its behaviour is similair to ntptrace(8), which does it for the
|
|
||||||
NTP protocol.
|
|
||||||
|
|
||||||
HOW TO INSTALL?
|
|
||||||
|
|
||||||
In theory, run 'configure', 'make' and 'make install' should be
|
|
||||||
enough to install the binary and the man-page. I've developed it
|
|
||||||
under FreeBSD 4.4 and tested it on Debian, SunOS and Solaris. Due
|
|
||||||
to the nature of autoconf and friends, you need GNU Make.
|
|
||||||
|
|
||||||
If you don't want to have IPv6 support in it, run configure with
|
|
||||||
the --disable-ipv6 option.
|
|
||||||
|
|
||||||
Windows users with Microsoft Visual C++ please use MSVB.BAT (supplied
|
|
||||||
by Mike Black <mblack@csihq.com>)
|
|
||||||
|
|
||||||
LICENSE
|
|
||||||
|
|
||||||
BSD license. See the file LICENSE for more information.
|
|
||||||
|
|
||||||
CONTACT
|
|
||||||
|
|
||||||
My email address is edwin@mavetju.org
|
|
||||||
My website is http://www.mavetju.org
|
|
||||||
Mailing-lists are available: http://www.mavetju.org/contacts.php
|
|
18
README.md
Normal file
18
README.md
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
##WHAT IS DNSTRACER ?
|
||||||
|
|
||||||
|
Dnstracer determines where a given Domain Name Server (DNS) gets
|
||||||
|
its information from, and follows the chain of DNS servers back to
|
||||||
|
the servers which know the data.
|
||||||
|
|
||||||
|
##EXAMPLE OF USAGE
|
||||||
|
|
||||||
|
Show trace of DNS for google.com using A.ROOT-SERVERS.NET
|
||||||
|
> dnstrace google.com
|
||||||
|
|
||||||
|
##FURTHER INFORMATION
|
||||||
|
|
||||||
|
The 13 root name servers are operated by 12 independent organisations.
|
||||||
|
More information is available from: http://www.root-servers.org/
|
||||||
|
|
||||||
|
Google also operates 2 public DNS servers:
|
||||||
|
https://developers.google.com/speed/public-dns/
|
92
doc/dnstracer.help
Normal file
92
doc/dnstracer.help
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
DNSTRACER(8) General Commands Manual DNSTRACER(8)
|
||||||
|
|
||||||
|
[1mNAME[0m
|
||||||
|
[1mdnstracer [22m- trace a chain of DNS servers to the source
|
||||||
|
|
||||||
|
[1mSYNOPSIS[0m
|
||||||
|
[1mdnstracer [22m[[1moptions[22m] [4mname[0m
|
||||||
|
|
||||||
|
[1mDESCRIPTION[0m
|
||||||
|
[1mdnstracer [22mdetermines where a given Domain Name Server (DNS) gets its
|
||||||
|
information from, and follows the chain of DNS servers back to the
|
||||||
|
servers which know the data.
|
||||||
|
|
||||||
|
Options are:
|
||||||
|
|
||||||
|
[1m-c [22mDisable local caching.
|
||||||
|
|
||||||
|
[1m-C [22mEnable negative caching.
|
||||||
|
|
||||||
|
[1m-o [22mEnable overview of received answers at the end.
|
||||||
|
|
||||||
|
[1m-q [4mqueryclass[0m
|
||||||
|
Change the query-class, default is A. You can either specify a
|
||||||
|
number of the type (if you're brave) or one of the following
|
||||||
|
strings: a, aaaa, a6, soa, cname, hinfo, mx, ns, txt and ptr.
|
||||||
|
|
||||||
|
[1m-r [4mretries[0m
|
||||||
|
Number of retries for DNS requests, default 3.
|
||||||
|
|
||||||
|
[1m-s [4mserver[0m
|
||||||
|
DNS server to use for the initial request, default is aquired
|
||||||
|
from the system. If a dot is specified (.), A.ROOT-SERVERS.NET
|
||||||
|
will be used.
|
||||||
|
|
||||||
|
[1m-v [22mBe verbose on what sent or received.
|
||||||
|
|
||||||
|
[1m-4 [22mUse only IPv4 servers, don't query IPv6 servers (only available
|
||||||
|
when IPv6 support hasn't been disabled)
|
||||||
|
|
||||||
|
[1m-S [4msourceaddress[0m
|
||||||
|
Use this as source-address for the outgoing packets.
|
||||||
|
|
||||||
|
[1mHOW IT WORKS[0m
|
||||||
|
It sends the specified name-server a non-recursive request for the
|
||||||
|
name.
|
||||||
|
|
||||||
|
Non-recursive means: if the name-server knows it, it will return the
|
||||||
|
data requested. If the name-server doesn't know it, it will return
|
||||||
|
pointers to name-servers that are authoritive for the domain part in
|
||||||
|
the name or it will return the addresses of the root name-servers.
|
||||||
|
|
||||||
|
If the name server does returns an authoritative answer for the name,
|
||||||
|
the next server is queried. If it returns an non-authoritative answer
|
||||||
|
for the name, the name servers in the authority records will be
|
||||||
|
queried.
|
||||||
|
|
||||||
|
The program stops if all name-servers are queried.
|
||||||
|
|
||||||
|
Make sure the server you're querying doesn't do forwarding towards
|
||||||
|
other servers, as dnstracer is not able to detect this for you.
|
||||||
|
|
||||||
|
It detects so called lame servers, which are name-servers which has
|
||||||
|
been told to have information about a certain domain, but don't have
|
||||||
|
this information.
|
||||||
|
|
||||||
|
[1mEXAMPLES[0m
|
||||||
|
Search for the A record of www.mavetju.org on your local nameserver:
|
||||||
|
|
||||||
|
dnstracer www.mavetju.org
|
||||||
|
|
||||||
|
Search for the MX record of mavetju.org on the root-nameservers:
|
||||||
|
|
||||||
|
dnstracer "-s" . "-q" mx mavetju.org
|
||||||
|
|
||||||
|
Search for the PTR record (hostname) of 212.204.230.141:
|
||||||
|
|
||||||
|
dnstracer "-q" ptr 141.230.204.212.in-addr.arpa
|
||||||
|
|
||||||
|
And for IPv6 addresses:
|
||||||
|
|
||||||
|
dnstracer "-q" ptr "-s" . "-o"
|
||||||
|
2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.6.4.0.2.0.0.0.0.8.b.0.e.f.f.3.ip6.int
|
||||||
|
|
||||||
|
[1mSEE ALSO[0m
|
||||||
|
[4mntptrace[24m(8), [4mtraceroute[24m(8), [4mdig[24m(1)
|
||||||
|
|
||||||
|
[1mAUTHOR[0m
|
||||||
|
Edwin Groothuis, edwin@mavetju.org (http://www.mavetju.org)
|
||||||
|
|
||||||
|
See http://www.mavetju.org/contacts.php for mailing-lists.
|
||||||
|
|
||||||
|
February 10, 2008 February 10, 2008 DNSTRACER(8)
|
92
doc/dnstracer.txt
Normal file
92
doc/dnstracer.txt
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
DNSTRACER(8) General Commands Manual DNSTRACER(8)
|
||||||
|
|
||||||
|
NAME
|
||||||
|
dnstracer - trace a chain of DNS servers to the source
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
dnstracer [options] name
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
dnstracer determines where a given Domain Name Server (DNS) gets its
|
||||||
|
information from, and follows the chain of DNS servers back to the
|
||||||
|
servers which know the data.
|
||||||
|
|
||||||
|
Options are:
|
||||||
|
|
||||||
|
-c Disable local caching.
|
||||||
|
|
||||||
|
-C Enable negative caching.
|
||||||
|
|
||||||
|
-o Enable overview of received answers at the end.
|
||||||
|
|
||||||
|
-q queryclass
|
||||||
|
Change the query-class, default is A. You can either specify a
|
||||||
|
number of the type (if you're brave) or one of the following
|
||||||
|
strings: a, aaaa, a6, soa, cname, hinfo, mx, ns, txt and ptr.
|
||||||
|
|
||||||
|
-r retries
|
||||||
|
Number of retries for DNS requests, default 3.
|
||||||
|
|
||||||
|
-s server
|
||||||
|
DNS server to use for the initial request, default is aquired
|
||||||
|
from the system. If a dot is specified (.), A.ROOT-SERVERS.NET
|
||||||
|
will be used.
|
||||||
|
|
||||||
|
-v Be verbose on what sent or received.
|
||||||
|
|
||||||
|
-4 Use only IPv4 servers, don't query IPv6 servers (only available
|
||||||
|
when IPv6 support hasn't been disabled)
|
||||||
|
|
||||||
|
-S sourceaddress
|
||||||
|
Use this as source-address for the outgoing packets.
|
||||||
|
|
||||||
|
HOW IT WORKS
|
||||||
|
It sends the specified name-server a non-recursive request for the
|
||||||
|
name.
|
||||||
|
|
||||||
|
Non-recursive means: if the name-server knows it, it will return the
|
||||||
|
data requested. If the name-server doesn't know it, it will return
|
||||||
|
pointers to name-servers that are authoritive for the domain part in
|
||||||
|
the name or it will return the addresses of the root name-servers.
|
||||||
|
|
||||||
|
If the name server does returns an authoritative answer for the name,
|
||||||
|
the next server is queried. If it returns an non-authoritative answer
|
||||||
|
for the name, the name servers in the authority records will be
|
||||||
|
queried.
|
||||||
|
|
||||||
|
The program stops if all name-servers are queried.
|
||||||
|
|
||||||
|
Make sure the server you're querying doesn't do forwarding towards
|
||||||
|
other servers, as dnstracer is not able to detect this for you.
|
||||||
|
|
||||||
|
It detects so called lame servers, which are name-servers which has
|
||||||
|
been told to have information about a certain domain, but don't have
|
||||||
|
this information.
|
||||||
|
|
||||||
|
EXAMPLES
|
||||||
|
Search for the A record of www.mavetju.org on your local nameserver:
|
||||||
|
|
||||||
|
dnstracer www.mavetju.org
|
||||||
|
|
||||||
|
Search for the MX record of mavetju.org on the root-nameservers:
|
||||||
|
|
||||||
|
dnstracer "-s" . "-q" mx mavetju.org
|
||||||
|
|
||||||
|
Search for the PTR record (hostname) of 212.204.230.141:
|
||||||
|
|
||||||
|
dnstracer "-q" ptr 141.230.204.212.in-addr.arpa
|
||||||
|
|
||||||
|
And for IPv6 addresses:
|
||||||
|
|
||||||
|
dnstracer "-q" ptr "-s" . "-o"
|
||||||
|
2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.6.4.0.2.0.0.0.0.8.b.0.e.f.f.3.ip6.int
|
||||||
|
|
||||||
|
SEE ALSO
|
||||||
|
ntptrace(8), traceroute(8), dig(1)
|
||||||
|
|
||||||
|
AUTHOR
|
||||||
|
Edwin Groothuis, edwin@mavetju.org (http://www.mavetju.org)
|
||||||
|
|
||||||
|
See http://www.mavetju.org/contacts.php for mailing-lists.
|
||||||
|
|
||||||
|
February 10, 2008 February 10, 2008 DNSTRACER(8)
|
179
fping_amiga.c
179
fping_amiga.c
@ -1,179 +0,0 @@
|
|||||||
/*
|
|
||||||
* Written by Carsten Larsen.
|
|
||||||
* Public domain.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <clib/exec_protos.h>
|
|
||||||
#include <clib/timer_protos.h>
|
|
||||||
#include <clib/utility_protos.h>
|
|
||||||
#include <clib/alib_protos.h>
|
|
||||||
#include <devices/timer.h>
|
|
||||||
|
|
||||||
#define OPEN_ERROR "Cannot open %s.\n"
|
|
||||||
#define OPEN_VER_ERROR "Cannot open %s (%d.0)\n"
|
|
||||||
#define DOSLIB_NAME "dos.library"
|
|
||||||
#define DOSLIB_REV 37L
|
|
||||||
#define BSDLIB_NAME "bsdsocket.library"
|
|
||||||
#define BSDLIB_REV 03L
|
|
||||||
#define UTILLIB_NAME "utility.library"
|
|
||||||
#define UTILLIB_REV 37L
|
|
||||||
#define TIMER_NAME TIMERNAME
|
|
||||||
#define LIB_ERROR 4
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
const char *vers = "\0$VER: " PACKAGE_NAME " " PACKAGE_VERSION " (21.02.2016)";
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
#ifdef AOS3
|
|
||||||
uid_t getuid () {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int setuid (uid_t id) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int h_errno;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct Library* DOSBase = NULL;
|
|
||||||
struct Library* SocketBase = NULL;
|
|
||||||
struct Library* UtilityBase = NULL;
|
|
||||||
struct Device* TimerBase = NULL;
|
|
||||||
struct timerequest* TimeRequest = NULL;
|
|
||||||
|
|
||||||
int create_timer();
|
|
||||||
void delete_timer();
|
|
||||||
|
|
||||||
void amiga_open_error(char *name)
|
|
||||||
{
|
|
||||||
printf(OPEN_ERROR, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
void amiga_open_lib_error(char *name, int version)
|
|
||||||
{
|
|
||||||
printf(OPEN_VER_ERROR, name, version);
|
|
||||||
}
|
|
||||||
|
|
||||||
void close_libs()
|
|
||||||
{
|
|
||||||
close_ping_socket();
|
|
||||||
cleanup_ping_buffer();
|
|
||||||
|
|
||||||
if (TimerBase != NULL) {
|
|
||||||
delete_timer();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (UtilityBase != NULL) {
|
|
||||||
CloseLibrary(UtilityBase);
|
|
||||||
UtilityBase = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SocketBase != NULL) {
|
|
||||||
CloseLibrary(SocketBase);
|
|
||||||
SocketBase = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DOSBase != NULL) {
|
|
||||||
CloseLibrary(DOSBase);
|
|
||||||
DOSBase = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
freeall();
|
|
||||||
}
|
|
||||||
|
|
||||||
int open_libs()
|
|
||||||
{
|
|
||||||
struct timeval tv;
|
|
||||||
|
|
||||||
atexit(close_libs);
|
|
||||||
InitSemaphore(&GetaddrinfoSemaphore);
|
|
||||||
|
|
||||||
if(!(DOSBase = OpenLibrary((STRPTR)DOSLIB_NAME, DOSLIB_REV))) {
|
|
||||||
amiga_open_lib_error(DOSLIB_NAME, DOSLIB_REV);
|
|
||||||
return LIB_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!(SocketBase = OpenLibrary((STRPTR)BSDLIB_NAME, BSDLIB_REV))) {
|
|
||||||
amiga_open_lib_error(BSDLIB_NAME, BSDLIB_REV);
|
|
||||||
return LIB_ERROR;
|
|
||||||
} else {
|
|
||||||
SocketBaseTags(
|
|
||||||
SBTM_SETVAL(SBTC_ERRNOPTR(sizeof(errno))), (IPTR) &errno,
|
|
||||||
SBTM_SETVAL(SBTC_HERRNOLONGPTR), (IPTR) &h_errno,
|
|
||||||
SBTM_SETVAL(SBTC_LOGTAGPTR), (IPTR) &prog,
|
|
||||||
TAG_DONE );
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!(UtilityBase = OpenLibrary((STRPTR)UTILLIB_NAME, UTILLIB_REV))) {
|
|
||||||
amiga_open_lib_error(UTILLIB_NAME, UTILLIB_REV);
|
|
||||||
return LIB_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (create_timer() != 0) {
|
|
||||||
amiga_open_error(TIMER_NAME);
|
|
||||||
return LIB_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
getsystime(&tv);
|
|
||||||
srand(tv.tv_usec);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int create_timer()
|
|
||||||
{
|
|
||||||
LONG error;
|
|
||||||
struct MsgPort *port = CreatePort(0, 0);
|
|
||||||
if (port == NULL)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
TimeRequest = (struct timerequest*)CreateExtIO(port, sizeof(struct timerequest));
|
|
||||||
if (TimeRequest == NULL)
|
|
||||||
{
|
|
||||||
DeletePort(port);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
error = OpenDevice(
|
|
||||||
(STRPTR)TIMER_NAME, UNIT_MICROHZ,
|
|
||||||
(struct IORequest*)TimeRequest, 0L
|
|
||||||
);
|
|
||||||
|
|
||||||
if (error != 0)
|
|
||||||
{
|
|
||||||
delete_timer(TimeRequest);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
TimerBase = (struct Device*)TimeRequest->tr_node.io_Device;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void delete_timer()
|
|
||||||
{
|
|
||||||
struct MsgPort *port;
|
|
||||||
if (TimeRequest == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
port = TimeRequest->tr_node.io_Message.mn_ReplyPort;
|
|
||||||
|
|
||||||
if (port != 0)
|
|
||||||
DeletePort(port);
|
|
||||||
|
|
||||||
CloseDevice((struct IORequest*)TimeRequest);
|
|
||||||
DeleteExtIO((struct IORequest*)TimeRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
int getsystime(struct timeval *tv)
|
|
||||||
{
|
|
||||||
struct timeval tv1;
|
|
||||||
|
|
||||||
GetSysTime(&tv1);
|
|
||||||
*tv = tv1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
Reference in New Issue
Block a user