aboutsummaryrefslogtreecommitdiffstats
path: root/src/assuan-socket-server.c
diff options
context:
space:
mode:
authorTimo Schulz <[email protected]>2004-11-24 07:30:08 +0000
committerTimo Schulz <[email protected]>2004-11-24 07:30:08 +0000
commitc36b96808391edf9211b1c60b00825f31be7a93c (patch)
treea0b446f425c02eea2d44dad2cbf461ff76f9ad11 /src/assuan-socket-server.c
parent* assuan-socket-connect.c (LOG): Fixed macro to print not only the (diff)
downloadlibassuan-c36b96808391edf9211b1c60b00825f31be7a93c.tar.gz
libassuan-c36b96808391edf9211b1c60b00825f31be7a93c.zip
2004-11-23 Timo Schulz <[email protected]>
* assuan-socket.c (_assuan_sock_connect): Get local port from the sun_path[] file. (_assuan_sock_bind): Write local port to the sun_path[] file. * assuan-socket-connect.c (assuan_socket_connect): Use DIRSEP_C for a better portability. (assuan-defs.h): Define DIRSEP_C. 2004-11-22 Timo Schulz <[email protected]> * assuan-io.c (_assuan_simple_read, _assuan_simple_write): W32 support. * assuan-socket.c (_assuan_close): New. (_assuan_sock_new): New. (_assuan_sock_bind): New.
Diffstat (limited to 'src/assuan-socket-server.c')
-rw-r--r--src/assuan-socket-server.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/assuan-socket-server.c b/src/assuan-socket-server.c
index e81ee50..7585aa8 100644
--- a/src/assuan-socket-server.c
+++ b/src/assuan-socket-server.c
@@ -22,15 +22,19 @@
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
+#include <unistd.h>
#include <sys/types.h>
+#ifndef _WIN32
#include <sys/socket.h>
#include <sys/un.h>
-#include <unistd.h>
+#else
+#include <windows.h>
+#endif
#include "assuan-defs.h"
static int
-accept_connection_bottom (ASSUAN_CONTEXT ctx)
+accept_connection_bottom (assuan_context_t ctx)
{
int fd = ctx->connected_fd;
@@ -64,7 +68,7 @@ accept_connection_bottom (ASSUAN_CONTEXT ctx)
static int
-accept_connection (ASSUAN_CONTEXT ctx)
+accept_connection (assuan_context_t ctx)
{
int fd;
struct sockaddr_un clnt_addr;
@@ -82,11 +86,11 @@ accept_connection (ASSUAN_CONTEXT ctx)
}
static int
-finish_connection (ASSUAN_CONTEXT ctx)
+finish_connection (assuan_context_t ctx)
{
if (ctx->inbound.fd != -1)
{
- close (ctx->inbound.fd);
+ _assuan_close (ctx->inbound.fd);
}
ctx->inbound.fd = -1;
ctx->outbound.fd = -1;
@@ -95,7 +99,7 @@ finish_connection (ASSUAN_CONTEXT ctx)
static void
-deinit_socket_server (ASSUAN_CONTEXT ctx)
+deinit_socket_server (assuan_context_t ctx)
{
finish_connection (ctx);
}
@@ -106,9 +110,9 @@ static struct assuan_io io = { _assuan_simple_read,
/* Initialize a server for the socket LISTEN_FD which has already be
put into listen mode */
int
-assuan_init_socket_server (ASSUAN_CONTEXT *r_ctx, int listen_fd)
+assuan_init_socket_server (assuan_context_t *r_ctx, int listen_fd)
{
- ASSUAN_CONTEXT ctx;
+ assuan_context_t ctx;
int rc;
*r_ctx = NULL;
@@ -140,9 +144,9 @@ assuan_init_socket_server (ASSUAN_CONTEXT *r_ctx, int listen_fd)
/* Initialize a server using the already accepted socket FD. */
int
-assuan_init_connected_socket_server (ASSUAN_CONTEXT *r_ctx, int fd)
+assuan_init_connected_socket_server (assuan_context_t *r_ctx, int fd)
{
- ASSUAN_CONTEXT ctx;
+ assuan_context_t ctx;
int rc;
*r_ctx = NULL;