XMMS2
src/include/xmmsc/xmmsc_ipc_transport.h
Go to the documentation of this file.
00001 /*  XMMS2 - X Music Multiplexer System
00002  *  Copyright (C) 2003-2011 XMMS2 Team
00003  *
00004  *  PLUGINS ARE NOT CONSIDERED TO BE DERIVED WORK !!!
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU Lesser General Public
00008  *  License as published by the Free Software Foundation; either
00009  *  version 2.1 of the License, or (at your option) any later version.
00010  *
00011  *  This library is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  *  Lesser General Public License for more details.
00015  */
00016 
00017 
00018 #ifndef XMMS_IPC_TRANSPORT_H
00019 #define XMMS_IPC_TRANSPORT_H
00020 
00021 #include "xmmsc/xmmsc_stdint.h"
00022 #include "xmmsc/xmmsc_sockets.h"
00023 
00024 typedef struct xmms_ipc_transport_St xmms_ipc_transport_t;
00025 
00026 typedef int (*xmms_ipc_read_func) (xmms_ipc_transport_t *, char *, int);
00027 typedef int (*xmms_ipc_write_func) (xmms_ipc_transport_t *, char *, int);
00028 typedef xmms_ipc_transport_t *(*xmms_ipc_accept_func) (xmms_ipc_transport_t *);
00029 typedef void (*xmms_ipc_destroy_func) (xmms_ipc_transport_t *);
00030 
00031 void xmms_ipc_transport_destroy (xmms_ipc_transport_t *ipct);
00032 int xmms_ipc_transport_read (xmms_ipc_transport_t *ipct, char *buffer, int len);
00033 int xmms_ipc_transport_write (xmms_ipc_transport_t *ipct, char *buffer, int len);
00034 xmms_socket_t xmms_ipc_transport_fd_get (xmms_ipc_transport_t *ipct);
00035 xmms_ipc_transport_t * xmms_ipc_server_accept (xmms_ipc_transport_t *ipct);
00036 xmms_ipc_transport_t * xmms_ipc_client_init (const char *path);
00037 xmms_ipc_transport_t * xmms_ipc_server_init (const char *path);
00038 char * xmms_ipc_hostname (const char *path);
00039 
00040 struct xmms_ipc_transport_St {
00041     char *path;
00042     void *data;
00043     xmms_socket_t fd;
00044     int32_t peer;
00045     int16_t peer_port;
00046 
00047     xmms_ipc_accept_func accept_func;
00048     xmms_ipc_write_func write_func;
00049     xmms_ipc_read_func read_func;
00050     xmms_ipc_destroy_func destroy_func;
00051 };
00052 
00053 #endif
00054