# unix subdirectory.
#========================================================================
-udp_SOURCES = $(srcdir)/generic/udp_tcl.c
+udp_SOURCES = udp_tcl.c
WIN_SOURCES =
UNIX_SOURCES =
mandir = @mandir@
includedir = @includedir@
+TCLUDP_LIBRARY = $(srcdir)/library
+
DESTDIR =
PKG_DIR = $(PACKAGE)$(VERSION)
# for the BINARIES that you specified above have already been done.
#========================================================================
-all: binaries #libraries doc
+all: binaries libraries #doc
#========================================================================
# The binaries target builds executable programs, Windows .dll's, unix
#========================================================================
install-libraries: libraries
- @mkdir -p $(DESTDIR)$(includedir)
- @echo "Installing header files in $(DESTDIR)$(includedir)"
- @for i in $(GENERIC_HDRS) ; do \
- echo "Installing $$i" ; \
- $(INSTALL_DATA) $$i $(DESTDIR)$(includedir) ; \
- done;
+ @echo "Installing script library files in $(DESTDIR)$(pkglibdir)"
+ @for i in $(srcdir)/library/*.tcl; do \
+ echo "Installing $$i"; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(pkglibdir) ; \
+ done
+# @mkdir -p $(DESTDIR)$(includedir)
+# @echo "Installing header files in $(DESTDIR)$(includedir)"
+# @for i in $(GENERIC_HDRS) ; do \
+# echo "Installing $$i" ; \
+# $(INSTALL_DATA) $$i $(DESTDIR)$(includedir) ; \
+# done;
#========================================================================
# Install documentation. Unix manpages should go in the $(mandir)
int actual_size, socksize;
int sock;
char message[17];
- /*struct hostent *name;*/
-#ifdef SIPC_IPV6
- char *remotehost;
- struct sockaddr_in6 recvaddr;
-#else
- struct sockaddr_in recvaddr;
-#endif
+ sockaddr_t recvaddr;
Tcl_Channel chan;
UdpState *statePtr;
buffer_size = atoi(argv[2]);
if (buffer_size > 16) buffer_size = 16;
}
+
+ socksize = sizeof(sockaddr_t);
actual_size = recvfrom(sock, message, buffer_size, MSG_PEEK,
(struct sockaddr *)&recvaddr, &socksize);
Tcl_AppendResult(interp, errBuf, (char *)NULL);
return TCL_ERROR;
}
-#ifdef SIPC_IPV6
- memcpy(&statePtr->saddr6_peer, &recvaddr, sizeof(recvaddr));
-#else
memcpy(&statePtr->saddr_peer, &recvaddr, sizeof(recvaddr));
-#endif
- message[16]='\0';
+ message[actual_size]='\0';
+ Tcl_ResetResult(interp);
Tcl_AppendResult(interp, message, (char *)NULL);
return TCL_OK;
+
#else /* WIN32 */
Tcl_SetResult(interp, "udp_peek not implemented for this platform",
TCL_STATIC);
udpWatch(ClientData instanceData, int mask)
{
#ifndef WIN32
- UdpState *fsPtr = (UdpState *) instanceData;
+ UdpState *statePtr = (UdpState *) instanceData;
if (mask) {
UDPTRACE("Tcl_CreateFileHandler\n");
- Tcl_CreateFileHandler(fsPtr->sock, mask,
+ Tcl_CreateFileHandler(statePtr->sock, mask,
(Tcl_FileProc *) Tcl_NotifyChannel,
- (ClientData) fsPtr->channel);
+ (ClientData) statePtr->channel);
} else {
UDPTRACE("Tcl_DeleteFileHandler\n");
- Tcl_DeleteFileHandler(fsPtr->sock);
+ Tcl_DeleteFileHandler(statePtr->sock);
}
#endif
}
memcpy(&statePtr->saddr_peer, &recvaddr, sizeof(recvaddr));
#ifdef SIPC_IPV6
- inet_ntop(recvaddr.sin_family, &statePtr->saddr_peer.sin_addr,
- number, 128);
+ inet_ntop(recvaddr.ipv6.sin_family,
+ &statePtr->saddr_peer.ipv6.sin_addr,
+ number, 128);
#else
- inet_ntop(statePtr->saddr_peer.sin_family, &statePtr->saddr_peer.sin_addr,
- number, 128);
+ inet_ntop(statePtr->saddr_peer.ipv4.sin_family,
+ &statePtr->saddr_peer.ipv4.sin_addr,
+ number, 128);
#endif
- UDPTRACE("remotehost: %s:%d\n", number, ntohs(recvaddr.sin6_port));
+ UDPTRACE("remotehost: %s:%d\n", number, ntohs(recvaddr.ipv6.sin6_port));
#endif /* ! WIN32 */