source: lib/rtserver.h @ 9456f1e

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 9456f1e was 9456f1e, checked in by Daniel Lawson <dlawson@…>, 16 years ago

adding in the rtserver files that SHANE DIDN'T ADD IN

  • Property mode set to 100644
File size: 1.2 KB
Line 
1#include <stdio.h>
2
3#ifndef RTSERVER_H
4#define RT_SERVER_H
5
6struct rtserver_t;
7
8/** Creates an rtserver_t object and sets up a port to listen for incoming connections
9 *
10 *  @param hostname     the address on which the server will operate
11 *  @param port         the port on which the server will operate
12 *
13 *  @returns a pointer to the newly created rtserver_t object
14 */
15struct rtserver_t * rtserver_create(char * hostname, short port);
16
17/** Destroys an rtserver_t object, freeing any memory it might be using
18 */
19void rtserver_destroy(struct rtserver_t * rtserver);
20
21/** Checks the listening port for incoming connections. If a connection attempt is detected, accepts
22 *  the connection and adds it to the list of clients.
23 *
24 *  @returns -1 if an error occurs, 0 if no clients connect, otherwise the fd of the last client to connect
25 */
26int rtserver_checklisten(struct rtserver_t * rtserver);
27
28/** Sends the given packet to all the connected clients
29 * 
30 *  @param rtserver     the rtserver
31 *  @param buffer       the packet to be sent
32 *  @param len          the size of the packet in bytes
33 * 
34 *  @returns -1 if an error occurs, otherwise the number of bytes sent to the last client
35 */
36int rtserver_sendclients(struct rtserver_t * rtserver, char * buffer, size_t len);
37
38
39#endif
Note: See TracBrowser for help on using the repository browser.