3 /* gras_sg.h - private interface for GRAS when using the simulator */
5 /* Authors: Martin Quinson */
6 /* Copyright (C) 2003 the OURAGAN project. */
8 /* This program is free software; you can redistribute it and/or modify it
9 under the terms of the license (GNU LGPL) which comes with this package. */
15 #error Impossible to load gras_sg.h and gras_rl.h at the same time
18 #include "gras_private.h"
23 /* Declaration of the socket type */
25 int server_sock; /* boolean */
26 int raw_sock; /* boolean. If true, socket for raw send/recv.
27 If false. socket for formated messages */
29 int from_PID; /* process which sent this message */
30 int to_PID; /* process to which this message is destinated */
32 m_host_t to_host; /* Who's on other side */
33 int to_port; /* port on which the server is earing */
34 m_channel_t to_chan;/* Channel on which the other side is earing */
36 struct gras_rawsock_s {
37 int server_sock; /* boolean */
38 int raw_sock; /* boolean. If true, socket for raw send/recv.
39 If false. socket for formated messages */
41 int from_PID; /* process which sent this message */
42 int to_PID; /* process to which this message is destinated */
44 m_host_t to_host; /* Who's on other side */
45 int to_port; /* port on which the server is earing */
46 m_channel_t to_chan;/* Channel on which the other side is earing */
49 /* Data for each host */
51 int proc[MAX_CHANNEL]; /* who's connected to each channel (its PID). If =0, then free */
54 int *port; /* list of ports used by a server socket */
55 int *port2chan; /* the channel it points to */
56 int *raw; /* (boolean) the channel is in raw mode or for formatted messages */
60 /* prototype of private functions */
62 * _gras_sock_server_open:
64 * Open a server socket either in raw or regular mode, depending on the @raw argument.
65 * In SG, bufSize is ignored.
68 _gras_sock_server_open(unsigned short startingPort, unsigned short endingPort,
69 int raw, unsigned int bufSize, /* OUT */ gras_sock_t **sock);
72 * _gras_sock_client_open:
74 * Open a client socket either in raw or regular mode, depending on the @raw argument.
75 * In SG, bufSize is ignored.
78 _gras_sock_client_open(const char *host, short port, int raw, unsigned int bufSize,
79 /* OUT */ gras_sock_t **sock);
85 * Close a socket which were opened either in raw or regular mode, depending on the
88 gras_error_t _gras_sock_close(int raw, gras_sock_t *sd);
93 #endif /* GRAS_SG_H */