*** tnmUdp.c.bak Mon Jul 21 14:52:15 1997
--- tnmUdp.c Mon Jul 21 15:36:06 1997
***************
*** 10,15 ****
--- 10,16 ----
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
+
#include "tnmInt.h"
#include "tnmPort.h"
***************
*** 20,26 ****
typedef struct Socket {
char name[12]; /* The name of the udp handle. */
struct sockaddr_in client; /* The client we are connected to. */
! Tcl_File sock; /* The socket as a Tcl file. */
char *readBinding; /* Command to execute if readable. */
char *writeBinding; /* Command to execute if writeable. */
Tcl_Interp *interp; /* Interpreter used for events. */
--- 21,28 ----
typedef struct Socket {
char name[12]; /* The name of the udp handle. */
struct sockaddr_in client; /* The client we are connected to. */
! /* Tcl_File sock; /* The socket as a Tcl file. */
! int sock; /* The socket as a Tcl file. */
char *readBinding; /* Command to execute if readable. */
char *writeBinding; /* Command to execute if writeable. */
Tcl_Interp *interp; /* Interpreter used for events. */
***************
*** 32,37 ****
--- 34,40 ----
static Tcl_HashTable udpTable;
static int initialized = 0;
+ #define Tcl_GetFileInfo(a,b) a
/*
* Forward declarations for procedures defined later in this file:
*/
***************
*** 181,187 ****
sprintf(usock->name, "udp%d", initialized++);
usock->client.sin_addr.s_addr = htonl(INADDR_ANY);
usock->client.sin_port = 0;
! usock->sock = Tcl_GetFile((ClientData) sock, TNM_SOCKET_FD);
entryPtr = Tcl_CreateHashEntry(&udpTable, usock->name, &isNew);
Tcl_SetHashValue(entryPtr, (ClientData) usock);
--- 184,190 ----
sprintf(usock->name, "udp%d", initialized++);
usock->client.sin_addr.s_addr = htonl(INADDR_ANY);
usock->client.sin_port = 0;
! usock->sock = sock; /* Tcl_GetFile((ClientData) sock, TNM_SOCKET_FD);*/
entryPtr = Tcl_CreateHashEntry(&udpTable, usock->name, &isNew);
Tcl_SetHashValue(entryPtr, (ClientData) usock);
***************
*** 242,248 ****
sprintf(usock->name, "udp%d", initialized++);
usock->client.sin_addr = name.sin_addr;
usock->client.sin_port = name.sin_port;
! usock->sock = Tcl_GetFile((ClientData) sock, TNM_SOCKET_FD);
entryPtr = Tcl_CreateHashEntry(&udpTable, usock->name, &isNew);
Tcl_SetHashValue(entryPtr, (ClientData) usock);
--- 245,251 ----
sprintf(usock->name, "udp%d", initialized++);
usock->client.sin_addr = name.sin_addr;
usock->client.sin_port = name.sin_port;
! usock->sock = sock; /*Tcl_GetFile((ClientData) sock, TNM_SOCKET_FD);*/
entryPtr = Tcl_CreateHashEntry(&udpTable, usock->name, &isNew);
Tcl_SetHashValue(entryPtr, (ClientData) usock);
***************
*** 431,437 ****
sock = (int) Tcl_GetFileInfo(usock->sock, NULL);
TnmSocketClose(sock);
Tcl_DeleteFileHandler(usock->sock);
! Tcl_FreeFile(usock->sock);
if (usock->readBinding) {
ckfree(usock->readBinding);
}
--- 434,440 ----
sock = (int) Tcl_GetFileInfo(usock->sock, NULL);
TnmSocketClose(sock);
Tcl_DeleteFileHandler(usock->sock);
! /* Tcl_FreeFile(usock->sock);*/
if (usock->readBinding) {
ckfree(usock->readBinding);
}
***************
*** 705,711 ****
sprintf(usock->name, "udp%d", initialized++);
usock->client.sin_addr.s_addr = htonl(INADDR_ANY);
usock->client.sin_port = 0;
! usock->sock = Tcl_GetFile((ClientData) sock, TNM_SOCKET_FD);
entryPtr = Tcl_CreateHashEntry(&udpTable, usock->name, &isNew);
Tcl_SetHashValue(entryPtr, (ClientData) usock);
--- 708,714 ----
sprintf(usock->name, "udp%d", initialized++);
usock->client.sin_addr.s_addr = htonl(INADDR_ANY);
usock->client.sin_port = 0;
! usock->sock = sock; /* Tcl_GetFile((ClientData) sock, TNM_SOCKET_FD);*/
entryPtr = Tcl_CreateHashEntry(&udpTable, usock->name, &isNew);
Tcl_SetHashValue(entryPtr, (ClientData) usock);
*** tnmSnmpNet.c.orig Mon Jul 21 14:56:51 1997
--- tnmSnmpNet.c Mon Jul 21 15:08:50 1997
***************
*** 27,34 ****
static int trap_sock = -1; /* socket to receive traps */
static int trap_count = 0; /* reference counter for trap socket */
! static Tcl_File mgrSocket;
! static Tcl_File trapSocket;
static char *serv_path = "/tmp/.straps-162";
--- 27,34 ----
static int trap_sock = -1; /* socket to receive traps */
static int trap_count = 0; /* reference counter for trap socket */
! static int mgrSocket;
! static int trapSocket;
static char *serv_path = "/tmp/.straps-162";
***************
*** 396,403 ****
return TCL_ERROR;
}
! mgrSocket = Tcl_GetFile((ClientData) sock, TNM_SOCKET_FD);
! Tcl_CreateFileHandler(mgrSocket, TCL_READABLE,
ResponseProc, (ClientData *) interp);
return TCL_OK;
}
--- 396,403 ----
return TCL_ERROR;
}
! /* mgrSocket = Tcl_GetChannelFile((ClientData) sock, TNM_SOCKET_FD);*/
! Tcl_CreateFileHandler(sock, TCL_READABLE,
ResponseProc, (ClientData *) interp);
return TCL_OK;
}
***************
*** 422,428 ****
Tnm_SnmpManagerClose()
{
Tcl_DeleteFileHandler(mgrSocket);
! Tcl_FreeFile(mgrSocket);
TnmSocketClose(sock);
sock = -1;
}
--- 422,428 ----
Tnm_SnmpManagerClose()
{
Tcl_DeleteFileHandler(mgrSocket);
! /* Tcl_FreeFile(mgrSocket);*/
TnmSocketClose(sock);
sock = -1;
}
***************
*** 525,531 ****
#endif
#endif
! trapSocket = Tcl_GetFile((ClientData) trap_sock, TNM_SOCKET_FD);
Tcl_CreateFileHandler(trapSocket, TCL_READABLE,
TrapProc, (ClientData *) interp);
return TCL_OK;
--- 525,531 ----
#endif
#endif
! /* trapSocket = Tcl_GetFile((ClientData) trap_sock, TNM_SOCKET_FD);*/
Tcl_CreateFileHandler(trapSocket, TCL_READABLE,
TrapProc, (ClientData *) interp);
return TCL_OK;
***************
*** 552,558 ****
{
if (--trap_count == 0) {
Tcl_DeleteFileHandler(trapSocket);
! Tcl_FreeFile(trapSocket);
TnmSocketClose(trap_sock);
trap_sock = -1;
Tcl_ReapDetachedProcs();
--- 552,558 ----
{
if (--trap_count == 0) {
Tcl_DeleteFileHandler(trapSocket);
! /* Tcl_FreeFile(trapSocket);*/
TnmSocketClose(trap_sock);
trap_sock = -1;
Tcl_ReapDetachedProcs();
***************
*** 588,594 ****
if (session->agentSock > 0) {
Tcl_DeleteFileHandler(session->agentSocket);
! Tcl_FreeFile(session->agentSocket);
TnmSocketClose(session->agentSock);
}
--- 588,594 ----
if (session->agentSock > 0) {
Tcl_DeleteFileHandler(session->agentSocket);
! /* Tcl_FreeFile(session->agentSocket);*/
TnmSocketClose(session->agentSock);
}
***************
*** 638,645 ****
return TCL_ERROR;
}
! session->agentSocket = Tcl_GetFile((ClientData) session->agentSock,
! TNM_SOCKET_FD);
Tcl_CreateFileHandler(session->agentSocket, TCL_READABLE,
AgentProc, (ClientData *) session);
return TCL_OK;
--- 638,645 ----
return TCL_ERROR;
}
! /* session->agentSocket = Tcl_GetFile((ClientData) session->agentSock,
! TNM_SOCKET_FD);*/
Tcl_CreateFileHandler(session->agentSocket, TCL_READABLE,
AgentProc, (ClientData *) session);
return TCL_OK;
***************
*** 695,701 ****
*/
Tcl_DeleteFileHandler(session->agentSocket);
! Tcl_FreeFile(session->agentSocket);
TnmSocketClose(session->agentSock);
session->agentSock = 0;
}
--- 695,701 ----
*/
Tcl_DeleteFileHandler(session->agentSocket);
! /* Tcl_FreeFile(session->agentSocket);*/
TnmSocketClose(session->agentSock);
session->agentSock = 0;
}
*** tnmSnmp.h.orig Mon Jul 21 14:56:09 1997
--- tnmSnmp.h Mon Jul 21 14:56:31 1997
***************
*** 188,194 ****
Tcl_Interp *interp; /* Tcl interpreter owning this session. */
Tcl_Command token; /* The command token used by Tcl. */
int agentSock; /* Socket used if we are an agent. */
! Tcl_File agentSocket; /* Tcl File used if we are an agent. */
Tcl_Interp *agentInterp; /* Tcl interp used by the agent. */
struct SNMP_Node *instPtr; /* Root of the tree of MIB instances. */
struct SNMP_Session *nextPtr; /* Pointer to next session. */
--- 188,194 ----
Tcl_Interp *interp; /* Tcl interpreter owning this session. */
Tcl_Command token; /* The command token used by Tcl. */
int agentSock; /* Socket used if we are an agent. */
! Tcl_Channel agentSocket; /* Tcl File used if we are an agent. */
Tcl_Interp *agentInterp; /* Tcl interp used by the agent. */
struct SNMP_Node *instPtr; /* Root of the tree of MIB instances. */
struct SNMP_Session *nextPtr; /* Pointer to next session. */
-- !! This message is brought to you via the `tkined & scotty' mailing list. !! Please do not reply to this message to unsubscribe. To subscribe or !! unsubscribe, send a mail message to <tkined-request@ibr.cs.tu-bs.de>. !! See http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/ for more information.