kinetic-c  v0.12.0
Seagate Kinetic Protocol Client Library for C
listener.h
Go to the documentation of this file.
1 /*
2 * kinetic-c
3 * Copyright (C) 2015 Seagate Technology.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20 #ifndef LISTENER_H
21 #define LISTENER_H
22 
23 #include "bus_types.h"
24 #include "bus_internal_types.h"
25 
28 #define LISTENER_BACKPRESSURE_SHIFT 0 /* TODO */
29 
32 #define LISTENER_EXPECT_BACKPRESSURE_SHIFT 7
33 
36 struct listener;
37 
39 struct listener *Listener_Init(struct bus *b, struct bus_config *cfg);
40 
42 bool Listener_AddSocket(struct listener *l, connection_info *ci, int *notify_fd);
43 bool Listener_RemoveSocket(struct listener *l, int fd, int *notify_fd);
44 
48 bool Listener_HoldResponse(struct listener *l, int fd,
49  int64_t seq_id, int16_t timeout_sec, int *notify_fd);
50 
52 bool Listener_ExpectResponse(struct listener *l, boxed_msg *box,
53  uint16_t *backpressure);
54 
56 bool Listener_Shutdown(struct listener *l, int *notify_fd);
57 
59 void Listener_Free(struct listener *l);
60 
61 #ifdef TEST
63 #endif
64 
65 #endif
Receiver of responses.
Message bus.
bool Listener_HoldResponse(struct listener *l, int fd, int64_t seq_id, int16_t timeout_sec, int *notify_fd)
The client is about to start a write, the listener should hold on to the response (with timeout) if i...
Definition: listener.c:115
Per-socket connection context.
bool Listener_ExpectResponse(struct listener *l, boxed_msg *box, uint16_t *backpressure)
The client has finished a write, the listener should expect a response.
Definition: listener.c:143
void Listener_Free(struct listener *l)
Free the listener, which must already be shut down.
Definition: listener.c:179
struct listener * Listener_Init(struct bus *b, struct bus_config *cfg)
Initialize the listener.
Definition: listener.c:39
bool Listener_Shutdown(struct listener *l, int *notify_fd)
Shut down the listener.
Definition: listener.c:170
bool Listener_AddSocket(struct listener *l, connection_info *ci, int *notify_fd)
Add/remove sockets' metadata from internal info.
Definition: listener.c:94
bool Listener_RemoveSocket(struct listener *l, int fd, int *notify_fd)
Definition: listener.c:105