mirror of
https://github.com/haiwen/libsearpc.git
synced 2025-04-27 18:25:06 +00:00
named pipe transport: compile on linux.
This commit is contained in:
parent
b76607f784
commit
307d466eb1
@ -13,6 +13,6 @@ libsearpc_la_SOURCES = searpc-client.c searpc-server.c searpc-utils.c searpc-nam
|
||||
|
||||
libsearpc_la_LDFLAGS = -version-info 1:2:0 -no-undefined
|
||||
|
||||
libsearpc_la_LIBADD = @GLIB_LIBS@ @JANSSON_LIBS@
|
||||
libsearpc_la_LIBADD = @GLIB_LIBS@ @JANSSON_LIBS@ -lpthread
|
||||
|
||||
dist_bin_SCRIPTS = searpc-codegen.py
|
||||
|
@ -1,9 +1,10 @@
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <glib/gstdio.h>
|
||||
#include <jansson.h>
|
||||
@ -189,6 +190,8 @@ static void* named_pipe_client_handler(void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
close(connfd);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,17 @@
|
||||
#include <glib-object.h>
|
||||
#include <jansson.h>
|
||||
|
||||
// Implementatin of a searpc transport based on named pipe. It uses unix domain
|
||||
// sockets on linux/osx, and named pipes on windows.
|
||||
//
|
||||
// On the server side, there is a thread that listens for incoming connections,
|
||||
// and it would create a new thread to handle each connection. Thus the RPC
|
||||
// functions on the server side may be called from different threads, and it's
|
||||
// the RPC functions implementation's responsibility to guarantee thread safety
|
||||
// of the RPC calls. (e.g. using mutexes).
|
||||
|
||||
// Server side interface.
|
||||
|
||||
typedef struct {
|
||||
char path[4096];
|
||||
pthread_t listener_thread;
|
||||
@ -12,6 +23,12 @@ typedef struct {
|
||||
int pipe_fd;
|
||||
} SearpcNamedPipeServer;
|
||||
|
||||
SearpcNamedPipeServer* searpc_create_named_pipe_server(const char *path);
|
||||
|
||||
int searpc_named_pipe_server_start(SearpcNamedPipeServer *server);
|
||||
|
||||
// Client side interface.
|
||||
|
||||
typedef struct {
|
||||
char path[4096];
|
||||
int pipe_fd;
|
||||
@ -19,12 +36,8 @@ typedef struct {
|
||||
|
||||
SearpcNamedPipeClient* searpc_create_named_pipe_client(const char *path);
|
||||
|
||||
SearpcNamedPipeServer* searpc_create_named_pipe_server(const char *path);
|
||||
|
||||
SearpcClient * searpc_client_with_named_pipe_transport(SearpcNamedPipeClient *client, const char *service);
|
||||
|
||||
int searpc_named_pipe_server_start(SearpcNamedPipeServer *server);
|
||||
|
||||
int searpc_named_pipe_client_connect(SearpcNamedPipeClient *client);
|
||||
|
||||
#endif // SEARPC_NAMED_PIPE_TRANSPORT_H
|
||||
|
Loading…
Reference in New Issue
Block a user