1 /* Copyright (C) 2009 Pierre-Marc Fournier
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #include <sys/types.h>
26 #define SOCK_DIR "/tmp/ust-app-socks"
27 #define UST_SIGNAL SIGIO
29 struct ustcomm_connection
{
30 struct list_head list
;
32 /* Data that has not yet been consumed: */
38 /* ustcomm_server must be shallow-copyable */
39 struct ustcomm_server
{
40 /* the "server" socket for serving the external requests */
44 struct list_head connections
;
48 struct ustcomm_server server
;
52 struct ustcomm_server server
;
55 /* ustcomm_source must be shallow-copyable */
56 struct ustcomm_source
{
61 extern char *strdup_malloc(const char *s
);
63 //int send_message_pid(pid_t pid, const char *msg, char **reply);
64 extern int ustcomm_request_consumer(pid_t pid
, const char *channel
);
66 extern int ustcomm_ustd_recv_message(struct ustcomm_ustd
*ustd
, char **msg
, struct ustcomm_source
*src
, int timeout
);
67 extern int ustcomm_app_recv_message(struct ustcomm_app
*app
, char **msg
, struct ustcomm_source
*src
, int timeout
);
69 extern int ustcomm_init_app(pid_t pid
, struct ustcomm_app
*handle
);
70 extern void ustcomm_fini_app(struct ustcomm_app
*handle
, int keep_socket_file
);
71 extern void ustcomm_fini_ustd(struct ustcomm_ustd
*handle
);
73 extern int ustcomm_init_ustd(struct ustcomm_ustd
*handle
, const char *sock_path
);
75 extern int ustcomm_connect_app(pid_t pid
, struct ustcomm_connection
*conn
);
76 extern int ustcomm_close_app(struct ustcomm_connection
*conn
);
77 extern int ustcomm_connect_path(const char *path
, struct ustcomm_connection
*conn
, pid_t signalpid
);
78 extern int ustcomm_send_request(struct ustcomm_connection
*conn
, const char *req
, char **reply
);
79 extern int ustcomm_send_reply(struct ustcomm_server
*server
, char *msg
, struct ustcomm_source
*src
);
80 extern int ustcomm_disconnect(struct ustcomm_connection
*conn
);
81 extern int ustcomm_close_all_connections(struct ustcomm_server
*server
);
83 extern int nth_token_is(const char *str
, const char *token
, int tok_no
);
85 extern char *nth_token(const char *str
, int tok_no
);
87 extern int pid_is_online(pid_t
);
89 #endif /* USTCOMM_H */
This page took 0.047503 seconds and 5 git commands to generate.