diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-01-26 15:43:25 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-01-26 15:43:25 +0000 |
commit | bb492222a26b665ab24791ee46eac3a3e73e7a05 (patch) | |
tree | 239b0ae3eef56b2a39a8c18610add165cece9717 /src/transport/plugin_transport_unix.c | |
parent | e511364a0c2dd06579c883d8ed87c7a4b6719509 (diff) | |
download | gnunet-bb492222a26b665ab24791ee46eac3a3e73e7a05.tar.gz gnunet-bb492222a26b665ab24791ee46eac3a3e73e7a05.zip |
- fix
Diffstat (limited to 'src/transport/plugin_transport_unix.c')
-rw-r--r-- | src/transport/plugin_transport_unix.c | 67 |
1 files changed, 65 insertions, 2 deletions
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c index aebfeb883..7d41b95a7 100644 --- a/src/transport/plugin_transport_unix.c +++ b/src/transport/plugin_transport_unix.c | |||
@@ -659,6 +659,67 @@ unix_real_send (void *cls, struct RetrySendContext *incoming_retry_context, | |||
659 | 659 | ||
660 | 660 | ||
661 | /** | 661 | /** |
662 | * Creates a new outbound session the transport service will use to send data to the | ||
663 | * peer | ||
664 | * | ||
665 | * @param cls the plugin | ||
666 | * @param address the address | ||
667 | * @return the session or NULL of max connections exceeded | ||
668 | */ | ||
669 | |||
670 | static struct Session * | ||
671 | unix_plugin_get_session (void *cls, | ||
672 | const struct GNUNET_HELLO_Address *address) | ||
673 | { | ||
674 | struct Session * s = NULL; | ||
675 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "To be implemented\n"); | ||
676 | GNUNET_break (0); | ||
677 | return s; | ||
678 | } | ||
679 | |||
680 | /** | ||
681 | * Function that can be used by the transport service to transmit | ||
682 | * a message using the plugin. Note that in the case of a | ||
683 | * peer disconnecting, the continuation MUST be called | ||
684 | * prior to the disconnect notification itself. This function | ||
685 | * will be called with this peer's HELLO message to initiate | ||
686 | * a fresh connection to another peer. | ||
687 | * | ||
688 | * @param cls closure | ||
689 | * @param session which session must be used | ||
690 | * @param msgbuf the message to transmit | ||
691 | * @param msgbuf_size number of bytes in 'msgbuf' | ||
692 | * @param priority how important is the message (most plugins will | ||
693 | * ignore message priority and just FIFO) | ||
694 | * @param to how long to wait at most for the transmission (does not | ||
695 | * require plugins to discard the message after the timeout, | ||
696 | * just advisory for the desired delay; most plugins will ignore | ||
697 | * this as well) | ||
698 | * @param cont continuation to call once the message has | ||
699 | * been transmitted (or if the transport is ready | ||
700 | * for the next transmission call; or if the | ||
701 | * peer disconnected...); can be NULL | ||
702 | * @param cont_cls closure for cont | ||
703 | * @return number of bytes used (on the physical network, with overheads); | ||
704 | * -1 on hard errors (i.e. address invalid); 0 is a legal value | ||
705 | * and does NOT mean that the message was not transmitted (DV) | ||
706 | */ | ||
707 | static ssize_t | ||
708 | unix_plugin_send (void *cls, | ||
709 | struct Session *session, | ||
710 | const char *msgbuf, size_t msgbuf_size, | ||
711 | unsigned int priority, | ||
712 | struct GNUNET_TIME_Relative to, | ||
713 | GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls) | ||
714 | { | ||
715 | ssize_t sent = -1; | ||
716 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "To be implemented\n"); | ||
717 | GNUNET_break (0); | ||
718 | return sent; | ||
719 | } | ||
720 | |||
721 | |||
722 | /** | ||
662 | * Function that can be used by the transport service to transmit | 723 | * Function that can be used by the transport service to transmit |
663 | * a message using the plugin. | 724 | * a message using the plugin. |
664 | * | 725 | * |
@@ -683,7 +744,7 @@ unix_real_send (void *cls, struct RetrySendContext *incoming_retry_context, | |||
683 | * still be transmitted later!) | 744 | * still be transmitted later!) |
684 | */ | 745 | */ |
685 | static ssize_t | 746 | static ssize_t |
686 | unix_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target, | 747 | unix_plugin_send_old (void *cls, const struct GNUNET_PeerIdentity *target, |
687 | const char *msgbuf, size_t msgbuf_size, unsigned int priority, | 748 | const char *msgbuf, size_t msgbuf_size, unsigned int priority, |
688 | struct GNUNET_TIME_Relative timeout, struct Session *session, | 749 | struct GNUNET_TIME_Relative timeout, struct Session *session, |
689 | const void *addr, size_t addrlen, int force_address, | 750 | const void *addr, size_t addrlen, int force_address, |
@@ -1086,7 +1147,9 @@ libgnunet_plugin_transport_unix_init (void *cls) | |||
1086 | api = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PluginFunctions)); | 1147 | api = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PluginFunctions)); |
1087 | api->cls = plugin; | 1148 | api->cls = plugin; |
1088 | 1149 | ||
1089 | api->send = &unix_plugin_send; | 1150 | api->get_session = &unix_plugin_get_session; |
1151 | api->send_with_session = &unix_plugin_send; | ||
1152 | api->send = &unix_plugin_send_old; | ||
1090 | api->disconnect = &unix_disconnect; | 1153 | api->disconnect = &unix_disconnect; |
1091 | api->address_pretty_printer = &unix_plugin_address_pretty_printer; | 1154 | api->address_pretty_printer = &unix_plugin_address_pretty_printer; |
1092 | api->address_to_string = &unix_address_to_string; | 1155 | api->address_to_string = &unix_address_to_string; |