#include <arpa/inet.h>
#include <errno.h>
#include <net/if.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <atalk/logger.h>
#include <atalk/dsi.h>
#include <atalk/compat.h>
#include <atalk/util.h>
#include <atalk/errchk.h>
Macros | |
#define | min(a, b) |
#define | DSI_TCPMAXPEND 20 /* max # of pending connections */ |
#define | DSI_TCPTIMEOUT 120 /* timeout in seconds for connections */ |
#define | SOCKLEN_T unsigned int |
#define | IFF_SLAVE 0 |
#define | SOL_TCP IPPROTO_TCP |
#define | AI_NUMERICSERV 0 |
Functions | |
static void | dsi_tcp_close (DSI *dsi) |
static void | timeout_handler (int sig _U_) |
static void | dsi_init_buffer (DSI *dsi) |
void | dsi_free (DSI *dsi) |
static pid_t | dsi_tcp_open (DSI *dsi) |
static void | guess_interface (DSI *dsi, const char *hostname, const char *port) |
static int | dsi_tcp_listen (const char *address, const char *port, struct addrinfo *hints, DSI *dsi, bool *psocket_err_afnotsup) |
int | dsi_tcp_init (DSI *dsi, const char *hostname, const char *inaddress, const char *inport) |
Variables | |
static struct itimerval | itimer |
#define AI_NUMERICSERV 0 |
#define DSI_TCPMAXPEND 20 /* max # of pending connections */ |
#define DSI_TCPTIMEOUT 120 /* timeout in seconds for connections */ |
#define IFF_SLAVE 0 |
#define min | ( | a, | |
b ) |
#define SOCKLEN_T unsigned int |
#define SOL_TCP IPPROTO_TCP |
void dsi_free | ( | DSI * | dsi | ) |
Free any allocated resources of the master afpd DSI objects and close server socket
|
static |
int dsi_tcp_init | ( | DSI * | dsi, |
const char * | hostname, | ||
const char * | inaddress, | ||
const char * | inport ) |
Initialize DSI over TCP
dsi | (rw) DSI handle |
hostname | (r) pointer to hostname string |
inaddress | (r) Optional IPv4 or IPv6 address with an optional port, may be NULL |
inport | (r) pointer to port string |
Creates listening AFP/DSI socket. If the parameter inaddress is NULL, then we listen on the wildcard address, i,e, on all interfaces. That should mean listening on the IPv6 address "::" on IPv4/IPv6 dual stack kernels, accepting both v4 and v6 requests.
If the parameter inaddress is not NULL, then we only listen on the given address. The parameter may contain a port number using the URL format for address and port:
IPv4, IPv4:port, IPv6, [IPv6], [IPv6]:port
Parameter inport must be a valid pointer to a port string and is used if the inaddress parameter doesn't contain a port.
|
static |
|
static |
|
static |
|
static |
|
static |