3 /* gras_rl.h - private interface for GRAS when on real life */
5 /* Copyright (c) 2004 Martin Quinson. All rights reserved. */
7 /* This program is free software; you can redistribute it and/or modify it
8 * under the terms of the license (GNU LGPL) which comes with this package. */
14 #error Impossible to load gras_sg.h and gras_rl.h at the same time
17 #include "gras_private.h"
18 //#include "diagnostic.h"
22 /****************************************************************************/
23 /****************************************************************************/
24 /* Openning/Maintaining/Closing connexions */
25 /****************************************************************************/
26 /****************************************************************************/
28 /* Declaration of the socket type */
29 #define PEER_NAME_LEN 200
32 int port; /* port on this side */
33 char peer_name[PEER_NAME_LEN]; /* buffer to use PeerName_r */
37 struct gras_rawsock_s {
42 /****************************************************************************/
43 /****************************************************************************/
44 /* Format convertion stuff (copied verbatim from formatutil.h because I need*/
45 /* to put datadescriptor in gras.h and the functions only in RL) */
46 /****************************************************************************/
47 /****************************************************************************/
49 void ConvertData(void *destination,
51 const DataDescriptor *description,
53 FormatTypes sourceFormat);
56 int DifferentFormat(DataTypes whatType);
57 int DifferentOrder(void);
58 int DifferentSize(DataTypes whatType);
59 void HomogenousConvertData(void *destination,
63 FormatTypes sourceFormat);
64 size_t HomogenousDataSize(DataTypes whatType,
67 void ReverseData(void *destination,
74 /****************************************************************************/
75 /****************************************************************************/
76 /* Messaging stuff (reimplementation of message.h) */
77 /****************************************************************************/
78 /****************************************************************************/
81 * @sd: Socket on which this message arrives
82 * @size: Size of the message to discard.
84 * Discard data on the socket because of failure on our side (out of mem or msg
88 gras_msg_discard(gras_sock_t *sd, size_t size);
92 * @sd: Socket to listen on
93 * @data: Where to store the data (allocated by this function)
94 * @description: What data to expect.
95 * @Returns: the number of bytes read for that.
97 * Receive data from the network on a buffer allocated by this function for that
100 grasDataRecv( gras_sock_t *sd,
102 const DataDescriptor *description,
103 size_t description_length,
104 unsigned int repetition);
108 * @sd: Socket to write on
109 * @data: What to send
110 * @description: Format of the data
111 * @Returns: the number of bytes written
113 * Send a sequence of data across the network
116 grasDataSend(gras_sock_t *sd,
118 const DataDescriptor *description,
119 size_t description_length,
124 #endif /* GRAS_SG_H */