summaryrefslogtreecommitdiff
path: root/support/dktools/dk4sock01.c
diff options
context:
space:
mode:
Diffstat (limited to 'support/dktools/dk4sock01.c')
-rw-r--r--support/dktools/dk4sock01.c172
1 files changed, 0 insertions, 172 deletions
diff --git a/support/dktools/dk4sock01.c b/support/dktools/dk4sock01.c
deleted file mode 100644
index e5dee57dd8..0000000000
--- a/support/dktools/dk4sock01.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
-Copyright (C) 2015-2020, Dirk Krause
-SPDX-License-Identifier: BSD-3-Clause
-*/
-
-/*
- WARNING: This file was generated by the dkct program (see
- http://dktools.sourceforge.net/ for details).
- Changes you make here will be lost if dkct is run again!
- You should modify the original source and run dkct on it.
- Original source: dk4sock01.ctr
-*/
-
-/** @file dk4sock01.c The dk4sock01 module.
-*/
-
-
-#line 10 "dk4sock01.ctr"
-
-#include "dk4conf.h"
-#include "dk4sock.h"
-
-#if DK4_HAVE_ERRNO_H
-#ifndef ERRNO_H_INCLUDED
-#include <errno.h>
-#define ERRNO_H_INCLUDED 1
-#endif
-#endif
-
-#include "dk4unused.h"
-
-
-
-
-
-#line 26 "dk4sock01.ctr"
-
-
-
-void
-dk4socket_error_reset(void)
-{
-#if DK4_ON_WINDOWS
- WSASetLastError(0);
-#else
- errno = 0;
- h_errno = 0;
-#endif
-}
-
-
-
-int
-dk4socket_error_get(void)
-{
-#if DK4_ON_WINDOWS
- return (WSAGetLastError());
-#else
- return (errno);
-#endif
-}
-
-
-
-void
-dk4socket_error_report(dk4_er_t *erp, int ec)
-{
-#if DK4_ON_WINDOWS
- dk4error_set_idetails(erp, ec, WSAGetLastError());
-#else
- switch (ec) {
- case DK4_E_SOCKET_GETHOSTBYNAME : {
- dk4error_set_idetails(erp, ec, h_errno);
- } break;
- default : {
- dk4error_set_idetails(erp, ec, errno);
- } break;
- }
-#endif
-}
-
-
-void
-dk4socket_debug_address(
-#if TRACE_DEBUG
- const char *text,
- struct sockaddr *addr,
- size_t sz
-#else
- const char * DK4_ARG_UNUSED(text),
- struct sockaddr * DK4_ARG_UNUSED(addr),
- size_t DK4_ARG_UNUSED(sz)
-#endif
-)
-{
-#if TRACE_DEBUG
- FILE *fipo;
- struct sockaddr_in *soin;
- unsigned long ul;
- unsigned short us;
- fipo = dktrace_file();
- if (NULL != fipo) {
- if (NULL != text) {
- fputs(text, fipo);
- fputc('\n', fipo);
- }
- switch (addr->sa_family) {
- case AF_INET : {
- fputs("Address family: AF_INET\n", fipo);
- soin = (struct sockaddr_in *)addr;
- ul = soin->sin_addr.s_addr;
- us = soin->sin_port;
- ul = ntohl(ul);
- us = ntohs(us);
- fprintf(
- fipo,
- "%lu.%lu.%lu.%lu:%u\n",
- ((ul >> 24) & 0x000000FFUL),
- ((ul >> 16) & 0x000000FFUL),
- ((ul >> 8) & 0x000000FFUL),
- (ul & 0x000000FFUL),
- (unsigned)us
- );
- } break;
- case AF_INET6 : {
- fputs("Address family: AF_INET6\n", fipo);
- } break;
- case AF_UNIX : {
- fputs("Address family: AF_UNIX\n", fipo);
- } break;
- default : {
- fputs("Address family: !UNKNOWN!\n", fipo);
- } break;
- }
- }
-#else
- DK4_UNUSED_ARG(text)
- DK4_UNUSED_ARG(addr)
- DK4_UNUSED_ARG(sz)
-#endif
-}
-
-
-
-#if (DK4_HAVE_SETSOCKOPT) && defined(SOL_SOCKET) && defined(SO_ERROR)
-
-int
-dk4socket_non_null_getsockopt(int optval, socklen_t slo)
-{
- unsigned char *ptr;
- socklen_t i;
- socklen_t max;
- int back = 0;
-
-
-#line 144 "dk4sock01.ctr"
- max = sizeof(int);
- if (slo < max) { max = slo; }
- ptr = (unsigned char *)(&optval);
- for (i = 0; ((0 == back) && (i < max)); i++) {
- if (0x00 != *(ptr++)) {
- back = 1;
- }
- }
-
-
-#line 153 "dk4sock01.ctr"
- return back;
-}
-
-#endif
-