Logo AND Algorithmique Numérique Distribuée

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