Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove the headers already loaded from somewhere else. Keep the remaining for the...
[simgrid.git] / include / gras / transport.h
1 /* $Id$ */
2
3 /* transport - low level communication (send/receive bunches of bytes)      */
4 /* module's public interface exported to end user.                          */
5
6 /* Copyright (c) 2004 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_TRANSPORT_H
12 #define GRAS_TRANSPORT_H
13
14 #include "xbt/error.h"
15
16 typedef struct s_gras_socket *gras_socket_t;
17
18 xbt_error_t gras_socket_client(const char *host,
19                                 unsigned short port,
20                                 /* OUT */ gras_socket_t *dst);
21 xbt_error_t gras_socket_server(unsigned short port,
22                                 /* OUT */ gras_socket_t *dst);
23 void         gras_socket_close(gras_socket_t sd);
24
25 /* get information about socket */
26 int   gras_socket_my_port  (gras_socket_t sock);
27 int   gras_socket_peer_port(gras_socket_t sock);
28 char *gras_socket_peer_name(gras_socket_t sock);
29
30 /* extended interface to get all details */
31 xbt_error_t gras_socket_client_ext(const char *host,
32                                     unsigned short port,
33                                     unsigned long int bufSize,
34                                     int raw, 
35                                     /* OUT */ gras_socket_t *dst);
36 xbt_error_t gras_socket_server_ext(unsigned short port,
37                                     unsigned long int bufSize,
38                                     int raw,
39                                     /* OUT */ gras_socket_t *dst);
40
41 /* using raw sockets */
42 xbt_error_t gras_socket_raw_send(gras_socket_t peer, 
43                                   unsigned int timeout,
44                                   unsigned long int expSize, 
45                                   unsigned long int msgSize);
46 xbt_error_t gras_socket_raw_recv(gras_socket_t peer, 
47                                   unsigned int timeout,
48                                   unsigned long int expSize, 
49                                   unsigned long int msgSize);
50
51 /* debuging functions */
52 xbt_error_t gras_socket_client_from_file(const char*path,
53                                           /* OUT */ gras_socket_t *dst);
54 xbt_error_t gras_socket_server_from_file(const char*path,
55                                           /* OUT */ gras_socket_t *dst);
56                                           
57    
58 #endif /* GRAS_TRANSPORT_H */