3 /* transport - low level communication (send/receive bunches of bytes) */
5 /* module's private interface masked even to other parts of GRAS. */
7 /* Authors: Martin Quinson */
8 /* Copyright (C) 2004 Martin Quinson. */
10 /* This program is free software; you can redistribute it and/or modify it
11 under the terms of the license (GNU LGPL) which comes with this package. */
13 #ifndef GRAS_TRP_PRIVATE_H
14 #define GRAS_TRP_PRIVATE_H
16 #include "gras_private.h"
17 #include "gras/Transport/transport_interface.h"
18 #include "gras/Virtu/virtu_interface.h" /* socketset_get() */
23 * Description of a socket.
25 typedef struct gras_trp_bufdata_ gras_trp_bufdata_t;
27 struct s_gras_socket {
28 gras_trp_plugin_t *plugin;
30 int incoming :1; /* true if we can read from this sock */
31 int outgoing :1; /* true if we can write on this sock */
32 int accepting :1; /* true if master incoming sock in tcp */
33 int raw :1; /* true if this is an experiment socket instead of messaging */
35 unsigned long int bufSize; /* what to say to the OS. field here to remember it when accepting */
38 int port; /* port on this side */
39 int peer_port; /* port on the other side */
40 char *peer_name; /* hostname of the other side */
42 void *data; /* plugin specific data */
44 /* buffer plugin specific data. Yeah, C is not OO, so I got to trick */
45 gras_trp_bufdata_t *bufdata;
48 gras_error_t gras_trp_socket_new(int incomming,
52 typedef gras_error_t (*gras_trp_setup_t)(gras_trp_plugin_t *dst);
54 gras_error_t gras_trp_tcp_setup(gras_trp_plugin_t *plug);
55 gras_error_t gras_trp_file_setup(gras_trp_plugin_t *plug);
56 gras_error_t gras_trp_sg_setup(gras_trp_plugin_t *plug);
57 gras_error_t gras_trp_buf_setup(gras_trp_plugin_t *plug);
61 I'm tired of that shit. the select in SG has to create a socket to expeditor
62 manually do deal with the weirdness of the hostdata, themselves here to deal
63 with the weird channel concept of SG and convert them back to ports.
65 When introducing buffered transport (whith I want to get used in SG to debug
66 the buffering itself), we should not make the rest of the code aware of the
67 change and not specify code for this. This is bad design.
69 But there is bad design all over the place, so fuck off for now, when we can
70 get rid of MSG and rely directly on SG, this crude hack can go away. But in
71 the meanwhile, I want to sleep this night (FIXME).
73 Hu! You evil problem! Taste my axe!
77 gras_error_t gras_trp_buf_init_sock(gras_socket_t *sock);
80 /* Data exchange over raw sockets */
81 gras_error_t gras_socket_raw_exchange(gras_socket_t *peer,
84 unsigned long int expSize,
85 unsigned long int msgSize);
87 #endif /* GRAS_TRP_PRIVATE_H */