]> rtime.felk.cvut.cz Git - frescor/forb.git/blobdiff - src/proto.h
Added register callback for protocols
[frescor/forb.git] / src / proto.h
index 0abf8f112ad4e8fb107af1fc9f4811bf009cb1ec..140e0c7145377ae759187e6febf7dc61c3df75c3 100644 (file)
@@ -104,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
         * 
@@ -138,8 +139,18 @@ struct forb_proto {
        /** Serializes the protocol specific address */
        CORBA_boolean (*serialize_addr)(FORB_CDR_Codec *codec, const void *addr);
 
-       /** Deserializes the protocol specific address */
+       /** 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);
+
+       /** 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, FORB_CDR_Codec *codec);