3 * @author Michal Sojka <sojkam1@fel.cvut.cz>
4 * @date Thu Aug 28 10:36:23 2008
6 * @brief FORB transport protocol module
14 #include "forb-internal.h"
17 #include <ul_logbase.h>
21 typedef struct forb_proto forb_proto_t;
24 * Description of a FORB transport protocol.
27 /** Number of seconds between sending of HELLO messages for discovery process */
28 unsigned hello_interval;
31 * Called to free any protocol resources associated with the port.
33 * @param port The port to be destroyed.
35 * @return Zero on success, negatove error code on error.
37 int (*port_destroy)(forb_port_t *port);
40 * Sends data to a peer.
42 * If the protocol is connection-oriented, the connection data
43 * can be stored at @c port->proto_priv and used by later
46 * @param peer Peer to send data
47 * @param buf Data to send
48 * @param len Length of data to send
50 * @return Length of the sent data (should be equal to @a len on
51 * success) or negative error code on error.
53 size_t (*send)(forb_peer_t *peer, const void *buf, size_t len);
56 * Called to free any protocol resources associated with the
59 * @param peer Peer to destroy
61 * @return Zero on success, negatove error code on error.
63 int (*peer_destroy)(forb_peer_t *peer);
65 * Receives data through a port
67 * @param port Port to use
68 * @param buf Where to store the received data
69 * @param len Length the buffer @a buf
71 * @return Length of the received data or negative error code
74 size_t (*recv)(forb_port_t *port, void *buf, size_t len);
77 * Broadcasts/multicasts a message. All FORBs connected the
78 * the network/bus represented by the @a port should receive
81 * This function is used by peer discovery protocol.
83 * @param port Port to use
84 * @param buf Data to broadcast
85 * @param len Length of the @a data
87 * @return Zero or positive number on success, negative error
90 size_t (*broadcast)(forb_port_t *port, const void *buf, size_t len);
92 /** Serializes the protocol specific address */
93 CORBA_boolean (*serialize_addr)(CDR_Codec *codec, const void *addr);
95 /** Deserializes the protocol specific address */
96 CORBA_boolean (*deserialize_addr)(CDR_Codec *codec, void **addr);
99 size_t forb_proto_send(forb_peer_t *peer, CDR_Codec *codec);
102 forb_get_next_hop(forb_t *forb, forb_server_id *server);