[Q]: non 162 straps & straps under NT

Brian Meagher (bmeagher@eurologic.ie)
Thu, 16 Jan 1997 11:32:51 +0000

Hi,

I need the following modifications to scotty2.1.5
- trap reception on ports other than 162
- straps under NT

[Q1] Has someone out there has already made these modifications?

If not, then I'll implement them myself & provide Juergen with patches.

Many moons ago (scotty 1.2.5) I made modifications to achieve the
above, but would like advise on whether my solution is a good way
to go, before I dust it off again.

Trap reception on ports other than 162
======================================
This will require a small modification to Tnm_SnmptrapOpen and straps in
tnmSnmpNet.c to launch & connect to a different straps for each port number.
There may be some other changes required, I haven't checked this yet.

straps under NT
===============
As far as I know I will have to write a service to perform traps forwarding.
This isn't too difficult, but since I cannot find a way of passing a parameter
into a service other than the executable name I have to copy the straps_nt.exe
to straps_nt_<port number>.exe before I install it. Sigh.

[Q2] Any better solutions?

The second difficulty is that UNIX domain sockets aren't supported under
WinSock, so an alternative IPC mechanism has to be used. When I hacked this
up before I used Named Pipes as they seemed to have a good correspondence with
AF_UNIX sockets. The bad news was that I couldn't do a (then)
Tk_CreateFileHandler on these (this was before the new I/O subsystem) & so I
had to write a thread that created another socket & passed the messages received
at the named pipe (client end) to the new socket for which I had added a file
handler.

To say that this was an ugly hack is something of an understatement! It also
has the disadvantage that Win95 can on act as a CLIENT of a named pipe, so this
solution would only run under NT.

[Q3] Has anyone written a I/O channel module for named pipes?

**Late** last night when I was thinking about this it seemed that the obvious
solution would be to use TCP sockets in a client server arrangement at some
fixed
offset from the port that straps wishes to forward. However, I wouldn't
consider
myself an expert on sockets programming, so my reasoning may be flawed.

[Q4] Comments?

Tnm_SnmpOpen(port=162)
Launch straps ---> straps 162
listen on UDP 162 for traps
listen on TCP 5162 for client connections
Connect to 5162 ---> spin off client socket
select
...

Another advantage with this is that apart from the service installation,
it pretty portable between NT & UNIX & ... Also, I've run into some
problems with a hacked version of the current straps when a cron job runs
and removes the /tmp/.straps file.

Thanks, and apologies if some of this is half-baked. Blame that Juergen fellow,
normally he saves me having to do any thinking! :-)

Regards,
-Brian.

---
Brian Meagher (bmeagher@eurologic.com)