aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_template.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-02-13 16:02:44 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-02-13 16:02:44 +0000
commit2e2e5b4a8e5cebd71b880da8c613be4a49f44fe2 (patch)
tree270c64858fd4494c0d62970b7aa5926d185cef46 /src/transport/plugin_transport_template.c
parent5b9e61b9c3832e69164ee8574fff6711b2f18ef6 (diff)
downloadgnunet-2e2e5b4a8e5cebd71b880da8c613be4a49f44fe2.tar.gz
gnunet-2e2e5b4a8e5cebd71b880da8c613be4a49f44fe2.zip
removing legacy send functions from plugins and renaming new send function
Diffstat (limited to 'src/transport/plugin_transport_template.c')
-rw-r--r--src/transport/plugin_transport_template.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/src/transport/plugin_transport_template.c b/src/transport/plugin_transport_template.c
index 7110f9c88..d3072627e 100644
--- a/src/transport/plugin_transport_template.c
+++ b/src/transport/plugin_transport_template.c
@@ -124,44 +124,48 @@ struct Plugin
124 124
125}; 125};
126 126
127
127/** 128/**
128 * Function that can be used by the transport service to transmit 129 * Function that can be used by the transport service to transmit
129 * a message using the plugin. 130 * a message using the plugin. Note that in the case of a
131 * peer disconnecting, the continuation MUST be called
132 * prior to the disconnect notification itself. This function
133 * will be called with this peer's HELLO message to initiate
134 * a fresh connection to another peer.
130 * 135 *
131 * @param cls closure 136 * @param cls closure
132 * @param target who should receive this message 137 * @param session which session must be used
133 * @param priority how important is the message
134 * @param msgbuf the message to transmit 138 * @param msgbuf the message to transmit
135 * @param msgbuf_size number of bytes in 'msgbuf' 139 * @param msgbuf_size number of bytes in 'msgbuf'
136 * @param timeout when should we time out 140 * @param priority how important is the message (most plugins will
137 * @param session which session must be used (or NULL for "any") 141 * ignore message priority and just FIFO)
138 * @param addr the address to use (can be NULL if the plugin 142 * @param to how long to wait at most for the transmission (does not
139 * is "on its own" (i.e. re-use existing TCP connection)) 143 * require plugins to discard the message after the timeout,
140 * @param addrlen length of the address in bytes 144 * just advisory for the desired delay; most plugins will ignore
141 * @param force_address GNUNET_YES if the plugin MUST use the given address, 145 * this as well)
142 * otherwise the plugin may use other addresses or
143 * existing connections (if available)
144 * @param cont continuation to call once the message has 146 * @param cont continuation to call once the message has
145 * been transmitted (or if the transport is ready 147 * been transmitted (or if the transport is ready
146 * for the next transmission call; or if the 148 * for the next transmission call; or if the
147 * peer disconnected...) 149 * peer disconnected...); can be NULL
148 * @param cont_cls closure for cont 150 * @param cont_cls closure for cont
149 * @return number of bytes used (on the physical network, with overheads); 151 * @return number of bytes used (on the physical network, with overheads);
150 * -1 on hard errors (i.e. address invalid); 0 is a legal value 152 * -1 on hard errors (i.e. address invalid); 0 is a legal value
151 * and does NOT mean that the message was not transmitted (DV) 153 * and does NOT mean that the message was not transmitted (DV)
152 */ 154 */
153static ssize_t 155static ssize_t
154template_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target, 156template_plugin_send (void *cls,
155 const char *msgbuf, size_t msgbuf_size, 157 struct Session *session,
156 unsigned int priority, 158 const char *msgbuf, size_t msgbuf_size,
157 struct GNUNET_TIME_Relative timeout, 159 unsigned int priority,
158 struct Session *session, const void *addr, size_t addrlen, 160 struct GNUNET_TIME_Relative to,
159 int force_address, 161 GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls)
160 GNUNET_TRANSPORT_TransmitContinuation cont,
161 void *cont_cls)
162{ 162{
163 struct Plugin *plugin = cls;
163 int bytes_sent = 0; 164 int bytes_sent = 0;
164 165
166 GNUNET_assert (plugin != NULL);
167 GNUNET_assert (session != NULL);
168
165 /* struct Plugin *plugin = cls; */ 169 /* struct Plugin *plugin = cls; */
166 return bytes_sent; 170 return bytes_sent;
167} 171}