|
Lines 82-87
typedef int (*con_mgr_on_connection_data_t)(con_mgr_fd_t *con, void *arg);
Link Here
|
| 82 |
*/ |
82 |
*/ |
| 83 |
typedef void (*con_mgr_on_connection_finish)(void *arg); |
83 |
typedef void (*con_mgr_on_connection_finish)(void *arg); |
| 84 |
|
84 |
|
|
|
85 |
typedef struct { |
| 86 |
const char *host; |
| 87 |
const char *port; /* port as string for later parsing */ |
| 88 |
} parsed_host_port_t; |
| 89 |
|
| 90 |
/* |
| 91 |
* Parse a combined host:port string into host and port |
| 92 |
* IN str host:port string for parsing |
| 93 |
* OUT parsed will be populated with strings (must xfree()) |
| 94 |
* RET SLURM_SUCCESS or error |
| 95 |
*/ |
| 96 |
typedef parsed_host_port_t *(*parse_host_port_t)(const char *str); |
| 97 |
|
| 98 |
/* |
| 99 |
* Free parsed_host_port_t returned from parse_host_port_t() |
| 100 |
*/ |
| 101 |
typedef void (*free_parse_host_port_t)(parsed_host_port_t *parsed); |
| 102 |
|
| 103 |
|
| 85 |
/* |
104 |
/* |
| 86 |
* Struct of call backs to call on events |
105 |
* Struct of call backs to call on events |
| 87 |
* of a given connection. |
106 |
* of a given connection. |
|
Lines 196-201
struct con_mgr_s {
Link Here
|
| 196 |
/* First observed error */ |
215 |
/* First observed error */ |
| 197 |
int error; |
216 |
int error; |
| 198 |
|
217 |
|
|
|
218 |
/* functions to handle host/port parsing */ |
| 219 |
parse_host_port_t parse_host_port; |
| 220 |
free_parse_host_port_t free_parse_host_port; |
| 221 |
|
| 199 |
pthread_mutex_t mutex; |
222 |
pthread_mutex_t mutex; |
| 200 |
/* called after events or changes to wake up _watch */ |
223 |
/* called after events or changes to wake up _watch */ |
| 201 |
pthread_cond_t cond; |
224 |
pthread_cond_t cond; |
|
Lines 205-213
struct con_mgr_s {
Link Here
|
| 205 |
* create and init a connection manager |
228 |
* create and init a connection manager |
| 206 |
* only call once! |
229 |
* only call once! |
| 207 |
* IN thread_count - number of threads to create |
230 |
* IN thread_count - number of threads to create |
|
|
231 |
* IN parse_host_port - function to parse host/port string |
| 232 |
* IN free_parse_host_port - function to release parsed host/ports |
| 233 |
* IN thread_count - number of threads to create |
| 208 |
* RET SLURM_SUCCESS or error |
234 |
* RET SLURM_SUCCESS or error |
| 209 |
*/ |
235 |
*/ |
| 210 |
extern con_mgr_t *init_con_mgr(int thread_count); |
236 |
extern con_mgr_t *init_con_mgr(int thread_count, |
|
|
237 |
parse_host_port_t parse_host_port, |
| 238 |
free_parse_host_port_t free_parse_host_port); |
| 211 |
extern void free_con_mgr(con_mgr_t *mgr); |
239 |
extern void free_con_mgr(con_mgr_t *mgr); |
| 212 |
|
240 |
|
| 213 |
/* |
241 |
/* |