3 /* gras_rl.h - private interface for legacy GRAS when on real life */
4 /* This file should be KILLED whenever the raw sockets work in the new gras */
6 /* Copyright (c) 2003 Martin Quinson. All rights reserved. */
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"
19 //#include "diagnostic.h"
23 /****************************************************************************/
24 /****************************************************************************/
25 /* Openning/Maintaining/Closing connexions */
26 /****************************************************************************/
27 /****************************************************************************/
29 /* Declaration of the socket type */
30 #define PEER_NAME_LEN 200
33 int port; /* port on this side */
34 char peer_name[PEER_NAME_LEN]; /* buffer to use PeerName_r */
38 struct gras_rawsock_s {
43 /****************************************************************************/
44 /****************************************************************************/
45 /* Format convertion stuff (copied verbatim from formatutil.h because I need*/
46 /* to put datadescriptor in gras.h and the functions only in RL) */
47 /****************************************************************************/
48 /****************************************************************************/
50 void ConvertData(void *destination,
52 const DataDescriptor *description,
54 FormatTypes sourceFormat);
57 int DifferentFormat(DataTypes whatType);
58 int DifferentOrder(void);
59 int DifferentSize(DataTypes whatType);
60 void HomogenousConvertData(void *destination,
64 FormatTypes sourceFormat);
65 size_t HomogenousDataSize(DataTypes whatType,
68 void ReverseData(void *destination,
75 /****************************************************************************/
76 /****************************************************************************/
77 /* Messaging stuff (reimplementation of message.h) */
78 /****************************************************************************/
79 /****************************************************************************/
82 * @sd: Socket on which this message arrives
83 * @size: Size of the message to discard.
85 * Discard data on the socket because of failure on our side (out of mem or msg
89 gras_msg_discard(gras_sock_t *sd, size_t size);
93 * @sd: Socket to listen on
94 * @data: Where to store the data (allocated by this function)
95 * @description: What data to expect.
96 * @Returns: the number of bytes read for that.
98 * Receive data from the network on a buffer allocated by this function for that
101 grasDataRecv( gras_sock_t *sd,
103 const DataDescriptor *description,
104 size_t description_length,
105 unsigned int repetition);
109 * @sd: Socket to write on
110 * @data: What to send
111 * @description: Format of the data
112 * @Returns: the number of bytes written
114 * Send a sequence of data across the network
117 grasDataSend(gras_sock_t *sd,
119 const DataDescriptor *description,
120 size_t description_length,
125 #endif /* GRAS_SG_H */