Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix (c) dates; make clear this is deprecated code
[simgrid.git] / src / gras / RL / gras_rl.h
1 /* $Id$ */
2
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 */
5
6 /* Copyright (c) 2003 Martin Quinson. All rights reserved.                  */
7
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. */
10
11 #ifndef GRAS_RL_H
12 #define GRAS_RL_H
13
14 #ifdef GRAS_SG_H
15 #error Impossible to load gras_sg.h and gras_rl.h at the same time
16 #endif
17
18 #include "gras_private.h"
19 //#include "diagnostic.h"
20
21 BEGIN_DECL
22
23 /****************************************************************************/
24 /****************************************************************************/
25 /* Openning/Maintaining/Closing connexions                                  */
26 /****************************************************************************/
27 /****************************************************************************/
28
29 /* Declaration of the socket type */
30 #define PEER_NAME_LEN 200
31 struct gras_sock_s {
32   int sock;
33   int port;         /* port on this side */
34   char peer_name[PEER_NAME_LEN];  /* buffer to use PeerName_r */
35   char *peer_addr;
36 };
37
38 struct gras_rawsock_s {
39    int sock;
40    int port;
41 };
42
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 /****************************************************************************/
49
50 void ConvertData(void *destination,
51                  const void *source,
52                  const DataDescriptor *description,
53                  size_t length,
54                  FormatTypes sourceFormat);
55
56
57 int DifferentFormat(DataTypes whatType);
58 int DifferentOrder(void);
59 int DifferentSize(DataTypes whatType);
60 void HomogenousConvertData(void *destination,
61                            const void *source,
62                            DataTypes whatType,
63                            size_t repetitions,
64                            FormatTypes sourceFormat);
65 size_t HomogenousDataSize(DataTypes whatType,
66                           size_t repetitions,
67                           FormatTypes format);
68 void ReverseData(void *destination,
69                  const void *source,
70                  DataTypes whatType,
71                  int repetitions,
72                  FormatTypes format);
73
74
75 /****************************************************************************/
76 /****************************************************************************/
77 /* Messaging stuff (reimplementation of message.h)                          */
78 /****************************************************************************/
79 /****************************************************************************/
80 /**
81  * gras_msg_discard:
82  * @sd: Socket on which this message arrives
83  * @size: Size of the message to discard.
84  *
85  * Discard data on the socket because of failure on our side (out of mem or msg
86  * type unknown). 
87  */
88 void
89 gras_msg_discard(gras_sock_t *sd, size_t size);
90
91 /**
92  * grasRecvData:
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.
97  *
98  * Receive data from the network on a buffer allocated by this function for that
99  */
100 int
101 grasDataRecv( gras_sock_t *sd,
102               void **data,
103               const DataDescriptor *description,
104               size_t description_length,
105               unsigned int repetition);
106
107 /**
108  * grasRecvData:
109  * @sd: Socket to write on
110  * @data: What to send
111  * @description: Format of the data
112  * @Returns: the number of bytes written
113  *
114  * Send a sequence of data across the network
115  */
116 xbt_error_t
117 grasDataSend(gras_sock_t *sd,
118              const void *data,
119              const DataDescriptor *description,
120              size_t description_length,
121              int repetition);
122
123 END_DECL
124
125 #endif /* GRAS_SG_H */