]> rtime.felk.cvut.cz Git - frescor/forb.git/blobdiff - src/proto.h
Added register callback for protocols
[frescor/forb.git] / src / proto.h
index d101464481bc8a0cc25c1f56531976b175f94912..140e0c7145377ae759187e6febf7dc61c3df75c3 100644 (file)
@@ -1,9 +1,55 @@
+/**************************************************************************/
+/* ---------------------------------------------------------------------- */
+/* Copyright (C) 2006 - 2008 FRESCOR consortium partners:                */
+/*                                                                       */
+/*   Universidad de Cantabria,              SPAIN                        */
+/*   University of York,                    UK                           */
+/*   Scuola Superiore Sant'Anna,            ITALY                        */
+/*   Kaiserslautern University,             GERMANY                      */
+/*   Univ. Politécnica  Valencia,           SPAIN                       */
+/*   Czech Technical University in Prague,  CZECH REPUBLIC               */
+/*   ENEA                                   SWEDEN                       */
+/*   Thales Communication S.A.              FRANCE                       */
+/*   Visual Tools S.A.                      SPAIN                        */
+/*   Rapita Systems Ltd                     UK                           */
+/*   Evidence                               ITALY                        */
+/*                                                                       */
+/*   See http://www.frescor.org for a link to partners' websites         */
+/*                                                                       */
+/*          FRESCOR project (FP6/2005/IST/5-034026) is funded            */
+/*       in part by the European Union Sixth Framework Programme         */
+/*       The European Union is not liable of any use that may be         */
+/*       made of this code.                                              */
+/*                                                                       */
+/*                                                                       */
+/*  This file is part of FORB (Frescor Object Request Broker)            */
+/*                                                                       */
+/* FORB is free software; you can redistribute it and/or modify it       */
+/* under terms of the GNU General Public License as published by the     */
+/* Free Software Foundation; either version 2, or (at your option) any   */
+/* later version.  FORB is distributed in the hope that it will be       */
+/* useful, but WITHOUT ANY WARRANTY; without even the implied warranty   */
+/* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   */
+/* General Public License for more details. You should have received a   */
+/* copy of the GNU General Public License along with FORB; see file      */
+/* COPYING. If not, write to the Free Software Foundation, 675 Mass Ave,  */
+/* Cambridge, MA 02139, USA.                                             */
+/*                                                                       */
+/* As a special exception, including FORB header files in a file,        */
+/* instantiating FORB generics or templates, or linking other files      */
+/* with FORB objects to produce an executable application, does not      */
+/* by itself cause the resulting executable application to be covered    */
+/* by the GNU General Public License. This exception does not            */
+/* however invalidate any other reasons why the executable file might be  */
+/* covered by the GNU Public License.                                    */
+/**************************************************************************/
+
 /**
  * @file   proto.h
  * @author Michal Sojka <sojkam1@fel.cvut.cz>
  * @date   Thu Aug 28 10:36:23 2008
  * 
- * @brief  FORB transport protocol module
+ * @brief  FORB transport protocol declarations
  * 
  * 
  */
@@ -58,9 +104,10 @@ struct forb_proto {
         * 
         * @param peer Peer to destroy
         * 
-        * @return Zero on success, negatove error code on error.
+        * @note The memory allocated by @a deserialize_addr (if any)
+        * is deallocated by FORB and should not be deallocated here.
         */
-       int (*peer_destroy)(forb_peer_t *peer);
+       void (*peer_destroy)(forb_peer_t *peer);
        /** 
         * Receives data through a port
         * 
@@ -90,16 +137,26 @@ struct forb_proto {
        size_t (*broadcast)(forb_port_t *port, const void *buf, size_t len);
 
        /** Serializes the protocol specific address */
-       CORBA_boolean (*serialize_addr)(CDR_Codec *codec, const void *addr);
+       CORBA_boolean (*serialize_addr)(FORB_CDR_Codec *codec, const void *addr);
+
+       /** Deserializes the protocol specific address. The memory for
+        * storing the address should be allocated by forb_malloc(). */
+       CORBA_boolean (*deserialize_addr)(FORB_CDR_Codec *codec, void **addr);
 
-       /** Deserializes the protocol specific address */
-       CORBA_boolean (*deserialize_addr)(CDR_Codec *codec, void **addr);
+       /** Converts protocol specific address to string */
+       size_t (*addr2str)(char *dest, size_t maxlen, const void *addr);
+
+       /**
+        * Callback caled when the port is registered to FORB just
+        * before reception and discovery threads are started.
+        */
+       void (*register_cb)(forb_port_t *port);
 };
 
-size_t forb_proto_send(forb_peer_t *peer, CDR_Codec *codec);
+size_t forb_proto_send(forb_peer_t *peer, FORB_CDR_Codec *codec);
 
 forb_peer_t *
-forb_get_next_hop(forb_t *forb, forb_server_id *server);
+forb_get_next_hop(forb_t *forb, forb_server_id *server, fosa_abs_time_t *timeout);
 
 
 #endif