| gnunet_client_lib.h | | gnunet_client_lib.h | |
| | | | |
| skipping to change at line 71 | | skipping to change at line 71 | |
| * Destroy connection with the service. This will automatically | | * Destroy connection with the service. This will automatically | |
| * cancel any pending "receive" request (however, the handler will | | * cancel any pending "receive" request (however, the handler will | |
| * *NOT* be called, not even with a NULL message). Any pending | | * *NOT* be called, not even with a NULL message). Any pending | |
| * transmission request will also be cancelled UNLESS the callback for | | * transmission request will also be cancelled UNLESS the callback for | |
| * the transmission request has already been called, in which case the | | * the transmission request has already been called, in which case the | |
| * transmission 'finish_pending_write' argument determines whether or | | * transmission 'finish_pending_write' argument determines whether or | |
| * not the write is guaranteed to complete before the socket is fully | | * not the write is guaranteed to complete before the socket is fully | |
| * destroyed (unless, of course, there is an error with the server in | | * destroyed (unless, of course, there is an error with the server in | |
| * which case the message may still be lost). | | * which case the message may still be lost). | |
| * | | * | |
|
| * @param sock handle to the service connection | | * @param client handle to the service connection | |
| * @param finish_pending_write should a transmission already passed to the | | | |
| * handle be completed? | | | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_CLIENT_disconnect (struct GNUNET_CLIENT_Connection *sock, | | GNUNET_CLIENT_disconnect (struct GNUNET_CLIENT_Connection *client); | |
| int finish_pending_write); | | | |
| | | | |
| /** | | /** | |
| * Type of a function to call when we receive a message | | * Type of a function to call when we receive a message | |
| * from the service. | | * from the service. | |
| * | | * | |
| * @param cls closure | | * @param cls closure | |
| * @param msg message received, NULL on timeout or fatal error | | * @param msg message received, NULL on timeout or fatal error | |
| */ | | */ | |
| typedef void (*GNUNET_CLIENT_MessageHandler) (void *cls, | | typedef void (*GNUNET_CLIENT_MessageHandler) (void *cls, | |
| const struct GNUNET_MessageHe
ader | | const struct GNUNET_MessageHe
ader | |
| | | | |
| skipping to change at line 105 | | skipping to change at line 102 | |
| * @param reason what is the result of the shutdown | | * @param reason what is the result of the shutdown | |
| * GNUNET_NO on shutdown (not running) | | * GNUNET_NO on shutdown (not running) | |
| * GNUNET_YES on running | | * GNUNET_YES on running | |
| * GNUNET_SYSERR on failure to transmit message | | * GNUNET_SYSERR on failure to transmit message | |
| */ | | */ | |
| typedef void (*GNUNET_CLIENT_ShutdownTask) (void *cls, int reason); | | typedef void (*GNUNET_CLIENT_ShutdownTask) (void *cls, int reason); | |
| | | | |
| /** | | /** | |
| * Read from the service. | | * Read from the service. | |
| * | | * | |
|
| * @param sock the service | | * @param client connection to the service | |
| * @param handler function to call with the message | | * @param handler function to call with the message | |
| * @param handler_cls closure for handler | | * @param handler_cls closure for handler | |
| * @param timeout how long to wait until timing out | | * @param timeout how long to wait until timing out | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_CLIENT_receive (struct GNUNET_CLIENT_Connection *sock, | | GNUNET_CLIENT_receive (struct GNUNET_CLIENT_Connection *client, | |
| GNUNET_CLIENT_MessageHandler handler, void *handler_
cls, | | GNUNET_CLIENT_MessageHandler handler, void *handler_
cls, | |
| struct GNUNET_TIME_Relative timeout); | | struct GNUNET_TIME_Relative timeout); | |
| | | | |
| /** | | /** | |
| * Transmit handle for client connections. | | * Transmit handle for client connections. | |
| */ | | */ | |
| struct GNUNET_CLIENT_TransmitHandle; | | struct GNUNET_CLIENT_TransmitHandle; | |
| | | | |
| /** | | /** | |
| * Ask the client to call us once the specified number of bytes | | * Ask the client to call us once the specified number of bytes | |
| * are free in the transmission buffer. May call the notify | | * are free in the transmission buffer. May call the notify | |
| * method immediately if enough space is available. | | * method immediately if enough space is available. | |
| * | | * | |
|
| * @param sock connection to the service | | * @param client connection to the service | |
| * @param size number of bytes to send | | * @param size number of bytes to send | |
| * @param timeout after how long should we give up (and call | | * @param timeout after how long should we give up (and call | |
| * notify with buf NULL and size 0)? | | * notify with buf NULL and size 0)? | |
| * @param auto_retry if the connection to the service dies, should we | | * @param auto_retry if the connection to the service dies, should we | |
| * automatically re-connect and retry (within the timeout period) | | * automatically re-connect and retry (within the timeout period) | |
| * or should we immediately fail in this case? Pass GNUNET_YES | | * or should we immediately fail in this case? Pass GNUNET_YES | |
| * if the caller does not care about temporary connection errors, | | * if the caller does not care about temporary connection errors, | |
| * for example because the protocol is stateless | | * for example because the protocol is stateless | |
| * @param notify function to call | | * @param notify function to call | |
| * @param notify_cls closure for notify | | * @param notify_cls closure for notify | |
| * @return NULL if someone else is already waiting to be notified | | * @return NULL if someone else is already waiting to be notified | |
| * non-NULL if the notify callback was queued (can be used to cance
l | | * non-NULL if the notify callback was queued (can be used to cance
l | |
| * using GNUNET_CONNECTION_notify_transmit_ready_cancel) | | * using GNUNET_CONNECTION_notify_transmit_ready_cancel) | |
| */ | | */ | |
| struct GNUNET_CLIENT_TransmitHandle * | | struct GNUNET_CLIENT_TransmitHandle * | |
|
| GNUNET_CLIENT_notify_transmit_ready (struct GNUNET_CLIENT_Connection *sock, | | GNUNET_CLIENT_notify_transmit_ready (struct GNUNET_CLIENT_Connection *clien
t, | |
| size_t size, | | size_t size, | |
| struct GNUNET_TIME_Relative timeout, | | struct GNUNET_TIME_Relative timeout, | |
| int auto_retry, | | int auto_retry, | |
| GNUNET_CONNECTION_TransmitReadyNotify | | GNUNET_CONNECTION_TransmitReadyNotify | |
| notify, void *notify_cls); | | notify, void *notify_cls); | |
| | | | |
| /** | | /** | |
| * Cancel a request for notification. | | * Cancel a request for notification. | |
| * | | * | |
| * @param th handle from the original request. | | * @param th handle from the original request. | |
| | | | |
| skipping to change at line 164 | | skipping to change at line 161 | |
| GNUNET_CLIENT_notify_transmit_ready_cancel (struct GNUNET_CLIENT_TransmitHa
ndle | | GNUNET_CLIENT_notify_transmit_ready_cancel (struct GNUNET_CLIENT_TransmitHa
ndle | |
| *th); | | *th); | |
| | | | |
| /** | | /** | |
| * Convenience API that combines sending a request | | * Convenience API that combines sending a request | |
| * to the service and waiting for a response. | | * to the service and waiting for a response. | |
| * If either operation times out, the callback | | * If either operation times out, the callback | |
| * will be called with a "NULL" response (in which | | * will be called with a "NULL" response (in which | |
| * case the connection should probably be destroyed). | | * case the connection should probably be destroyed). | |
| * | | * | |
|
| * @param sock connection to use | | * @param client connection to use | |
| * @param hdr message to transmit | | * @param hdr message to transmit | |
| * @param timeout when to give up (for both transmission | | * @param timeout when to give up (for both transmission | |
| * and for waiting for a response) | | * and for waiting for a response) | |
| * @param auto_retry if the connection to the service dies, should we | | * @param auto_retry if the connection to the service dies, should we | |
| * automatically re-connect and retry (within the timeout period) | | * automatically re-connect and retry (within the timeout period) | |
| * or should we immediately fail in this case? Pass GNUNET_YES | | * or should we immediately fail in this case? Pass GNUNET_YES | |
| * if the caller does not care about temporary connection errors, | | * if the caller does not care about temporary connection errors, | |
| * for example because the protocol is stateless | | * for example because the protocol is stateless | |
| * @param rn function to call with the response | | * @param rn function to call with the response | |
| * @param rn_cls closure for rn | | * @param rn_cls closure for rn | |
| * @return GNUNET_OK on success, GNUNET_SYSERR if a request | | * @return GNUNET_OK on success, GNUNET_SYSERR if a request | |
| * is already pending | | * is already pending | |
| */ | | */ | |
| int | | int | |
|
| GNUNET_CLIENT_transmit_and_get_response (struct GNUNET_CLIENT_Connection *s
ock, | | GNUNET_CLIENT_transmit_and_get_response (struct GNUNET_CLIENT_Connection *c
lient, | |
| const struct GNUNET_MessageHeader
*hdr, | | const struct GNUNET_MessageHeader
*hdr, | |
| struct GNUNET_TIME_Relative timeou
t, | | struct GNUNET_TIME_Relative timeou
t, | |
| int auto_retry, | | int auto_retry, | |
| GNUNET_CLIENT_MessageHandler rn, | | GNUNET_CLIENT_MessageHandler rn, | |
| void *rn_cls); | | void *rn_cls); | |
| | | | |
| /** | | /** | |
| * Wait until the service is running. | | * Wait until the service is running. | |
| * | | * | |
| * @param service name of the service to wait for | | * @param service name of the service to wait for | |
| | | | |
End of changes. 8 change blocks. |
| 11 lines changed or deleted | | 8 lines changed or added | |
|
| gnunet_config.h | | gnunet_config.h | |
| | | | |
| skipping to change at line 162 | | skipping to change at line 162 | |
| | | | |
| /* Define to 1 if you have the `freeifaddrs' function. */ | | /* Define to 1 if you have the `freeifaddrs' function. */ | |
| #define HAVE_FREEIFADDRS 1 | | #define HAVE_FREEIFADDRS 1 | |
| | | | |
| /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ | | /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ | |
| #define HAVE_FSEEKO 1 | | #define HAVE_FSEEKO 1 | |
| | | | |
| /* Define to 1 if you have the `ftruncate' function. */ | | /* Define to 1 if you have the `ftruncate' function. */ | |
| #define HAVE_FTRUNCATE 1 | | #define HAVE_FTRUNCATE 1 | |
| | | | |
|
| /* Define to 1 if you have the `getaddrinfo' function. */ | | /* Define this if getaddrinfo() is available */ | |
| #define HAVE_GETADDRINFO 1 | | #define HAVE_GETADDRINFO 1 | |
| | | | |
| /* Define to 1 if you have the `getcwd' function. */ | | /* Define to 1 if you have the `getcwd' function. */ | |
| #define HAVE_GETCWD 1 | | #define HAVE_GETCWD 1 | |
| | | | |
|
| /* Define to 1 if you have the `gethostbyaddr' function. */ | | /* Define this if gethostbyaddr() is available */ | |
| #define HAVE_GETHOSTBYADDR 1 | | #define HAVE_GETHOSTBYADDR 1 | |
| | | | |
|
| /* Define to 1 if you have the `gethostbyname' function. */ | | /* Define this if gethostbyname() is available */ | |
| #define HAVE_GETHOSTBYNAME 1 | | #define HAVE_GETHOSTBYNAME 1 | |
| | | | |
| /* Define to 1 if you have the `gethostbyname2' function. */ | | /* Define to 1 if you have the `gethostbyname2' function. */ | |
| #define HAVE_GETHOSTBYNAME2 1 | | #define HAVE_GETHOSTBYNAME2 1 | |
| | | | |
|
| /* Define to 1 if you have the `gethostname' function. */ | | /* Define this if gethostname() is available */ | |
| #define HAVE_GETHOSTNAME 1 | | #define HAVE_GETHOSTNAME 1 | |
| | | | |
| /* Define to 1 if you have the `getifaddrs' function. */ | | /* Define to 1 if you have the `getifaddrs' function. */ | |
| #define HAVE_GETIFADDRS 1 | | #define HAVE_GETIFADDRS 1 | |
| | | | |
| /* getloadavg supported */ | | /* getloadavg supported */ | |
| #define HAVE_GETLOADAVG 1 | | #define HAVE_GETLOADAVG 1 | |
| | | | |
|
| /* Define to 1 if you have the `getnameinfo' function. */ | | /* Define this if getnameinfo() is available */ | |
| #define HAVE_GETNAMEINFO 1 | | #define HAVE_GETNAMEINFO 1 | |
| | | | |
| /* Define to 1 if you have the `getpeereid' function. */ | | /* Define to 1 if you have the `getpeereid' function. */ | |
| /* #undef HAVE_GETPEEREID */ | | /* #undef HAVE_GETPEEREID */ | |
| | | | |
| /* Define to 1 if you have the `getpeerucred' function. */ | | /* Define to 1 if you have the `getpeerucred' function. */ | |
| /* #undef HAVE_GETPEERUCRED */ | | /* #undef HAVE_GETPEERUCRED */ | |
| | | | |
| /* Define to 1 if you have the `getrusage' function. */ | | /* Define to 1 if you have the `getrusage' function. */ | |
| #define HAVE_GETRUSAGE 1 | | #define HAVE_GETRUSAGE 1 | |
| | | | |
| skipping to change at line 222 | | skipping to change at line 222 | |
| | | | |
| /* Define to 1 if you have the `gmtime_r' function. */ | | /* Define to 1 if you have the `gmtime_r' function. */ | |
| #define HAVE_GMTIME_R 1 | | #define HAVE_GMTIME_R 1 | |
| | | | |
| /* Define if you have the iconv() function. */ | | /* Define if you have the iconv() function. */ | |
| #define HAVE_ICONV 1 | | #define HAVE_ICONV 1 | |
| | | | |
| /* Define to 1 if you have the <ifaddrs.h> header file. */ | | /* Define to 1 if you have the <ifaddrs.h> header file. */ | |
| #define HAVE_IFADDRS_H 1 | | #define HAVE_IFADDRS_H 1 | |
| | | | |
|
| /* Define to 1 if you have the `inet_ntoa' function. */ | | /* Define this if inet_ntoa() is available */ | |
| #define HAVE_INET_NTOA 1 | | #define HAVE_INET_NTOA 1 | |
| | | | |
| /* Define to 1 if you have the `initgroups' function. */ | | /* Define to 1 if you have the `initgroups' function. */ | |
| #define HAVE_INITGROUPS 1 | | #define HAVE_INITGROUPS 1 | |
| | | | |
| /* Define to 1 if you have the <inttypes.h> header file. */ | | /* Define to 1 if you have the <inttypes.h> header file. */ | |
| #define HAVE_INTTYPES_H 1 | | #define HAVE_INTTYPES_H 1 | |
| | | | |
| /* Define to 1 if you have the <kstat.h> header file. */ | | /* Define to 1 if you have the <kstat.h> header file. */ | |
| /* #undef HAVE_KSTAT_H */ | | /* #undef HAVE_KSTAT_H */ | |
| | | | |
| skipping to change at line 351 | | skipping to change at line 351 | |
| | | | |
| /* Define to 1 if you have the <netinet/in.h> header file. */ | | /* Define to 1 if you have the <netinet/in.h> header file. */ | |
| #define HAVE_NETINET_IN_H 1 | | #define HAVE_NETINET_IN_H 1 | |
| | | | |
| /* Define to 1 if you have the <netinet/in_systm.h> header file. */ | | /* Define to 1 if you have the <netinet/in_systm.h> header file. */ | |
| #define HAVE_NETINET_IN_SYSTM_H 1 | | #define HAVE_NETINET_IN_SYSTM_H 1 | |
| | | | |
| /* Define to 1 if you have the `nl_langinfo' function. */ | | /* Define to 1 if you have the `nl_langinfo' function. */ | |
| #define HAVE_NL_LANGINFO 1 | | #define HAVE_NL_LANGINFO 1 | |
| | | | |
|
| | | /* Define to 1 if you have the <nss.h> header file. */ | |
| | | #define HAVE_NSS_H 1 | |
| | | | |
| /* Define to 1 if the system has the type `off_t'. */ | | /* Define to 1 if the system has the type `off_t'. */ | |
| #define HAVE_OFF_T 1 | | #define HAVE_OFF_T 1 | |
| | | | |
| /* Define to 1 if you have the `opendir' function. */ | | /* Define to 1 if you have the `opendir' function. */ | |
| #define HAVE_OPENDIR 1 | | #define HAVE_OPENDIR 1 | |
| | | | |
| /* Define to 1 if you have the <postgresql/libpq-fe.h> header file. */ | | /* Define to 1 if you have the <postgresql/libpq-fe.h> header file. */ | |
| /* #undef HAVE_POSTGRESQL_LIBPQ_FE_H */ | | /* #undef HAVE_POSTGRESQL_LIBPQ_FE_H */ | |
| | | | |
| /* Define if libtool can extract symbol lists from object files. */ | | /* Define if libtool can extract symbol lists from object files. */ | |
| | | | |
| skipping to change at line 381 | | skipping to change at line 384 | |
| | | | |
| /* Define to 1 if you have the `realpath' function. */ | | /* Define to 1 if you have the `realpath' function. */ | |
| #define HAVE_REALPATH 1 | | #define HAVE_REALPATH 1 | |
| | | | |
| /* Define to 1 if you have the `rmdir' function. */ | | /* Define to 1 if you have the `rmdir' function. */ | |
| #define HAVE_RMDIR 1 | | #define HAVE_RMDIR 1 | |
| | | | |
| /* Define to 1 if you have the `sbrk' function. */ | | /* Define to 1 if you have the `sbrk' function. */ | |
| #define HAVE_SBRK 1 | | #define HAVE_SBRK 1 | |
| | | | |
|
| /* Define to 1 if you have the `select' function. */ | | /* Define this if select() is available */ | |
| #define HAVE_SELECT 1 | | #define HAVE_SELECT 1 | |
| | | | |
| /* Define to 1 if you have the `setlocale' function. */ | | /* Define to 1 if you have the `setlocale' function. */ | |
| #define HAVE_SETLOCALE 1 | | #define HAVE_SETLOCALE 1 | |
| | | | |
| /* Define to 1 if you have the `setresuid' function. */ | | /* Define to 1 if you have the `setresuid' function. */ | |
| #define HAVE_SETRESUID 1 | | #define HAVE_SETRESUID 1 | |
| | | | |
| /* Define to 1 if you have the `setrlimit' function. */ | | /* Define to 1 if you have the `setrlimit' function. */ | |
| #define HAVE_SETRLIMIT 1 | | #define HAVE_SETRLIMIT 1 | |
| | | | |
| skipping to change at line 408 | | skipping to change at line 411 | |
| | | | |
| /* Define to 1 if the system has the type `sigset_t'. */ | | /* Define to 1 if the system has the type `sigset_t'. */ | |
| #define HAVE_SIGSET_T 1 | | #define HAVE_SIGSET_T 1 | |
| | | | |
| /* Define to 1 if the system has the type `size_t'. */ | | /* Define to 1 if the system has the type `size_t'. */ | |
| #define HAVE_SIZE_T 1 | | #define HAVE_SIZE_T 1 | |
| | | | |
| /* Do we have sockaddr_in.sin_len? */ | | /* Do we have sockaddr_in.sin_len? */ | |
| /* #undef HAVE_SOCKADDR_IN_SIN_LEN */ | | /* #undef HAVE_SOCKADDR_IN_SIN_LEN */ | |
| | | | |
|
| /* Define to 1 if you have the `socket' function. */ | | /* Define this if socket() is available */ | |
| #define HAVE_SOCKET 1 | | #define HAVE_SOCKET 1 | |
| | | | |
| /* Define to 1 if you have the <sockLib.h> header file. */ | | /* Define to 1 if you have the <sockLib.h> header file. */ | |
| /* #undef HAVE_SOCKLIB_H */ | | /* #undef HAVE_SOCKLIB_H */ | |
| | | | |
| /* Define to 1 if you have the <sqlite3.h> header file. */ | | /* Define to 1 if you have the <sqlite3.h> header file. */ | |
| #define HAVE_SQLITE3_H 1 | | #define HAVE_SQLITE3_H 1 | |
| | | | |
| /* Define to 1 if you have the `stat64' function. */ | | /* Define to 1 if you have the `stat64' function. */ | |
| #define HAVE_STAT64 1 | | #define HAVE_STAT64 1 | |
| | | | |
| skipping to change at line 709 | | skipping to change at line 712 | |
| /* Name of package */ | | /* Name of package */ | |
| #define PACKAGE "gnunet" | | #define PACKAGE "gnunet" | |
| | | | |
| /* Define to the address where bug reports for this package should be sent.
*/ | | /* Define to the address where bug reports for this package should be sent.
*/ | |
| #define PACKAGE_BUGREPORT "bug-gnunet@gnu.org" | | #define PACKAGE_BUGREPORT "bug-gnunet@gnu.org" | |
| | | | |
| /* Define to the full name of this package. */ | | /* Define to the full name of this package. */ | |
| #define PACKAGE_NAME "gnunet" | | #define PACKAGE_NAME "gnunet" | |
| | | | |
| /* Define to the full name and version of this package. */ | | /* Define to the full name and version of this package. */ | |
|
| #define PACKAGE_STRING "gnunet 0.9.2" | | #define PACKAGE_STRING "gnunet 0.9.3" | |
| | | | |
| /* Define to the one symbol short name of this package. */ | | /* Define to the one symbol short name of this package. */ | |
| #define PACKAGE_TARNAME "gnunet" | | #define PACKAGE_TARNAME "gnunet" | |
| | | | |
| /* Define to the home page for this package. */ | | /* Define to the home page for this package. */ | |
| #define PACKAGE_URL "" | | #define PACKAGE_URL "" | |
| | | | |
| /* Define to the version of this package. */ | | /* Define to the version of this package. */ | |
|
| #define PACKAGE_VERSION "0.9.2" | | #define PACKAGE_VERSION "0.9.3" | |
| | | | |
| /* Define as the return type of signal handlers (`int' or `void'). */ | | /* Define as the return type of signal handlers (`int' or `void'). */ | |
| #define RETSIGTYPE void | | #define RETSIGTYPE void | |
| | | | |
| /* Define to the type of arg 1 for `select'. */ | | /* Define to the type of arg 1 for `select'. */ | |
| #define SELECT_TYPE_ARG1 int | | #define SELECT_TYPE_ARG1 int | |
| | | | |
| /* Define to the type of args 2, 3 and 4 for `select'. */ | | /* Define to the type of args 2, 3 and 4 for `select'. */ | |
| #define SELECT_TYPE_ARG234 (fd_set *) | | #define SELECT_TYPE_ARG234 (fd_set *) | |
| | | | |
| | | | |
| skipping to change at line 751 | | skipping to change at line 754 | |
| /* Define to 1 if you have the ANSI C header files. */ | | /* Define to 1 if you have the ANSI C header files. */ | |
| #define STDC_HEADERS 1 | | #define STDC_HEADERS 1 | |
| | | | |
| /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ | | /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ | |
| #define TIME_WITH_SYS_TIME 1 | | #define TIME_WITH_SYS_TIME 1 | |
| | | | |
| /* Define to 1 if your <sys/time.h> declares `struct tm'. */ | | /* Define to 1 if your <sys/time.h> declares `struct tm'. */ | |
| /* #undef TM_IN_SYS_TIME */ | | /* #undef TM_IN_SYS_TIME */ | |
| | | | |
| /* Version number of package */ | | /* Version number of package */ | |
|
| #define VERSION "0.9.2" | | #define VERSION "0.9.3" | |
| | | | |
| /* This is a Windows system */ | | /* This is a Windows system */ | |
| /* #undef WINDOWS */ | | /* #undef WINDOWS */ | |
| | | | |
| /* Define to 1 if the X Window System is missing or not being used. */ | | /* Define to 1 if the X Window System is missing or not being used. */ | |
| /* #undef X_DISPLAY_MISSING */ | | /* #undef X_DISPLAY_MISSING */ | |
| | | | |
| /* Number of bits in a file offset, on hosts where this is settable. */ | | /* Number of bits in a file offset, on hosts where this is settable. */ | |
| #define _FILE_OFFSET_BITS 64 | | #define _FILE_OFFSET_BITS 64 | |
| | | | |
| | | | |
End of changes. 12 change blocks. |
| 11 lines changed or deleted | | 14 lines changed or added | |
|
| gnunet_connection_lib.h | | gnunet_connection_lib.h | |
| | | | |
| skipping to change at line 109 | | skipping to change at line 109 | |
| typedef void (*GNUNET_CONNECTION_Receiver) (void *cls, const void *buf, | | typedef void (*GNUNET_CONNECTION_Receiver) (void *cls, const void *buf, | |
| size_t available, | | size_t available, | |
| const struct sockaddr * addr, | | const struct sockaddr * addr, | |
| socklen_t addrlen, int errCode)
; | | socklen_t addrlen, int errCode)
; | |
| | | | |
| /** | | /** | |
| * Set the persist option on this connection handle. Indicates | | * Set the persist option on this connection handle. Indicates | |
| * that the underlying socket or fd should never really be closed. | | * that the underlying socket or fd should never really be closed. | |
| * Used for indicating process death. | | * Used for indicating process death. | |
| * | | * | |
|
| * @param sock the connection to set persistent | | * @param connection the connection to set persistent | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_CONNECTION_persist_ (struct GNUNET_CONNECTION_Handle *sock); | | GNUNET_CONNECTION_persist_ (struct GNUNET_CONNECTION_Handle *connection); | |
| | | | |
| /** | | /** | |
| * Disable the "CORK" feature for communication with the given socket, | | * Disable the "CORK" feature for communication with the given socket, | |
| * forcing the OS to immediately flush the buffer on transmission | | * forcing the OS to immediately flush the buffer on transmission | |
| * instead of potentially buffering multiple messages. Essentially | | * instead of potentially buffering multiple messages. Essentially | |
| * reduces the OS send buffers to zero. | | * reduces the OS send buffers to zero. | |
| * Used to make sure that the last messages sent through the connection | | * Used to make sure that the last messages sent through the connection | |
| * reach the other side before the process is terminated. | | * reach the other side before the process is terminated. | |
| * | | * | |
|
| * @param sock the connection to make flushing and blocking | | * @param connection the connection to make flushing and blocking | |
| * @return GNUNET_OK on success | | * @return GNUNET_OK on success | |
| */ | | */ | |
| int | | int | |
|
| GNUNET_CONNECTION_disable_corking (struct GNUNET_CONNECTION_Handle *sock); | | GNUNET_CONNECTION_disable_corking (struct GNUNET_CONNECTION_Handle *connect
ion); | |
| | | | |
| /** | | /** | |
|
| * Create a socket handle by boxing an existing OS socket. The OS | | * Create a connection handle by boxing an existing OS socket. The OS | |
| * socket should henceforth be no longer used directly. | | * socket should henceforth be no longer used directly. | |
|
| * GNUNET_socket_destroy will close it. | | * GNUNET_CONNECTION_destroy will close it. | |
| * | | * | |
| * @param osSocket existing socket to box | | * @param osSocket existing socket to box | |
| * @return the boxed socket handle | | * @return the boxed socket handle | |
| */ | | */ | |
| struct GNUNET_CONNECTION_Handle * | | struct GNUNET_CONNECTION_Handle * | |
| GNUNET_CONNECTION_create_from_existing (struct GNUNET_NETWORK_Handle *osSoc
ket); | | GNUNET_CONNECTION_create_from_existing (struct GNUNET_NETWORK_Handle *osSoc
ket); | |
| | | | |
| /** | | /** | |
|
| * Create a socket handle by accepting on a listen socket. This | | * Create a connection handle by accepting on a listen socket. This | |
| * function may block if the listen socket has no connection ready. | | * function may block if the listen socket has no connection ready. | |
| * | | * | |
| * @param access function to use to check if access is allowed | | * @param access function to use to check if access is allowed | |
| * @param access_cls closure for access | | * @param access_cls closure for access | |
| * @param lsock listen socket | | * @param lsock listen socket | |
|
| * @return the socket handle, NULL on error (for example, access refused) | | * @return the connection handle, NULL on error (for example, access refuse
d) | |
| */ | | */ | |
| struct GNUNET_CONNECTION_Handle * | | struct GNUNET_CONNECTION_Handle * | |
| GNUNET_CONNECTION_create_from_accept (GNUNET_CONNECTION_AccessCheck access, | | GNUNET_CONNECTION_create_from_accept (GNUNET_CONNECTION_AccessCheck access, | |
| void *access_cls, | | void *access_cls, | |
| struct GNUNET_NETWORK_Handle *lsock); | | struct GNUNET_NETWORK_Handle *lsock); | |
| | | | |
| /** | | /** | |
|
| * Create a socket handle by (asynchronously) connecting to a host. | | * Create a connection handle by (asynchronously) connecting to a host. | |
| * This function returns immediately, even if the connection has not | | * This function returns immediately, even if the connection has not | |
| * yet been established. This function only creates TCP connections. | | * yet been established. This function only creates TCP connections. | |
| * | | * | |
| * @param cfg configuration to use | | * @param cfg configuration to use | |
| * @param hostname name of the host to connect to | | * @param hostname name of the host to connect to | |
| * @param port port to connect to | | * @param port port to connect to | |
|
| * @return the socket handle | | * @return the connection handle | |
| */ | | */ | |
| struct GNUNET_CONNECTION_Handle * | | struct GNUNET_CONNECTION_Handle * | |
| GNUNET_CONNECTION_create_from_connect (const struct GNUNET_CONFIGURATION_Ha
ndle | | GNUNET_CONNECTION_create_from_connect (const struct GNUNET_CONFIGURATION_Ha
ndle | |
| *cfg, const char *hostname, | | *cfg, const char *hostname, | |
| uint16_t port); | | uint16_t port); | |
| | | | |
| /** | | /** | |
|
| * Create a socket handle by connecting to a UNIX domain service. | | * Create a connection handle by connecting to a UNIX domain service. | |
| * This function returns immediately, even if the connection has not | | * This function returns immediately, even if the connection has not | |
| * yet been established. This function only creates UNIX connections. | | * yet been established. This function only creates UNIX connections. | |
| * | | * | |
| * @param cfg configuration to use | | * @param cfg configuration to use | |
| * @param unixpath path to connect to) | | * @param unixpath path to connect to) | |
|
| * @return the socket handle, NULL on systems without UNIX support | | * @return the connection handle, NULL on systems without UNIX support | |
| */ | | */ | |
| struct GNUNET_CONNECTION_Handle * | | struct GNUNET_CONNECTION_Handle * | |
| GNUNET_CONNECTION_create_from_connect_to_unixpath (const struct | | GNUNET_CONNECTION_create_from_connect_to_unixpath (const struct | |
| GNUNET_CONFIGURATION_Han
dle | | GNUNET_CONFIGURATION_Han
dle | |
| *cfg, const char *unixpa
th); | | *cfg, const char *unixpa
th); | |
| | | | |
| /** | | /** | |
|
| * Create a socket handle by (asynchronously) connecting to a host. | | * Create a connection handle by (asynchronously) connecting to a host. | |
| * This function returns immediately, even if the connection has not | | * This function returns immediately, even if the connection has not | |
| * yet been established. This function only creates TCP connections. | | * yet been established. This function only creates TCP connections. | |
| * | | * | |
| * @param af_family address family to use | | * @param af_family address family to use | |
| * @param serv_addr server address | | * @param serv_addr server address | |
| * @param addrlen length of server address | | * @param addrlen length of server address | |
|
| * @return the socket handle | | * @return the connection handle | |
| */ | | */ | |
| struct GNUNET_CONNECTION_Handle * | | struct GNUNET_CONNECTION_Handle * | |
| GNUNET_CONNECTION_create_from_sockaddr (int af_family, | | GNUNET_CONNECTION_create_from_sockaddr (int af_family, | |
| const struct sockaddr *serv_addr, | | const struct sockaddr *serv_addr, | |
| socklen_t addrlen); | | socklen_t addrlen); | |
| | | | |
| /** | | /** | |
|
| * Check if socket is valid (no fatal errors have happened so far). | | * Check if connection is valid (no fatal errors have happened so far). | |
| * Note that a socket that is still trying to connect is considered | | * Note that a connection that is still trying to connect is considered | |
| * valid. | | * valid. | |
| * | | * | |
|
| * @param sock socket to check | | * @param connection handle to check | |
| * @return GNUNET_YES if valid, GNUNET_NO otherwise | | * @return GNUNET_YES if valid, GNUNET_NO otherwise | |
| */ | | */ | |
| int | | int | |
|
| GNUNET_CONNECTION_check (struct GNUNET_CONNECTION_Handle *sock); | | GNUNET_CONNECTION_check (struct GNUNET_CONNECTION_Handle *connection); | |
| | | | |
| /** | | /** | |
| * Obtain the network address of the other party. | | * Obtain the network address of the other party. | |
| * | | * | |
|
| * @param sock the client to get the address for | | * @param connection the client to get the address for | |
| * @param addr where to store the address | | * @param addr where to store the address | |
| * @param addrlen where to store the length of the address | | * @param addrlen where to store the length of the address | |
| * @return GNUNET_OK on success | | * @return GNUNET_OK on success | |
| */ | | */ | |
| int | | int | |
|
| GNUNET_CONNECTION_get_address (struct GNUNET_CONNECTION_Handle *sock, | | GNUNET_CONNECTION_get_address (struct GNUNET_CONNECTION_Handle *connection, | |
| void **addr, size_t * addrlen); | | void **addr, size_t * addrlen); | |
| | | | |
| /** | | /** | |
|
| * Close the socket and free associated resources. Pending | | * Close the connection and free associated resources. There must | |
| * transmissions may be completed or dropped depending on the | | * not be any pending requests for reading or writing to the | |
| * arguments. If a receive call is pending and should | | * connection at this time. | |
| * NOT be completed, 'GNUNET_CONNECTION_receive_cancel' | | * | |
| * should be called explicitly first. | | * @param connection connection to destroy | |
| * | | | |
| * @param sock socket to destroy | | | |
| * @param finish_pending_write should pending writes be completed or aborte | | | |
| d? | | | |
| * (this applies to transmissions where the data has already been | | | |
| * read from the application; all other transmissions should be | | | |
| * aborted using 'GNUNET_CONNECTION_notify_transmit_ready_cancel'). | | | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_CONNECTION_destroy (struct GNUNET_CONNECTION_Handle *sock, | | GNUNET_CONNECTION_destroy (struct GNUNET_CONNECTION_Handle *connection); | |
| int finish_pending_write); | | | |
| | | | |
| /** | | /** | |
|
| * Receive data from the given socket. Note that this function will | | * Receive data from the given connection. Note that this function will | |
| * call "receiver" asynchronously using the scheduler. It will | | * call "receiver" asynchronously using the scheduler. It will | |
| * "immediately" return. Note that there MUST only be one active | | * "immediately" return. Note that there MUST only be one active | |
|
| * receive call per socket at any given point in time (so do not | | * receive call per connection at any given point in time (so do not | |
| * call receive again until the receiver callback has been invoked). | | * call receive again until the receiver callback has been invoked). | |
| * | | * | |
|
| * @param sock socket handle | | * @param connection connection handle | |
| * @param max maximum number of bytes to read | | * @param max maximum number of bytes to read | |
| * @param timeout maximum amount of time to wait | | * @param timeout maximum amount of time to wait | |
| * @param receiver function to call with received data | | * @param receiver function to call with received data | |
| * @param receiver_cls closure for receiver | | * @param receiver_cls closure for receiver | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_CONNECTION_receive (struct GNUNET_CONNECTION_Handle *sock, size_t ma
x, | | GNUNET_CONNECTION_receive (struct GNUNET_CONNECTION_Handle *connection, siz
e_t max, | |
| struct GNUNET_TIME_Relative timeout, | | struct GNUNET_TIME_Relative timeout, | |
| GNUNET_CONNECTION_Receiver receiver, | | GNUNET_CONNECTION_Receiver receiver, | |
| void *receiver_cls); | | void *receiver_cls); | |
| | | | |
| /** | | /** | |
|
| * Cancel receive job on the given socket. Note that the | | * Cancel receive job on the given connection. Note that the | |
| * receiver callback must not have been called yet in order | | * receiver callback must not have been called yet in order | |
| * for the cancellation to be valid. | | * for the cancellation to be valid. | |
| * | | * | |
|
| * @param sock socket handle | | * @param connection connection handle | |
| * @return closure of the original receiver callback closure | | * @return closure of the original receiver callback closure | |
| */ | | */ | |
| void * | | void * | |
|
| GNUNET_CONNECTION_receive_cancel (struct GNUNET_CONNECTION_Handle *sock); | | GNUNET_CONNECTION_receive_cancel (struct GNUNET_CONNECTION_Handle *connecti
on); | |
| | | | |
| /** | | /** | |
|
| * Function called to notify a client about the socket | | * Function called to notify a client about the connection | |
| * begin ready to queue more data. "buf" will be | | * begin ready to queue more data. "buf" will be | |
|
| * NULL and "size" zero if the socket was closed for | | * NULL and "size" zero if the connection was closed for | |
| * writing in the meantime. | | * writing in the meantime. | |
| * | | * | |
| * @param cls closure | | * @param cls closure | |
| * @param size number of bytes available in buf | | * @param size number of bytes available in buf | |
| * @param buf where the callee should write the message | | * @param buf where the callee should write the message | |
| * @return number of bytes written to buf | | * @return number of bytes written to buf | |
| */ | | */ | |
| typedef size_t (*GNUNET_CONNECTION_TransmitReadyNotify) (void *cls, size_t
size, | | typedef size_t (*GNUNET_CONNECTION_TransmitReadyNotify) (void *cls, size_t
size, | |
| void *buf); | | void *buf); | |
| | | | |
| /** | | /** | |
| * Opaque handle that can be used to cancel | | * Opaque handle that can be used to cancel | |
| * a transmit-ready notification. | | * a transmit-ready notification. | |
| */ | | */ | |
| struct GNUNET_CONNECTION_TransmitHandle; | | struct GNUNET_CONNECTION_TransmitHandle; | |
| | | | |
| /** | | /** | |
|
| * Ask the socket to call us once the specified number of bytes | | * Ask the connection to call us once the specified number of bytes | |
| * are free in the transmission buffer. May call the notify | | * are free in the transmission buffer. May call the notify | |
| * method immediately if enough space is available. Note that | | * method immediately if enough space is available. Note that | |
| * this function will abort if "size" is greater than | | * this function will abort if "size" is greater than | |
| * GNUNET_SERVER_MAX_MESSAGE_SIZE. | | * GNUNET_SERVER_MAX_MESSAGE_SIZE. | |
| * | | * | |
| * Note that "notify" will be called either when enough | | * Note that "notify" will be called either when enough | |
|
| * buffer space is available OR when the socket is destroyed. | | * buffer space is available OR when the connection is destroyed. | |
| * The size parameter given to notify is guaranteed to be | | * The size parameter given to notify is guaranteed to be | |
| * larger or equal to size if the buffer is ready, or zero | | * larger or equal to size if the buffer is ready, or zero | |
|
| * if the socket was destroyed (or at least closed for | | * if the connection was destroyed (or at least closed for | |
| * writing). Finally, any time before 'notify' is called, a | | * writing). Finally, any time before 'notify' is called, a | |
| * client may call "notify_transmit_ready_cancel" to cancel | | * client may call "notify_transmit_ready_cancel" to cancel | |
| * the transmission request. | | * the transmission request. | |
| * | | * | |
| * Only one transmission request can be scheduled at the same | | * Only one transmission request can be scheduled at the same | |
| * time. Notify will be run with the same scheduler priority | | * time. Notify will be run with the same scheduler priority | |
| * as that of the caller. | | * as that of the caller. | |
| * | | * | |
|
| * @param sock socket | | * @param connection connection | |
| * @param size number of bytes to send | | * @param size number of bytes to send | |
| * @param timeout after how long should we give up (and call | | * @param timeout after how long should we give up (and call | |
| * notify with buf NULL and size 0)? | | * notify with buf NULL and size 0)? | |
| * @param notify function to call when buffer space is available | | * @param notify function to call when buffer space is available | |
| * @param notify_cls closure for notify | | * @param notify_cls closure for notify | |
| * @return non-NULL if the notify callback was queued, | | * @return non-NULL if the notify callback was queued, | |
| * NULL if we are already going to notify someone else (busy) | | * NULL if we are already going to notify someone else (busy) | |
| */ | | */ | |
| struct GNUNET_CONNECTION_TransmitHandle * | | struct GNUNET_CONNECTION_TransmitHandle * | |
|
| GNUNET_CONNECTION_notify_transmit_ready (struct GNUNET_CONNECTION_Handle *s
ock, | | GNUNET_CONNECTION_notify_transmit_ready (struct GNUNET_CONNECTION_Handle *c
onnection, | |
| size_t size, | | size_t size, | |
| struct GNUNET_TIME_Relative timeou
t, | | struct GNUNET_TIME_Relative timeou
t, | |
| GNUNET_CONNECTION_TransmitReadyNot
ify | | GNUNET_CONNECTION_TransmitReadyNot
ify | |
| notify, void *notify_cls); | | notify, void *notify_cls); | |
| | | | |
| /** | | /** | |
| * Cancel the specified transmission-ready | | * Cancel the specified transmission-ready | |
| * notification. | | * notification. | |
| * | | * | |
| * @param th handle for notification to cancel | | * @param th handle for notification to cancel | |
| */ | | */ | |
| void | | void | |
| GNUNET_CONNECTION_notify_transmit_ready_cancel (struct | | GNUNET_CONNECTION_notify_transmit_ready_cancel (struct | |
| GNUNET_CONNECTION_TransmitH
andle | | GNUNET_CONNECTION_TransmitH
andle | |
| *th); | | *th); | |
| | | | |
|
| /** | | | |
| * Configure this connection to ignore shutdown signals. | | | |
| * | | | |
| * @param sock socket handle | | | |
| * @param do_ignore GNUNET_YES to ignore, GNUNET_NO to restore default | | | |
| */ | | | |
| void | | | |
| GNUNET_CONNECTION_ignore_shutdown (struct GNUNET_CONNECTION_Handle *sock, | | | |
| int do_ignore); | | | |
| | | | |
| #if 0 /* keep Emacsens' auto-indent happy */ | | #if 0 /* keep Emacsens' auto-indent happy */ | |
| { | | { | |
| #endif | | #endif | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| /* ifndef GNUNET_CONNECTION_LIB_H */ | | /* ifndef GNUNET_CONNECTION_LIB_H */ | |
| #endif | | #endif | |
| /* end of gnunet_connection_lib.h */ | | /* end of gnunet_connection_lib.h */ | |
| | | | |
End of changes. 36 change blocks. |
| 58 lines changed or deleted | | 40 lines changed or added | |
|
| gnunet_core_service.h | | gnunet_core_service.h | |
| | | | |
| skipping to change at line 153 | | skipping to change at line 153 | |
| * specified event happens. The maximum number of queued | | * specified event happens. The maximum number of queued | |
| * notifications (queue length) is per client but the queue is shared | | * notifications (queue length) is per client but the queue is shared | |
| * across all types of notifications. So a slow client that registers | | * across all types of notifications. So a slow client that registers | |
| * for 'outbound_notify' also risks missing 'inbound_notify' messages. | | * for 'outbound_notify' also risks missing 'inbound_notify' messages. | |
| * Certain events (such as connect/disconnect notifications) are not | | * Certain events (such as connect/disconnect notifications) are not | |
| * subject to queue size limitations. | | * subject to queue size limitations. | |
| * | | * | |
| * @param cfg configuration to use | | * @param cfg configuration to use | |
| * @param queue_size size of the per-peer message queue | | * @param queue_size size of the per-peer message queue | |
| * @param cls closure for the various callbacks that follow (including hand
lers in the handlers array) | | * @param cls closure for the various callbacks that follow (including hand
lers in the handlers array) | |
|
| * @param init callback to call on timeout or once we have successfully | | * @param init callback to call once we have successfully | |
| * connected to the core service; note that timeout is only meaningf | | * connected to the core service | |
| ul if init is not NULL | | | |
| * @param connects function to call on peer connect, can be NULL | | * @param connects function to call on peer connect, can be NULL | |
| * @param disconnects function to call on peer disconnect / timeout, can be
NULL | | * @param disconnects function to call on peer disconnect / timeout, can be
NULL | |
| * @param inbound_notify function to call for all inbound messages, can be
NULL | | * @param inbound_notify function to call for all inbound messages, can be
NULL | |
| * note that the core is allowed to drop notifications about
inbound | | * note that the core is allowed to drop notifications about
inbound | |
| * messages if the client does not process them fast enough
(for this | | * messages if the client does not process them fast enough
(for this | |
| * notification type, a bounded queue is used) | | * notification type, a bounded queue is used) | |
| * @param inbound_hdr_only set to GNUNET_YES if inbound_notify will only re
ad the | | * @param inbound_hdr_only set to GNUNET_YES if inbound_notify will only re
ad the | |
| * GNUNET_MessageHeader and hence we do not need to give it
the full message; | | * GNUNET_MessageHeader and hence we do not need to give it
the full message; | |
| * can be used to improve efficiency, ignored if inbound_not
ify is NULL | | * can be used to improve efficiency, ignored if inbound_not
ify is NULL | |
| * note that the core is allowed to drop notifications about
inbound | | * note that the core is allowed to drop notifications about
inbound | |
| | | | |
| skipping to change at line 222 | | skipping to change at line 222 | |
| * Ask the core to call "notify" once it is ready to transmit the | | * Ask the core to call "notify" once it is ready to transmit the | |
| * given number of bytes to the specified "target". Must only be | | * given number of bytes to the specified "target". Must only be | |
| * called after a connection to the respective peer has been | | * called after a connection to the respective peer has been | |
| * established (and the client has been informed about this). | | * established (and the client has been informed about this). | |
| * | | * | |
| * | | * | |
| * @param handle connection to core service | | * @param handle connection to core service | |
| * @param cork is corking allowed for this transmission? | | * @param cork is corking allowed for this transmission? | |
| * @param priority how important is the message? | | * @param priority how important is the message? | |
| * @param maxdelay how long can the message wait? | | * @param maxdelay how long can the message wait? | |
|
| * @param target who should receive the message, | | * @param target who should receive the message, never NULL (can be this pe | |
| * use NULL for this peer (loopback) | | er's identity for loopback) | |
| * @param notify_size how many bytes of buffer space does notify want? | | * @param notify_size how many bytes of buffer space does notify want? | |
| * @param notify function to call when buffer space is available; | | * @param notify function to call when buffer space is available; | |
| * will be called with NULL on timeout or if the overall queue | | * will be called with NULL on timeout or if the overall queue | |
| * for this peer is larger than queue_size and this is currently | | * for this peer is larger than queue_size and this is currently | |
| * the message with the lowest priority; will also be called | | * the message with the lowest priority; will also be called | |
| * with 'NULL' buf if the peer disconnects; since the disconnect | | * with 'NULL' buf if the peer disconnects; since the disconnect | |
| * signal will be emmitted even later, clients MUST cancel | | * signal will be emmitted even later, clients MUST cancel | |
| * all pending transmission requests DURING the disconnect | | * all pending transmission requests DURING the disconnect | |
| * handler (unless they ensure that 'notify' never calls | | * handler (unless they ensure that 'notify' never calls | |
| * 'GNUNET_CORE_notify_transmit_ready'). | | * 'GNUNET_CORE_notify_transmit_ready'). | |
| | | | |
| skipping to change at line 280 | | skipping to change at line 279 | |
| * @param peer_cb function to call with the peer information | | * @param peer_cb function to call with the peer information | |
| * @param cb_cls closure for peer_cb | | * @param cb_cls closure for peer_cb | |
| * @return GNUNET_OK on success, GNUNET_SYSERR on errors | | * @return GNUNET_OK on success, GNUNET_SYSERR on errors | |
| */ | | */ | |
| int | | int | |
| GNUNET_CORE_iterate_peers (const struct GNUNET_CONFIGURATION_Handle *cfg, | | GNUNET_CORE_iterate_peers (const struct GNUNET_CONFIGURATION_Handle *cfg, | |
| GNUNET_CORE_ConnectEventHandler peer_cb, | | GNUNET_CORE_ConnectEventHandler peer_cb, | |
| void *cb_cls); | | void *cb_cls); | |
| | | | |
| /** | | /** | |
|
| | | * Handle to cancel 'is_peer_connected' test. | |
| | | */ | |
| | | struct GNUNET_CORE_ConnectTestHandle; | |
| | | | |
| | | /** | |
| * Check if the given peer is currently connected and return information | | * Check if the given peer is currently connected and return information | |
| * about the session if so. This function is for special cirumstances | | * about the session if so. This function is for special cirumstances | |
| * (GNUNET_TESTING uses it), normal users of the CORE API are | | * (GNUNET_TESTING uses it), normal users of the CORE API are | |
| * expected to track which peers are connected based on the | | * expected to track which peers are connected based on the | |
| * connect/disconnect callbacks from GNUNET_CORE_connect. This | | * connect/disconnect callbacks from GNUNET_CORE_connect. This | |
| * function is NOT part of the 'versioned', 'official' API. | | * function is NOT part of the 'versioned', 'official' API. | |
| * | | * | |
|
| * FIXME: we should probably make it possible to 'cancel' the | | | |
| * operation... | | | |
| * | | | |
| * @param cfg configuration to use | | * @param cfg configuration to use | |
| * @param peer the specific peer to check for | | * @param peer the specific peer to check for | |
| * @param peer_cb function to call with the peer information | | * @param peer_cb function to call with the peer information | |
| * @param cb_cls closure for peer_cb | | * @param cb_cls closure for peer_cb | |
|
| * @return GNUNET_OK if iterating, GNUNET_SYSERR on error | | * @return handle to cancel the operation | |
| */ | | */ | |
|
| int | | struct GNUNET_CORE_ConnectTestHandle * | |
| GNUNET_CORE_is_peer_connected (const struct GNUNET_CONFIGURATION_Handle *cf
g, | | GNUNET_CORE_is_peer_connected (const struct GNUNET_CONFIGURATION_Handle *cf
g, | |
|
| struct GNUNET_PeerIdentity *peer, | | const struct GNUNET_PeerIdentity *peer, | |
| GNUNET_CORE_ConnectEventHandler peer_cb, | | GNUNET_CORE_ConnectEventHandler peer_cb, | |
| void *cb_cls); | | void *cb_cls); | |
| | | | |
|
| | | /** | |
| | | * Abort 'is_connected' test operation. | |
| | | * | |
| | | * @param cth handle for operation to cancel | |
| | | */ | |
| | | void | |
| | | GNUNET_CORE_is_peer_connected_cancel (struct GNUNET_CORE_ConnectTestHandle | |
| | | *cth); | |
| | | | |
| #if 0 /* keep Emacsens' auto-indent happy */ | | #if 0 /* keep Emacsens' auto-indent happy */ | |
| { | | { | |
| #endif | | #endif | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| /* ifndef GNUNET_CORE_SERVICE_H */ | | /* ifndef GNUNET_CORE_SERVICE_H */ | |
| #endif | | #endif | |
| /* end of gnunet_core_service.h */ | | /* end of gnunet_core_service.h */ | |
| | | | |
End of changes. 8 change blocks. |
| 11 lines changed or deleted | | 21 lines changed or added | |
|
| gnunet_crypto_lib.h | | gnunet_crypto_lib.h | |
| /* | | /* | |
| This file is part of GNUnet. | | This file is part of GNUnet. | |
|
| (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Christian Grothoff (and o
ther contributing authors) | | (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012 Christian Grothoff
(and other contributing authors) | |
| | | | |
| GNUnet is free software; you can redistribute it and/or modify | | GNUnet is free software; you can redistribute it and/or modify | |
| it under the terms of the GNU General Public License as published | | it under the terms of the GNU General Public License as published | |
| by the Free Software Foundation; either version 2, or (at your | | by the Free Software Foundation; either version 2, or (at your | |
| option) any later version. | | option) any later version. | |
| | | | |
| GNUnet is distributed in the hope that it will be useful, but | | GNUnet is distributed in the hope that it will be useful, but | |
| WITHOUT ANY WARRANTY; without even the implied warranty of | | WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| General Public License for more details. | | General Public License for more details. | |
| | | | |
| skipping to change at line 86 | | skipping to change at line 86 | |
| * We currently do not handle encryption of data | | * We currently do not handle encryption of data | |
| * that can not be done in a single call to the | | * that can not be done in a single call to the | |
| * RSA methods (read: large chunks of data). | | * RSA methods (read: large chunks of data). | |
| * We should never need that, as we can use | | * We should never need that, as we can use | |
| * the GNUNET_CRYPTO_hash for larger pieces of data for signing, | | * the GNUNET_CRYPTO_hash for larger pieces of data for signing, | |
| * and for encryption, we only need to encode sessionkeys! | | * and for encryption, we only need to encode sessionkeys! | |
| */ | | */ | |
| #define GNUNET_CRYPTO_RSA_DATA_ENCODING_LENGTH 256 | | #define GNUNET_CRYPTO_RSA_DATA_ENCODING_LENGTH 256 | |
| | | | |
| /** | | /** | |
|
| * Length of an RSA KEY (d,e,len), 2048 bit (=256 octests) key d, 2 byte e | | * Length of an RSA KEY (n,e,len), 2048 bit (=256 octests) key n, 2 byte e | |
| */ | | */ | |
| #define GNUNET_CRYPTO_RSA_KEY_LENGTH 258 | | #define GNUNET_CRYPTO_RSA_KEY_LENGTH 258 | |
| | | | |
| /** | | /** | |
| * Length of a hash value | | * Length of a hash value | |
| */ | | */ | |
| #define GNUNET_CRYPTO_HASH_LENGTH 512/8 | | #define GNUNET_CRYPTO_HASH_LENGTH 512/8 | |
| | | | |
| /** | | /** | |
| * The private information of an RSA key pair. | | * The private information of an RSA key pair. | |
| */ | | */ | |
| struct GNUNET_CRYPTO_RsaPrivateKey; | | struct GNUNET_CRYPTO_RsaPrivateKey; | |
| | | | |
|
| | | GNUNET_NETWORK_STRUCT_BEGIN | |
| | | | |
| | | /** | |
| | | * GNUnet mandates a certain format for the encoding | |
| | | * of private RSA key information that is provided | |
| | | * by the RSA implementations. This format is used | |
| | | * to serialize a private RSA key (typically when | |
| | | * writing it to disk). | |
| | | */ | |
| | | struct GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded | |
| | | { | |
| | | /** | |
| | | * Total size of the structure, in bytes, in big-endian! | |
| | | */ | |
| | | uint16_t len GNUNET_PACKED; | |
| | | uint16_t sizen GNUNET_PACKED; /* in big-endian! */ | |
| | | uint16_t sizee GNUNET_PACKED; /* in big-endian! */ | |
| | | uint16_t sized GNUNET_PACKED; /* in big-endian! */ | |
| | | uint16_t sizep GNUNET_PACKED; /* in big-endian! */ | |
| | | uint16_t sizeq GNUNET_PACKED; /* in big-endian! */ | |
| | | uint16_t sizedmp1 GNUNET_PACKED; /* in big-endian! */ | |
| | | uint16_t sizedmq1 GNUNET_PACKED; /* in big-endian! */ | |
| | | /* followed by the actual values */ | |
| | | }; | |
| | | GNUNET_NETWORK_STRUCT_END | |
| | | | |
| /** | | /** | |
| * @brief 0-terminated ASCII encoding of a GNUNET_HashCode. | | * @brief 0-terminated ASCII encoding of a GNUNET_HashCode. | |
| */ | | */ | |
| struct GNUNET_CRYPTO_HashAsciiEncoded | | struct GNUNET_CRYPTO_HashAsciiEncoded | |
| { | | { | |
| unsigned char encoding[104]; | | unsigned char encoding[104]; | |
| }; | | }; | |
| | | | |
| /** | | /** | |
|
| | | * @brief 256-bit hashcode | |
| | | */ | |
| | | struct GNUNET_CRYPTO_ShortHashCode | |
| | | { | |
| | | uint32_t bits[256 / 8 / sizeof (uint32_t)]; /* = 8 */ | |
| | | }; | |
| | | | |
| | | /** | |
| | | * @brief 0-terminated ASCII encoding of a 'struct GNUNET_ShortHashCode'. | |
| | | */ | |
| | | struct GNUNET_CRYPTO_ShortHashAsciiEncoded | |
| | | { | |
| | | unsigned char short_encoding[53]; | |
| | | }; | |
| | | | |
| | | /** | |
| * @brief an RSA signature | | * @brief an RSA signature | |
| */ | | */ | |
| struct GNUNET_CRYPTO_RsaSignature | | struct GNUNET_CRYPTO_RsaSignature | |
| { | | { | |
| unsigned char sig[GNUNET_CRYPTO_RSA_DATA_ENCODING_LENGTH]; | | unsigned char sig[GNUNET_CRYPTO_RSA_DATA_ENCODING_LENGTH]; | |
| }; | | }; | |
| | | | |
| GNUNET_NETWORK_STRUCT_BEGIN | | GNUNET_NETWORK_STRUCT_BEGIN | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 382 | | skipping to change at line 424 | |
| * Convert hash to ASCII encoding. | | * Convert hash to ASCII encoding. | |
| * @param block the hash code | | * @param block the hash code | |
| * @param result where to store the encoding (struct GNUNET_CRYPTO_HashAsci
iEncoded can be | | * @param result where to store the encoding (struct GNUNET_CRYPTO_HashAsci
iEncoded can be | |
| * safely cast to char*, a '\\0' termination is set). | | * safely cast to char*, a '\\0' termination is set). | |
| */ | | */ | |
| void | | void | |
| GNUNET_CRYPTO_hash_to_enc (const GNUNET_HashCode * block, | | GNUNET_CRYPTO_hash_to_enc (const GNUNET_HashCode * block, | |
| struct GNUNET_CRYPTO_HashAsciiEncoded *result); | | struct GNUNET_CRYPTO_HashAsciiEncoded *result); | |
| | | | |
| /** | | /** | |
|
| * Convert ASCII encoding back to GNUNET_CRYPTO_hash | | * Convert short hash to ASCII encoding. | |
| | | * | |
| | | * @param block the hash code | |
| | | * @param result where to store the encoding (struct GNUNET_CRYPTO_ShortHas | |
| | | hAsciiEncoded can be | |
| | | * safely cast to char*, a '\\0' termination is set). | |
| | | */ | |
| | | void | |
| | | GNUNET_CRYPTO_short_hash_to_enc (const struct GNUNET_CRYPTO_ShortHashCode * | |
| | | block, | |
| | | struct GNUNET_CRYPTO_ShortHashAsciiEncoded | |
| | | *result); | |
| | | | |
| | | /** | |
| | | * Convert ASCII encoding back to a 'GNUNET_HashCode' | |
| * | | * | |
| * @param enc the encoding | | * @param enc the encoding | |
| * @param enclen number of characters in 'enc' (without 0-terminator, which
can be missing) | | * @param enclen number of characters in 'enc' (without 0-terminator, which
can be missing) | |
| * @param result where to store the GNUNET_CRYPTO_hash code | | * @param result where to store the GNUNET_CRYPTO_hash code | |
| * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong enco
ding | | * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong enco
ding | |
| */ | | */ | |
| int | | int | |
| GNUNET_CRYPTO_hash_from_string2 (const char *enc, size_t enclen, | | GNUNET_CRYPTO_hash_from_string2 (const char *enc, size_t enclen, | |
| GNUNET_HashCode * result); | | GNUNET_HashCode * result); | |
| | | | |
| /** | | /** | |
|
| * Convert ASCII encoding back to GNUNET_CRYPTO_hash | | * Convert ASCII encoding back to a 'struct GNUNET_CRYPTO_ShortHash' | |
| | | * | |
| * @param enc the encoding | | * @param enc the encoding | |
|
| | | * @param enclen number of characters in 'enc' (without 0-terminator, which
can be missing) | |
| * @param result where to store the GNUNET_CRYPTO_hash code | | * @param result where to store the GNUNET_CRYPTO_hash code | |
| * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong enco
ding | | * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong enco
ding | |
| */ | | */ | |
|
| | | int | |
| | | GNUNET_CRYPTO_short_hash_from_string2 (const char *enc, size_t enclen, | |
| | | struct GNUNET_CRYPTO_ShortHashCode * | |
| | | result); | |
| | | | |
| | | /** | |
| | | * Convert ASCII encoding back to GNUNET_HashCode | |
| | | * | |
| | | * @param enc the encoding | |
| | | * @param result where to store the hash code | |
| | | * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong enco | |
| | | ding | |
| | | */ | |
| #define GNUNET_CRYPTO_hash_from_string(enc, result) \ | | #define GNUNET_CRYPTO_hash_from_string(enc, result) \ | |
| GNUNET_CRYPTO_hash_from_string2 (enc, strlen(enc), result) | | GNUNET_CRYPTO_hash_from_string2 (enc, strlen(enc), result) | |
| | | | |
| /** | | /** | |
|
| | | * Convert ASCII encoding back to a 'struct GNUNET_CRYPTO_ShortHash' | |
| | | * | |
| | | * @param enc the encoding | |
| | | * @param result where to store the GNUNET_CRYPTO_ShortHash | |
| | | * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong enco | |
| | | ding | |
| | | */ | |
| | | #define GNUNET_CRYPTO_short_hash_from_string(enc, result) \ | |
| | | GNUNET_CRYPTO_short_hash_from_string2 (enc, strlen(enc), result) | |
| | | | |
| | | /** | |
| | | * Compare function for ShortHashCodes, producing a total ordering | |
| | | * of all hashcodes. | |
| | | * | |
| | | * @param h1 some hash code | |
| | | * @param h2 some hash code | |
| | | * @return 1 if h1 > h2, -1 if h1 < h2 and 0 if h1 == h2. | |
| | | */ | |
| | | int | |
| | | GNUNET_CRYPTO_short_hash_cmp (const struct GNUNET_CRYPTO_ShortHashCode * h1 | |
| | | , | |
| | | const struct GNUNET_CRYPTO_ShortHashCode * h2 | |
| | | ); | |
| | | | |
| | | /** | |
| * Compute the distance between 2 hashcodes. | | * Compute the distance between 2 hashcodes. | |
| * The computation must be fast, not involve | | * The computation must be fast, not involve | |
| * a.a or a.e (they're used elsewhere), and | | * a.a or a.e (they're used elsewhere), and | |
| * be somewhat consistent. And of course, the | | * be somewhat consistent. And of course, the | |
| * result should be a positive number. | | * result should be a positive number. | |
| * | | * | |
| * @param a some hash code | | * @param a some hash code | |
| * @param b some hash code | | * @param b some hash code | |
| * @return number between 0 and UINT32_MAX | | * @return number between 0 and UINT32_MAX | |
| */ | | */ | |
| | | | |
| skipping to change at line 428 | | skipping to change at line 516 | |
| * Compute hash of a given block. | | * Compute hash of a given block. | |
| * | | * | |
| * @param block the data to hash | | * @param block the data to hash | |
| * @param size size of the block | | * @param size size of the block | |
| * @param ret pointer to where to write the hashcode | | * @param ret pointer to where to write the hashcode | |
| */ | | */ | |
| void | | void | |
| GNUNET_CRYPTO_hash (const void *block, size_t size, GNUNET_HashCode * ret); | | GNUNET_CRYPTO_hash (const void *block, size_t size, GNUNET_HashCode * ret); | |
| | | | |
| /** | | /** | |
|
| | | * Compute short (256-bit) hash of a given block. | |
| | | * | |
| | | * @param block the data to hash | |
| | | * @param size size of the block | |
| | | * @param ret pointer to where to write the hashcode | |
| | | */ | |
| | | void | |
| | | GNUNET_CRYPTO_short_hash (const void *block, size_t size, | |
| | | struct GNUNET_CRYPTO_ShortHashCode * ret); | |
| | | | |
| | | /** | |
| | | * Double short (256-bit) hash to create a long hash. | |
| | | * | |
| | | * @param sh short hash to double | |
| | | * @param dh where to store the (doubled) long hash (not really a hash) | |
| | | */ | |
| | | void | |
| | | GNUNET_CRYPTO_short_hash_double (const struct GNUNET_CRYPTO_ShortHashCode * | |
| | | sh, | |
| | | struct GNUNET_HashCode *dh); | |
| | | | |
| | | /** | |
| | | * Truncate doubled short hash back to a short hash. | |
| | | * | |
| | | * @param dh doubled short hash to reduce again | |
| | | * @param sh where to store the short hash | |
| | | * @return GNUNET_OK on success, GNUNET_SYSERR if this was not a | |
| | | * doubled short hash | |
| | | */ | |
| | | int | |
| | | GNUNET_CRYPTO_short_hash_from_truncation (const struct GNUNET_HashCode *dh, | |
| | | struct GNUNET_CRYPTO_ShortHashCode | |
| | | *sh); | |
| | | | |
| | | /** | |
| * Calculate HMAC of a message (RFC 2104) | | * Calculate HMAC of a message (RFC 2104) | |
| * | | * | |
| * @param key secret key | | * @param key secret key | |
| * @param plaintext input plaintext | | * @param plaintext input plaintext | |
| * @param plaintext_len length of plaintext | | * @param plaintext_len length of plaintext | |
| * @param hmac where to store the hmac | | * @param hmac where to store the hmac | |
| */ | | */ | |
| void | | void | |
| GNUNET_CRYPTO_hmac (const struct GNUNET_CRYPTO_AuthKey *key, | | GNUNET_CRYPTO_hmac (const struct GNUNET_CRYPTO_AuthKey *key, | |
| const void *plaintext, size_t plaintext_len, | | const void *plaintext, size_t plaintext_len, | |
| | | | |
| skipping to change at line 691 | | skipping to change at line 812 | |
| | | | |
| /** | | /** | |
| * Create a new private key. Caller must free return value. | | * Create a new private key. Caller must free return value. | |
| * | | * | |
| * @return fresh private key | | * @return fresh private key | |
| */ | | */ | |
| struct GNUNET_CRYPTO_RsaPrivateKey * | | struct GNUNET_CRYPTO_RsaPrivateKey * | |
| GNUNET_CRYPTO_rsa_key_create (void); | | GNUNET_CRYPTO_rsa_key_create (void); | |
| | | | |
| /** | | /** | |
|
| | | * Convert a public key to a string. | |
| | | * | |
| | | * @param pub key to convert | |
| | | * @return string representing 'pub' | |
| | | */ | |
| | | char * | |
| | | GNUNET_CRYPTO_rsa_public_key_to_string (struct GNUNET_CRYPTO_RsaPublicKeyBi | |
| | | naryEncoded *pub); | |
| | | | |
| | | /** | |
| | | * Convert a string representing a public key to a public key. | |
| | | * | |
| | | * @param enc encoded public key | |
| | | * @param enclen number of bytes in enc (without 0-terminator) | |
| | | * @param pub where to store the public key | |
| | | * @return GNUNET_OK on success | |
| | | */ | |
| | | int | |
| | | GNUNET_CRYPTO_rsa_public_key_from_string (const char *enc, | |
| | | size_t enclen, | |
| | | struct GNUNET_CRYPTO_RsaPublicKeyB | |
| | | inaryEncoded *pub); | |
| | | | |
| | | /** | |
| | | * Encode the private key in a format suitable for | |
| | | * storing it into a file. | |
| | | * @returns encoding of the private key. | |
| | | * The first 4 bytes give the size of the array, as usual. | |
| | | */ | |
| | | struct GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded * | |
| | | GNUNET_CRYPTO_rsa_encode_key (const struct GNUNET_CRYPTO_RsaPrivateKey *hos | |
| | | tkey); | |
| | | | |
| | | /** | |
| * Decode the private key from the data-format back | | * Decode the private key from the data-format back | |
| * to the "normal", internal format. | | * to the "normal", internal format. | |
| * | | * | |
| * @param buf the buffer where the private key data is stored | | * @param buf the buffer where the private key data is stored | |
| * @param len the length of the data in 'buffer' | | * @param len the length of the data in 'buffer' | |
| */ | | */ | |
| struct GNUNET_CRYPTO_RsaPrivateKey * | | struct GNUNET_CRYPTO_RsaPrivateKey * | |
| GNUNET_CRYPTO_rsa_decode_key (const char *buf, uint16_t len); | | GNUNET_CRYPTO_rsa_decode_key (const char *buf, uint16_t len); | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 718 | | skipping to change at line 870 | |
| * created. | | * created. | |
| * | | * | |
| * @param filename name of file to use for storage | | * @param filename name of file to use for storage | |
| * @return new private key, NULL on error (for example, | | * @return new private key, NULL on error (for example, | |
| * permission denied) | | * permission denied) | |
| */ | | */ | |
| struct GNUNET_CRYPTO_RsaPrivateKey * | | struct GNUNET_CRYPTO_RsaPrivateKey * | |
| GNUNET_CRYPTO_rsa_key_create_from_file (const char *filename); | | GNUNET_CRYPTO_rsa_key_create_from_file (const char *filename); | |
| | | | |
| /** | | /** | |
|
| | | * Setup a hostkey file for a peer given the name of the | |
| | | * configuration file (!). This function is used so that | |
| | | * at a later point code can be certain that reading a | |
| | | * hostkey is fast (for example in time-dependent testcases). | |
| | | * | |
| | | * @param cfg_name name of the configuration file to use | |
| | | */ | |
| | | void | |
| | | GNUNET_CRYPTO_setup_hostkey (const char *cfg_name); | |
| | | | |
| | | /** | |
| * Deterministically (!) create a private key using only the | | * Deterministically (!) create a private key using only the | |
| * given HashCode as input to the PRNG. | | * given HashCode as input to the PRNG. | |
| * | | * | |
| * @param hc "random" input to PRNG | | * @param hc "random" input to PRNG | |
| * @return some private key purely dependent on input | | * @return some private key purely dependent on input | |
| */ | | */ | |
| struct GNUNET_CRYPTO_RsaPrivateKey * | | struct GNUNET_CRYPTO_RsaPrivateKey * | |
| GNUNET_CRYPTO_rsa_key_create_from_hash (const GNUNET_HashCode * hc); | | GNUNET_CRYPTO_rsa_key_create_from_hash (const GNUNET_HashCode * hc); | |
| | | | |
| /** | | /** | |
| | | | |
End of changes. 12 change blocks. |
| 4 lines changed or deleted | | 180 lines changed or added | |
|
| gnunet_dht_service.h | | gnunet_dht_service.h | |
| | | | |
| skipping to change at line 118 | | skipping to change at line 118 | |
| * Shutdown connection with the DHT service. | | * Shutdown connection with the DHT service. | |
| * | | * | |
| * @param handle connection to shut down | | * @param handle connection to shut down | |
| */ | | */ | |
| void | | void | |
| GNUNET_DHT_disconnect (struct GNUNET_DHT_Handle *handle); | | GNUNET_DHT_disconnect (struct GNUNET_DHT_Handle *handle); | |
| | | | |
| /* *************** Standard API: get and put ******************* */ | | /* *************** Standard API: get and put ******************* */ | |
| | | | |
| /** | | /** | |
|
| | | * Opaque handle to cancel a PUT operation. | |
| | | */ | |
| | | struct GNUNET_DHT_PutHandle; | |
| | | | |
| | | /** | |
| | | * Type of a PUT continuation. You must not call | |
| | | * "GNUNET_DHT_disconnect" in this continuation. | |
| | | * | |
| | | * @param cls closure | |
| | | * @param success GNUNET_OK if the PUT was transmitted, | |
| | | * GNUNET_NO on timeout, | |
| | | * GNUNET_SYSERR on disconnect from service | |
| | | * after the PUT message was transmitted | |
| | | * (so we don't know if it was received or not) | |
| | | */ | |
| | | typedef void (*GNUNET_DHT_PutContinuation)(void *cls, | |
| | | int success); | |
| | | | |
| | | /** | |
| * Perform a PUT operation storing data in the DHT. | | * Perform a PUT operation storing data in the DHT. | |
| * | | * | |
| * @param handle handle to DHT service | | * @param handle handle to DHT service | |
| * @param key the key to store under | | * @param key the key to store under | |
| * @param desired_replication_level estimate of how many | | * @param desired_replication_level estimate of how many | |
| * nearest peers this request should reach | | * nearest peers this request should reach | |
| * @param options routing options for this message | | * @param options routing options for this message | |
| * @param type type of the value | | * @param type type of the value | |
| * @param size number of bytes in data; must be less than 64k | | * @param size number of bytes in data; must be less than 64k | |
| * @param data the data to store | | * @param data the data to store | |
| * @param exp desired expiration time for the value | | * @param exp desired expiration time for the value | |
| * @param timeout how long to wait for transmission of this request | | * @param timeout how long to wait for transmission of this request | |
| * @param cont continuation to call when done (transmitting request to serv
ice) | | * @param cont continuation to call when done (transmitting request to serv
ice) | |
|
| | | * You must not call "GNUNET_DHT_disconnect" in this continuation | |
| * @param cont_cls closure for cont | | * @param cont_cls closure for cont | |
|
| | | * @return handle to cancel the "PUT" operation, NULL on error | |
| | | * (size too big) | |
| */ | | */ | |
|
| void | | struct GNUNET_DHT_PutHandle * | |
| GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, const GNUNET_HashCode * k
ey, | | GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle, const GNUNET_HashCode * k
ey, | |
| uint32_t desired_replication_level, | | uint32_t desired_replication_level, | |
| enum GNUNET_DHT_RouteOption options, | | enum GNUNET_DHT_RouteOption options, | |
| enum GNUNET_BLOCK_Type type, size_t size, const char *data, | | enum GNUNET_BLOCK_Type type, size_t size, const char *data, | |
| struct GNUNET_TIME_Absolute exp, | | struct GNUNET_TIME_Absolute exp, | |
|
| struct GNUNET_TIME_Relative timeout, GNUNET_SCHEDULER_Task | | struct GNUNET_TIME_Relative timeout, | |
| cont, | | GNUNET_DHT_PutContinuation cont, | |
| void *cont_cls); | | void *cont_cls); | |
| | | | |
| /** | | /** | |
|
| | | * Cancels a DHT PUT operation. Note that the PUT request may still | |
| | | * go out over the network (we can't stop that); However, if the PUT | |
| | | * has not yet been sent to the service, cancelling the PUT will stop | |
| | | * this from happening (but there is no way for the user of this API | |
| | | * to tell if that is the case). The only use for this API is to | |
| | | * prevent a later call to 'cont' from "GNUNET_DHT_put" (i.e. because | |
| | | * the system is shutting down). | |
| | | * | |
| | | * @param ph put operation to cancel ('cont' will no longer be called) | |
| | | */ | |
| | | void | |
| | | GNUNET_DHT_put_cancel (struct GNUNET_DHT_PutHandle *ph); | |
| | | | |
| | | /** | |
| * Iterator called on each result obtained for a DHT | | * Iterator called on each result obtained for a DHT | |
| * operation that expects a reply | | * operation that expects a reply | |
| * | | * | |
| * @param cls closure | | * @param cls closure | |
| * @param exp when will this value expire | | * @param exp when will this value expire | |
| * @param key key of the result | | * @param key key of the result | |
| * @param get_path peers on reply path (or NULL if not recorded) | | * @param get_path peers on reply path (or NULL if not recorded) | |
| * @param get_path_length number of entries in get_path | | * @param get_path_length number of entries in get_path | |
| * @param put_path peers on the PUT path (or NULL if not recorded) | | * @param put_path peers on the PUT path (or NULL if not recorded) | |
| * @param put_path_length number of entries in get_path | | * @param put_path_length number of entries in get_path | |
| | | | |
| skipping to change at line 172 | | skipping to change at line 209 | |
| const struct GNUNET_PeerIdentity * | | const struct GNUNET_PeerIdentity * | |
| put_path, unsigned int put_path_len
gth, | | put_path, unsigned int put_path_len
gth, | |
| enum GNUNET_BLOCK_Type type, | | enum GNUNET_BLOCK_Type type, | |
| size_t size, const void *data); | | size_t size, const void *data); | |
| | | | |
| /** | | /** | |
| * Perform an asynchronous GET operation on the DHT identified. See | | * Perform an asynchronous GET operation on the DHT identified. See | |
| * also "GNUNET_BLOCK_evaluate". | | * also "GNUNET_BLOCK_evaluate". | |
| * | | * | |
| * @param handle handle to the DHT service | | * @param handle handle to the DHT service | |
|
| * @param timeout how long to wait for transmission of this request to the
service | | | |
| * @param type expected type of the response object | | * @param type expected type of the response object | |
| * @param key the key to look up | | * @param key the key to look up | |
| * @param desired_replication_level estimate of how many | | * @param desired_replication_level estimate of how many | |
| nearest peers this request should reach | | nearest peers this request should reach | |
| * @param options routing options for this message | | * @param options routing options for this message | |
| * @param xquery extended query data (can be NULL, depending on type) | | * @param xquery extended query data (can be NULL, depending on type) | |
| * @param xquery_size number of bytes in xquery | | * @param xquery_size number of bytes in xquery | |
| * @param iter function to call on each result | | * @param iter function to call on each result | |
| * @param iter_cls closure for iter | | * @param iter_cls closure for iter | |
| * | | * | |
| * @return handle to stop the async get | | * @return handle to stop the async get | |
| */ | | */ | |
| struct GNUNET_DHT_GetHandle * | | struct GNUNET_DHT_GetHandle * | |
| GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle, | | GNUNET_DHT_get_start (struct GNUNET_DHT_Handle *handle, | |
|
| struct GNUNET_TIME_Relative timeout, | | | |
| enum GNUNET_BLOCK_Type type, const GNUNET_HashCode *
key, | | enum GNUNET_BLOCK_Type type, const GNUNET_HashCode *
key, | |
| uint32_t desired_replication_level, | | uint32_t desired_replication_level, | |
| enum GNUNET_DHT_RouteOption options, const void *xque
ry, | | enum GNUNET_DHT_RouteOption options, const void *xque
ry, | |
| size_t xquery_size, GNUNET_DHT_GetIterator iter, | | size_t xquery_size, GNUNET_DHT_GetIterator iter, | |
| void *iter_cls); | | void *iter_cls); | |
| | | | |
| /** | | /** | |
| * Stop async DHT-get. Frees associated resources. | | * Stop async DHT-get. Frees associated resources. | |
| * | | * | |
| * @param get_handle GET operation to stop. | | * @param get_handle GET operation to stop. | |
| * | | * | |
| * On return get_handle will no longer be valid, caller | | * On return get_handle will no longer be valid, caller | |
| * must not use again!!! | | * must not use again!!! | |
| */ | | */ | |
| void | | void | |
| GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *get_handle); | | GNUNET_DHT_get_stop (struct GNUNET_DHT_GetHandle *get_handle); | |
| | | | |
| /* *************** Extended API: monitor ******************* */ | | /* *************** Extended API: monitor ******************* */ | |
| | | | |
|
| | | /** | |
| | | * Handle to monitor requests | |
| | | */ | |
| struct GNUNET_DHT_MonitorHandle; | | struct GNUNET_DHT_MonitorHandle; | |
| | | | |
| /** | | /** | |
|
| * Callback called on each request going through the DHT. | | * Callback called on each GET request going through the DHT. | |
| | | * | |
| | | * @param cls Closure. | |
| | | * @param options Options, for instance RecordRoute, DemultiplexEverywhere. | |
| | | * @param type The type of data in the request. | |
| | | * @param hop_count Hop count so far. | |
| | | * @param path_length number of entries in path (or 0 if not recorded). | |
| | | * @param path peers on the GET path (or NULL if not recorded). | |
| | | * @param desired_replication_level Desired replication level. | |
| | | * @param key Key of the requested data. | |
| | | */ | |
| | | typedef void (*GNUNET_DHT_MonitorGetCB) (void *cls, | |
| | | enum GNUNET_DHT_RouteOption option | |
| | | s, | |
| | | enum GNUNET_BLOCK_Type type, | |
| | | uint32_t hop_count, | |
| | | uint32_t desired_replication_level | |
| | | , | |
| | | unsigned int path_length, | |
| | | const struct GNUNET_PeerIdentity * | |
| | | path, | |
| | | const GNUNET_HashCode * key); | |
| | | | |
| | | /** | |
| | | * Callback called on each GET reply going through the DHT. | |
| * | | * | |
| * @param cls Closure. | | * @param cls Closure. | |
|
| * @param mtype Type of the DHT message monitored. | | * @param type The type of data in the result. | |
| * @param exp When will this value expire. | | * @param get_path Peers on GET path (or NULL if not recorded). | |
| * @param key Key of the result/request. | | | |
| * @param get_path Peers on reply path (or NULL if not recorded). | | | |
| * @param get_path_length number of entries in get_path. | | * @param get_path_length number of entries in get_path. | |
| * @param put_path peers on the PUT path (or NULL if not recorded). | | * @param put_path peers on the PUT path (or NULL if not recorded). | |
| * @param put_path_length number of entries in get_path. | | * @param put_path_length number of entries in get_path. | |
|
| * @param desired_replication_level Desired replication level. | | * @param exp Expiration time of the data. | |
| * @param type Type of the result/request. | | * @param key Key of the data. | |
| * @param data Pointer to the result data. | | * @param data Pointer to the result data. | |
| * @param size Number of bytes in data. | | * @param size Number of bytes in data. | |
| */ | | */ | |
|
| typedef void (*GNUNET_DHT_MonitorCB) (void *cls, | | typedef void (*GNUNET_DHT_MonitorGetRespCB) (void *cls, | |
| uint16_t mtype, | | enum GNUNET_BLOCK_Type type, | |
| struct GNUNET_TIME_Absolute exp, | | const struct GNUNET_PeerIdenti | |
| const GNUNET_HashCode * key, | | ty | |
| const struct GNUNET_PeerIdentity * | | *get_path, | |
| get_path, unsigned int get_path_lengt | | unsigned int get_path_length, | |
| h, | | const struct GNUNET_PeerIdenti | |
| const struct GNUNET_PeerIdentity * | | ty | |
| put_path, unsigned int put_path_lengt | | * put_path, | |
| h, | | unsigned int put_path_length, | |
| uint32_t desired_replication_level, | | struct GNUNET_TIME_Absolute ex | |
| enum GNUNET_DHT_RouteOption options, | | p, | |
| enum GNUNET_BLOCK_Type type, | | const GNUNET_HashCode * key, | |
| const void *data, | | const void *data, | |
| size_t size); | | size_t size); | |
| | | | |
| | | /** | |
| | | * Callback called on each PUT request going through the DHT. | |
| | | * | |
| | | * @param cls Closure. | |
| | | * @param options Options, for instance RecordRoute, DemultiplexEverywhere. | |
| | | * @param type The type of data in the request. | |
| | | * @param hop_count Hop count so far. | |
| | | * @param path_length number of entries in path (or 0 if not recorded). | |
| | | * @param path peers on the PUT path (or NULL if not recorded). | |
| | | * @param desired_replication_level Desired replication level. | |
| | | * @param exp Expiration time of the data. | |
| | | * @param key Key under which data is to be stored. | |
| | | * @param data Pointer to the data carried. | |
| | | * @param size Number of bytes in data. | |
| | | */ | |
| | | typedef void (*GNUNET_DHT_MonitorPutCB) (void *cls, | |
| | | enum GNUNET_DHT_RouteOption option | |
| | | s, | |
| | | enum GNUNET_BLOCK_Type type, | |
| | | uint32_t hop_count, | |
| | | uint32_t desired_replication_level | |
| | | , | |
| | | unsigned int path_length, | |
| | | const struct GNUNET_PeerIdentity * | |
| | | path, | |
| | | struct GNUNET_TIME_Absolute exp, | |
| | | const GNUNET_HashCode * key, | |
| | | const void *data, | |
| | | size_t size); | |
| | | | |
| /** | | /** | |
| * Start monitoring the local DHT service. | | * Start monitoring the local DHT service. | |
| * | | * | |
| * @param handle Handle to the DHT service. | | * @param handle Handle to the DHT service. | |
| * @param type Type of blocks that are of interest. | | * @param type Type of blocks that are of interest. | |
| * @param key Key of data of interest, NULL for all. | | * @param key Key of data of interest, NULL for all. | |
|
| * @param cb Callback to process all monitored data. | | * @param get_cb Callback to process monitored get messages. | |
| | | * @param get_resp_cb Callback to process monitored get response messages. | |
| | | * @param put_cb Callback to process monitored put messages. | |
| * @param cb_cls Closure for cb. | | * @param cb_cls Closure for cb. | |
| * | | * | |
| * @return Handle to stop monitoring. | | * @return Handle to stop monitoring. | |
| */ | | */ | |
| struct GNUNET_DHT_MonitorHandle * | | struct GNUNET_DHT_MonitorHandle * | |
| GNUNET_DHT_monitor_start (struct GNUNET_DHT_Handle *handle, | | GNUNET_DHT_monitor_start (struct GNUNET_DHT_Handle *handle, | |
| enum GNUNET_BLOCK_Type type, | | enum GNUNET_BLOCK_Type type, | |
| const GNUNET_HashCode *key, | | const GNUNET_HashCode *key, | |
|
| GNUNET_DHT_MonitorCB cb, | | GNUNET_DHT_MonitorGetCB get_cb, | |
| | | GNUNET_DHT_MonitorGetRespCB get_resp_cb, | |
| | | GNUNET_DHT_MonitorPutCB put_cb, | |
| void *cb_cls); | | void *cb_cls); | |
| | | | |
| /** | | /** | |
| * Stop monitoring. | | * Stop monitoring. | |
| * | | * | |
| * @param handle The handle to the monitor request returned by monitor_star
t. | | * @param handle The handle to the monitor request returned by monitor_star
t. | |
| * | | * | |
| * On return handle will no longer be valid, caller must not use again!!! | | * On return handle will no longer be valid, caller must not use again!!! | |
| */ | | */ | |
| void | | void | |
| | | | |
End of changes. 15 change blocks. |
| 29 lines changed or deleted | | 122 lines changed or added | |
|
| gnunet_gns_service.h | | gnunet_gns_service.h | |
| | | | |
| skipping to change at line 36 | | skipping to change at line 36 | |
| * TODO: | | * TODO: | |
| * - decide what goes into storage API and what into GNS-service API | | * - decide what goes into storage API and what into GNS-service API | |
| * - decide where to pass/expose/check keys / signatures | | * - decide where to pass/expose/check keys / signatures | |
| * - are GNS private keys per peer or per user? | | * - are GNS private keys per peer or per user? | |
| */ | | */ | |
| | | | |
| #ifndef GNUNET_GNS_SERVICE_H | | #ifndef GNUNET_GNS_SERVICE_H | |
| #define GNUNET_GNS_SERVICE_H | | #define GNUNET_GNS_SERVICE_H | |
| | | | |
| #include "gnunet_util_lib.h" | | #include "gnunet_util_lib.h" | |
|
| | | #include "gnunet_dnsparser_lib.h" | |
| #include "gnunet_namestore_service.h" | | #include "gnunet_namestore_service.h" | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" | | extern "C" | |
| { | | { | |
| #if 0 /* keep Emacsens' auto-indent happy */ | | #if 0 /* keep Emacsens' auto-indent happy */ | |
| } | | } | |
| #endif | | #endif | |
| #endif | | #endif | |
| | | | |
| | | | |
| skipping to change at line 57 | | skipping to change at line 58 | |
| * Connection to the GNS service. | | * Connection to the GNS service. | |
| */ | | */ | |
| struct GNUNET_GNS_Handle; | | struct GNUNET_GNS_Handle; | |
| | | | |
| /** | | /** | |
| * Handle to control a get operation. | | * Handle to control a get operation. | |
| */ | | */ | |
| struct GNUNET_GNS_LookupHandle; | | struct GNUNET_GNS_LookupHandle; | |
| | | | |
| /** | | /** | |
|
| | | * Handle to control a shorten operation | |
| | | */ | |
| | | | |
| | | /** | |
| * Record types | | * Record types | |
| * Based on GNUNET_DNSPARSER_TYPEs (standard DNS) | | * Based on GNUNET_DNSPARSER_TYPEs (standard DNS) | |
| */ | | */ | |
| enum GNUNET_GNS_RecordType | | enum GNUNET_GNS_RecordType | |
| { | | { | |
| /* Standard DNS */ | | /* Standard DNS */ | |
|
| GNUNET_GNS_RECORD_TYPE_A = 1, | | GNUNET_GNS_RECORD_TYPE_A = GNUNET_DNSPARSER_TYPE_A, | |
| GNUNET_GNS_RECORD_TYPE_NS = 2, | | GNUNET_GNS_RECORD_TYPE_NS = GNUNET_DNSPARSER_TYPE_NS, | |
| GNUNET_GNS_RECORD_TYPE_CNAME = 5, | | GNUNET_GNS_RECORD_TYPE_CNAME = GNUNET_DNSPARSER_TYPE_CNAME, | |
| GNUNET_GNS_RECORD_TYPE_SOA = 6, | | GNUNET_GNS_RECORD_TYPE_SOA = GNUNET_DNSPARSER_TYPE_SOA, | |
| GNUNET_GNS_RECORD_TYPE_PTR = 12, | | GNUNET_GNS_RECORD_TYPE_PTR = GNUNET_DNSPARSER_TYPE_PTR, | |
| GNUNET_GNS_RECORD_MX = 15, | | GNUNET_GNS_RECORD_MX = GNUNET_DNSPARSER_TYPE_MX, | |
| GNUNET_GNS_RECORD_TXT = 16, | | GNUNET_GNS_RECORD_TXT = GNUNET_DNSPARSER_TYPE_TXT, | |
| GNUNET_GNS_RECORD_AAAA = 28, | | GNUNET_GNS_RECORD_AAAA = GNUNET_DNSPARSER_TYPE_AAAA, | |
| | | | |
| /* GNS specific */ | | /* GNS specific */ | |
|
| GNUNET_GNS_RECORD_PKEY = 256 | | GNUNET_GNS_RECORD_PKEY = GNUNET_NAMESTORE_TYPE_PKEY, | |
| | | GNUNET_GNS_RECORD_PSEU = GNUNET_NAMESTORE_TYPE_PSEU, | |
| | | GNUNET_GNS_RECORD_ANY = GNUNET_NAMESTORE_TYPE_ANY | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * Initialize the connection with the GNS service. | | * Initialize the connection with the GNS service. | |
|
| * FIXME: Do we need the ht_len? | | | |
| * | | * | |
| * @param cfg configuration to use | | * @param cfg configuration to use | |
|
| * @param ht_len size of the internal hash table to use for parallel lookup | | * | |
| s | | * @return handle to the GNS service, or NULL on error | |
| * @return NULL on error | | | |
| */ | | */ | |
| struct GNUNET_GNS_Handle * | | struct GNUNET_GNS_Handle * | |
|
| GNUNET_GNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | | GNUNET_GNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); | |
| unsigned int ht_len); | | | |
| | | | |
| /** | | /** | |
| * Shutdown connection with the GNS service. | | * Shutdown connection with the GNS service. | |
| * | | * | |
| * @param handle connection to shut down | | * @param handle connection to shut down | |
| */ | | */ | |
| void | | void | |
| GNUNET_GNS_disconnect (struct GNUNET_GNS_Handle *handle); | | GNUNET_GNS_disconnect (struct GNUNET_GNS_Handle *handle); | |
| | | | |
| /* *************** Standard API: lookup ******************* */ | | /* *************** Standard API: lookup ******************* */ | |
| | | | |
| /** | | /** | |
|
| * Iterator called on each result obtained for a GNS | | * Iterator called on obtained result for a GNS | |
| * lookup | | * lookup | |
| * | | * | |
| * @param cls closure | | * @param cls closure | |
| * @param name "name" of the original lookup | | * @param name "name" of the original lookup | |
|
| * @param record the records in reply | | * @param rd_count number of records | |
| * @param num_records the number of records in reply | | * @param rd the records in reply | |
| */ | | */ | |
|
| typedef void (*GNUNET_GNS_LookupIterator) (void *cls, | | typedef void (*GNUNET_GNS_LookupResultProcessor) (void *cls, | |
| const char * name, | | uint32_t rd_count, | |
| const struct GNUNET_NAMESTORE_Recor | | const struct GNUNET_NAMESTORE_RecordData * | |
| dData *record, | | rd); | |
| unsigned int num_records); | | | |
| | | | |
| /** | | /** | |
|
| * Perform an asynchronous lookup operation on the GNS. | | * Perform an asynchronous lookup operation on the GNS | |
| | | * in the default zone. | |
| * | | * | |
| * @param handle handle to the GNS service | | * @param handle handle to the GNS service | |
|
| * @param timeout how long to wait for transmission of this request to the | | * @param name the name to look up | |
| service | | * @param type the GNUNET_GNS_RecordType to look for | |
| * // FIXME: what happens afterwards? | | * @param proc function to call on result | |
| | | * @param proc_cls closure for processor | |
| | | * | |
| | | * @return handle to the queued request | |
| | | */ | |
| | | struct GNUNET_GNS_QueueEntry * | |
| | | GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, | |
| | | const char * name, | |
| | | enum GNUNET_GNS_RecordType type, | |
| | | GNUNET_GNS_LookupResultProcessor proc, | |
| | | void *proc_cls); | |
| | | | |
| | | /** | |
| | | * Perform an asynchronous lookup operation on the GNS | |
| | | * in the zone specified by 'zone'. | |
| | | * | |
| * @param handle handle to the GNS service | | * @param handle handle to the GNS service | |
|
| * @param timeout timeout of request | | | |
| * @param name the name to look up | | * @param name the name to look up | |
|
| | | * @param zone the zone to start the resolution in | |
| * @param type the GNUNET_GNS_RecordType to look for | | * @param type the GNUNET_GNS_RecordType to look for | |
|
| * @param iter function to call on each result | | * @param proc function to call on result | |
| * @param iter_cls closure for iter | | * @param proc_cls closure for processor | |
| * | | * | |
|
| * @return handle to stop the async lookup | | * @return handle to the queued request | |
| */ | | */ | |
|
| struct GNUNET_GNS_LookupHandle * | | struct GNUNET_GNS_QueueEntry * | |
| GNUNET_GNS_lookup_start (struct GNUNET_GNS_Handle *handle, | | GNUNET_GNS_lookup_zone (struct GNUNET_GNS_Handle *handle, | |
| struct GNUNET_TIME_Relative timeout, | | | |
| const char * name, | | const char * name, | |
|
| | | struct GNUNET_CRYPTO_ShortHashCode *zone, | |
| enum GNUNET_GNS_RecordType type, | | enum GNUNET_GNS_RecordType type, | |
|
| GNUNET_GNS_LookupIterator iter, | | GNUNET_GNS_LookupResultProcessor proc, | |
| void *iter_cls); | | void *proc_cls); | |
| | | | |
| | | /* *************** Standard API: shorten ******************* */ | |
| | | | |
| /** | | /** | |
|
| * Stop async GNS lookup. Frees associated resources. | | * Processor called on for a name shortening result | |
| | | * called only once | |
| * | | * | |
|
| * @param lookup_handle lookup operation to stop. | | * @param cls closure | |
| | | * @param short_name the shortened name or NULL if no result | |
| | | */ | |
| | | typedef void (*GNUNET_GNS_ShortenResultProcessor) (void *cls, | |
| | | const char* short_name); | |
| | | | |
| | | /** | |
| | | * Perform a name shortening operation on the GNS. | |
| * | | * | |
|
| * On return lookup_handle will no longer be valid, caller | | * @param handle handle to the GNS service | |
| * must not use again!!! | | * @param name the name to look up | |
| | | * @param proc function to call on result | |
| | | * @param proc_cls closure for processor | |
| | | * @return handle to the operation | |
| | | */ | |
| | | struct GNUNET_GNS_QueueEntry * | |
| | | GNUNET_GNS_shorten (struct GNUNET_GNS_Handle *handle, | |
| | | const char * name, | |
| | | GNUNET_GNS_ShortenResultProcessor proc, | |
| | | void *proc_cls); | |
| | | | |
| | | /** | |
| | | * Perform a name shortening operation on the GNS. | |
| | | * | |
| | | * @param handle handle to the GNS service | |
| | | * @param name the name to look up | |
| | | * @param zone the zone to start the resolution in | |
| | | * @param proc function to call on result | |
| | | * @param proc_cls closure for processor | |
| | | * @return handle to the operation | |
| | | */ | |
| | | struct GNUNET_GNS_QueueEntry * | |
| | | GNUNET_GNS_shorten_zone (struct GNUNET_GNS_Handle *handle, | |
| | | const char * name, | |
| | | struct GNUNET_CRYPTO_ShortHashCode *zone, | |
| | | GNUNET_GNS_ShortenResultProcessor proc, | |
| | | void *proc_cls); | |
| | | | |
| | | /* *************** Standard API: get authority ******************* */ | |
| | | | |
| | | /** | |
| | | * Processor called on for a name shortening result | |
| | | * called only once | |
| | | * | |
| | | * @param cls closure | |
| | | * @param auth_name the name of the auhtority or NULL | |
| */ | | */ | |
|
| void | | typedef void (*GNUNET_GNS_GetAuthResultProcessor) (void *cls, | |
| GNUNET_GNS_lookup_stop (struct GNUNET_GNS_LookupHandle *lookup_handle); | | const char* short_name); | |
| | | | |
| | | /** | |
| | | * Perform an authority lookup for a given name. | |
| | | * | |
| | | * @param handle handle to the GNS service | |
| | | * @param name the name to look up authority for | |
| | | * @param proc function to call on result | |
| | | * @param proc_cls closure for processor | |
| | | * @return handle to the operation | |
| | | */ | |
| | | struct GNUNET_GNS_QueueEntry * | |
| | | GNUNET_GNS_get_authority (struct GNUNET_GNS_Handle *handle, | |
| | | const char * name, | |
| | | GNUNET_GNS_GetAuthResultProcessor proc, | |
| | | void *proc_cls); | |
| | | | |
| #if 0 /* keep Emacsens' auto-indent happy */ | | #if 0 /* keep Emacsens' auto-indent happy */ | |
| { | | { | |
| #endif | | #endif | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif | | #endif | |
| /* gnunet_gns_service.h */ | | /* gnunet_gns_service.h */ | |
| | | | |
End of changes. 23 change blocks. |
| 42 lines changed or deleted | | 121 lines changed or added | |
|
| gnunet_namestore_plugin.h | | gnunet_namestore_plugin.h | |
| | | | |
| skipping to change at line 58 | | skipping to change at line 58 | |
| * @param name name that is being mapped (at most 255 characters long) | | * @param name name that is being mapped (at most 255 characters long) | |
| * @param rd_count number of entries in 'rd' array | | * @param rd_count number of entries in 'rd' array | |
| * @param rd array of records with data to store | | * @param rd array of records with data to store | |
| * @param signature signature of the record block, NULL if signature is una
vailable (i.e. | | * @param signature signature of the record block, NULL if signature is una
vailable (i.e. | |
| * because the user queried for a particular record type only) | | * because the user queried for a particular record type only) | |
| */ | | */ | |
| typedef void (*GNUNET_NAMESTORE_RecordIterator) (void *cls, | | typedef void (*GNUNET_NAMESTORE_RecordIterator) (void *cls, | |
| const struct GNUNET_CRYPTO_
RsaPublicKeyBinaryEncoded *zone_key, | | const struct GNUNET_CRYPTO_
RsaPublicKeyBinaryEncoded *zone_key, | |
| struct GNUNET_TIME_Absolute
expire, | | struct GNUNET_TIME_Absolute
expire, | |
| const char *name, | | const char *name, | |
|
| unsigned int rd_count, | | unsigned int rd_len, | |
| const struct GNUNET_NAMESTO
RE_RecordData *rd, | | const struct GNUNET_NAMESTO
RE_RecordData *rd, | |
| const struct GNUNET_CRYPTO_
RsaSignature *signature); | | const struct GNUNET_CRYPTO_
RsaSignature *signature); | |
| | | | |
| /** | | /** | |
| * @brief struct returned by the initialization function of the plugin | | * @brief struct returned by the initialization function of the plugin | |
| */ | | */ | |
| struct GNUNET_NAMESTORE_PluginFunctions | | struct GNUNET_NAMESTORE_PluginFunctions | |
| { | | { | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 86 | | skipping to change at line 86 | |
| * | | * | |
| * @param cls closure (internal context for the plugin) | | * @param cls closure (internal context for the plugin) | |
| * @param zone_key public key of the zone | | * @param zone_key public key of the zone | |
| * @param expire when does the corresponding block in the DHT expire (unt
il | | * @param expire when does the corresponding block in the DHT expire (unt
il | |
| * when should we never do a DHT lookup for the same name a
gain)? | | * when should we never do a DHT lookup for the same name a
gain)? | |
| * @param name name that is being mapped (at most 255 characters long) | | * @param name name that is being mapped (at most 255 characters long) | |
| * @param rd_count number of entries in 'rd' array | | * @param rd_count number of entries in 'rd' array | |
| * @param rd array of records with data to store | | * @param rd array of records with data to store | |
| * @param signature signature of the record block, NULL if signature is u
navailable (i.e. | | * @param signature signature of the record block, NULL if signature is u
navailable (i.e. | |
| * because the user queried for a particular record type only) | | * because the user queried for a particular record type only) | |
|
| * @return GNUNET_OK on success | | * @return GNUNET_OK on success, else GNUNET_SYSERR | |
| */ | | */ | |
| int (*put_records) (void *cls, | | int (*put_records) (void *cls, | |
| const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *
zone_key, | | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *
zone_key, | |
| struct GNUNET_TIME_Absolute expire, | | struct GNUNET_TIME_Absolute expire, | |
| const char *name, | | const char *name, | |
|
| unsigned int rd_count, | | unsigned int rd_len, | |
| const struct GNUNET_NAMESTORE_RecordData *rd, | | const struct GNUNET_NAMESTORE_RecordData *rd, | |
| const struct GNUNET_CRYPTO_RsaSignature *signature); | | const struct GNUNET_CRYPTO_RsaSignature *signature); | |
| | | | |
| /** | | /** | |
| * Removes any existing record in the given zone with the same name. | | * Removes any existing record in the given zone with the same name. | |
| * | | * | |
| * @param cls closure (internal context for the plugin) | | * @param cls closure (internal context for the plugin) | |
| * @param zone hash of the public key of the zone | | * @param zone hash of the public key of the zone | |
| * @param name name to remove (at most 255 characters long) | | * @param name name to remove (at most 255 characters long) | |
| * @return GNUNET_OK on success | | * @return GNUNET_OK on success | |
| */ | | */ | |
| int (*remove_records) (void *cls, | | int (*remove_records) (void *cls, | |
|
| const GNUNET_HashCode *zone, | | const struct GNUNET_CRYPTO_ShortHashCode *zone, | |
| const char *name); | | const char *name); | |
| | | | |
| /** | | /** | |
| * Iterate over the results for a particular key and zone in the | | * Iterate over the results for a particular key and zone in the | |
| * datastore. Will return at most one result to the iterator. | | * datastore. Will return at most one result to the iterator. | |
| * | | * | |
| * @param cls closure (internal context for the plugin) | | * @param cls closure (internal context for the plugin) | |
| * @param zone hash of public key of the zone, NULL to iterate over all z
ones | | * @param zone hash of public key of the zone, NULL to iterate over all z
ones | |
|
| * @param name_hash hash of name, NULL to iterate over all records of the
zone | | * @param name name as '\0' terminated string, NULL to iterate over all r
ecords of the zone | |
| * @param offset offset in the list of all matching records | | * @param offset offset in the list of all matching records | |
| * @param iter function to call with the result | | * @param iter function to call with the result | |
| * @param iter_cls closure for iter | | * @param iter_cls closure for iter | |
| * @return GNUNET_OK on success, GNUNET_NO if there were no results, GNUN
ET_SYSERR on error | | * @return GNUNET_OK on success, GNUNET_NO if there were no results, GNUN
ET_SYSERR on error | |
| */ | | */ | |
| int (*iterate_records) (void *cls, | | int (*iterate_records) (void *cls, | |
|
| const GNUNET_HashCode *zone, | | const struct GNUNET_CRYPTO_ShortHashCode *zone, | |
| const GNUNET_HashCode *name_hash, | | const char *name, | |
| uint64_t offset, | | uint64_t offset, | |
| GNUNET_NAMESTORE_RecordIterator iter, void *iter_c
ls); | | GNUNET_NAMESTORE_RecordIterator iter, void *iter_c
ls); | |
| | | | |
| /** | | /** | |
|
| | | * Look for an existing PKEY delegation record for a given public key. | |
| | | * Returns at most one result to the iterator. | |
| | | * | |
| | | * @param cls closure (internal context for the plugin) | |
| | | * @param zone hash of public key of the zone to look up in, never NULL | |
| | | * @param value_zone hash of the public key of the target zone (value), n | |
| | | ever NULL | |
| | | * @param iter function to call with the result | |
| | | * @param iter_cls closure for iter | |
| | | * @return GNUNET_OK on success, GNUNET_NO if there were no results, GNUN | |
| | | ET_SYSERR on error | |
| | | */ | |
| | | int (*zone_to_name) (void *cls, | |
| | | const struct GNUNET_CRYPTO_ShortHashCode *zone, | |
| | | const struct GNUNET_CRYPTO_ShortHashCode *value_zone, | |
| | | GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) | |
| | | ; | |
| | | | |
| | | /** | |
| * Delete an entire zone (all records). Not used in normal operation. | | * Delete an entire zone (all records). Not used in normal operation. | |
| * | | * | |
| * @param cls closure (internal context for the plugin) | | * @param cls closure (internal context for the plugin) | |
| * @param zone zone to delete | | * @param zone zone to delete | |
| */ | | */ | |
| void (*delete_zone) (void *cls, | | void (*delete_zone) (void *cls, | |
|
| const GNUNET_HashCode *zone); | | const struct GNUNET_CRYPTO_ShortHashCode *zone); | |
| | | | |
| }; | | }; | |
| | | | |
| #if 0 /* keep Emacsens' auto-indent happy */ | | #if 0 /* keep Emacsens' auto-indent happy */ | |
| { | | { | |
| #endif | | #endif | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| | | | |
End of changes. 8 change blocks. |
| 8 lines changed or deleted | | 27 lines changed or added | |
|
| gnunet_namestore_service.h | | gnunet_namestore_service.h | |
| | | | |
| skipping to change at line 47 | | skipping to change at line 47 | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" | | extern "C" | |
| { | | { | |
| #if 0 /* keep Emacsens' auto-indent happy */ | | #if 0 /* keep Emacsens' auto-indent happy */ | |
| } | | } | |
| #endif | | #endif | |
| #endif | | #endif | |
| | | | |
| /** | | /** | |
|
| | | * Record type indicating any record/'*' | |
| | | */ | |
| | | #define GNUNET_NAMESTORE_TYPE_ANY 0 | |
| | | | |
| | | /** | |
| | | * Record type for GNS zone transfer ("PKEY"). | |
| | | */ | |
| | | #define GNUNET_NAMESTORE_TYPE_PKEY 65536 | |
| | | | |
| | | /** | |
| | | * Record type for GNS zone transfer ("PSEU"). | |
| | | */ | |
| | | #define GNUNET_NAMESTORE_TYPE_PSEU 65537 | |
| | | | |
| | | /** | |
| | | * Record type for GNS legacy hostnames ("LEHO"). | |
| | | */ | |
| | | #define GNUNET_NAMESTORE_TYPE_LEHO 65538 | |
| | | | |
| | | /** | |
| * Entry in the queue. | | * Entry in the queue. | |
| */ | | */ | |
| struct GNUNET_NAMESTORE_QueueEntry; | | struct GNUNET_NAMESTORE_QueueEntry; | |
| | | | |
| /** | | /** | |
| * Handle to the namestore service. | | * Handle to the namestore service. | |
| */ | | */ | |
| struct GNUNET_NAMESTORE_Handle; | | struct GNUNET_NAMESTORE_Handle; | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 91 | | skipping to change at line 111 | |
| */ | | */ | |
| void | | void | |
| GNUNET_NAMESTORE_disconnect (struct GNUNET_NAMESTORE_Handle *h, int drop); | | GNUNET_NAMESTORE_disconnect (struct GNUNET_NAMESTORE_Handle *h, int drop); | |
| | | | |
| /** | | /** | |
| * Continuation called to notify client about result of the | | * Continuation called to notify client about result of the | |
| * operation. | | * operation. | |
| * | | * | |
| * @param cls closure | | * @param cls closure | |
| * @param success GNUNET_SYSERR on failure (including timeout/queue drop/fa
ilure to validate) | | * @param success GNUNET_SYSERR on failure (including timeout/queue drop/fa
ilure to validate) | |
|
| * GNUNET_NO if content was already there | | * GNUNET_NO if content was already there or not found | |
| * GNUNET_YES (or other positive value) on success | | * GNUNET_YES (or other positive value) on success | |
| * @param emsg NULL on success, otherwise an error message | | * @param emsg NULL on success, otherwise an error message | |
| */ | | */ | |
| typedef void (*GNUNET_NAMESTORE_ContinuationWithStatus) (void *cls, | | typedef void (*GNUNET_NAMESTORE_ContinuationWithStatus) (void *cls, | |
| int32_t success, | | int32_t success, | |
| const char *emsg); | | const char *emsg); | |
| | | | |
| /** | | /** | |
| * Flags that can be set for a record. | | * Flags that can be set for a record. | |
| */ | | */ | |
| | | | |
| skipping to change at line 121 | | skipping to change at line 141 | |
| * This peer is the authority for this record; it must thus | | * This peer is the authority for this record; it must thus | |
| * not be deleted (other records can be deleted if we run | | * not be deleted (other records can be deleted if we run | |
| * out of space). | | * out of space). | |
| */ | | */ | |
| GNUNET_NAMESTORE_RF_AUTHORITY = 1, | | GNUNET_NAMESTORE_RF_AUTHORITY = 1, | |
| | | | |
| /** | | /** | |
| * This is a private record of this peer and it should | | * This is a private record of this peer and it should | |
| * thus not be handed out to other peers. | | * thus not be handed out to other peers. | |
| */ | | */ | |
|
| GNUNET_NAMESTORE_RF_PRIVATE = 2 | | GNUNET_NAMESTORE_RF_PRIVATE = 2, | |
| | | | |
| | | /** | |
| | | * This record was added by the system | |
| | | * and is pending user confimation | |
| | | */ | |
| | | GNUNET_NAMESTORE_RF_PENDING = 4 | |
| | | | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * A GNS record. | | * A GNS record. | |
| */ | | */ | |
| struct GNUNET_NAMESTORE_RecordData | | struct GNUNET_NAMESTORE_RecordData | |
| { | | { | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 166 | | skipping to change at line 192 | |
| | | | |
| /** | | /** | |
| * Store an item in the namestore. If the item is already present, | | * Store an item in the namestore. If the item is already present, | |
| * the expiration time is updated to the max of the existing time and | | * the expiration time is updated to the max of the existing time and | |
| * the new time. This API is used when we cache signatures from other | | * the new time. This API is used when we cache signatures from other | |
| * authorities. | | * authorities. | |
| * | | * | |
| * @param h handle to the namestore | | * @param h handle to the namestore | |
| * @param zone_key public key of the zone | | * @param zone_key public key of the zone | |
| * @param name name that is being mapped (at most 255 characters long) | | * @param name name that is being mapped (at most 255 characters long) | |
|
| * @param expire when does the corresponding block in the DHT expire (until | | * @param freshness when does the corresponding block in the DHT expire (un
til | |
| * when should we never do a DHT lookup for the same name aga
in)? | | * when should we never do a DHT lookup for the same name aga
in)? | |
| * @param rd_count number of entries in 'rd' array | | * @param rd_count number of entries in 'rd' array | |
| * @param rd array of records with data to store | | * @param rd array of records with data to store | |
| * @param signature signature for all the records in the zone under the giv
en name | | * @param signature signature for all the records in the zone under the giv
en name | |
| * @param cont continuation to call when done | | * @param cont continuation to call when done | |
| * @param cont_cls closure for cont | | * @param cont_cls closure for cont | |
| * @return handle to abort the request | | * @return handle to abort the request | |
| */ | | */ | |
| struct GNUNET_NAMESTORE_QueueEntry * | | struct GNUNET_NAMESTORE_QueueEntry * | |
| GNUNET_NAMESTORE_record_put (struct GNUNET_NAMESTORE_Handle *h, | | GNUNET_NAMESTORE_record_put (struct GNUNET_NAMESTORE_Handle *h, | |
| const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEn
coded *zone_key, | | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEn
coded *zone_key, | |
| const char *name, | | const char *name, | |
|
| struct GNUNET_TIME_Absolute expire, | | struct GNUNET_TIME_Absolute freshness, | |
| unsigned int rd_count, | | unsigned int rd_count, | |
| const struct GNUNET_NAMESTORE_RecordData *rd, | | const struct GNUNET_NAMESTORE_RecordData *rd, | |
| const struct GNUNET_CRYPTO_RsaSignature *signat
ure, | | const struct GNUNET_CRYPTO_RsaSignature *signat
ure, | |
| GNUNET_NAMESTORE_ContinuationWithStatus cont, | | GNUNET_NAMESTORE_ContinuationWithStatus cont, | |
| void *cont_cls); | | void *cont_cls); | |
| | | | |
| /** | | /** | |
| * Check if a signature is valid. This API is used by the GNS Block | | * Check if a signature is valid. This API is used by the GNS Block | |
| * to validate signatures received from the network. | | * to validate signatures received from the network. | |
| * | | * | |
| * @param public_key public key of the zone | | * @param public_key public key of the zone | |
|
| | | * @param expire block expiration | |
| * @param name name that is being mapped (at most 255 characters long) | | * @param name name that is being mapped (at most 255 characters long) | |
| * @param rd_count number of entries in 'rd' array | | * @param rd_count number of entries in 'rd' array | |
| * @param rd array of records with data to store | | * @param rd array of records with data to store | |
| * @param signature signature for all the records in the zone under the giv
en name | | * @param signature signature for all the records in the zone under the giv
en name | |
| * @return GNUNET_OK if the signature is valid | | * @return GNUNET_OK if the signature is valid | |
| */ | | */ | |
| int | | int | |
| GNUNET_NAMESTORE_verify_signature (const struct GNUNET_CRYPTO_RsaPublicKeyB
inaryEncoded *public_key, | | GNUNET_NAMESTORE_verify_signature (const struct GNUNET_CRYPTO_RsaPublicKeyB
inaryEncoded *public_key, | |
|
| const char *name, | | const struct GNUNET_TIME_Absolute freshn | |
| unsigned int rd_count, | | ess, | |
| const struct GNUNET_NAMESTORE_RecordData | | const char *name, | |
| *rd, | | unsigned int rd_count, | |
| const struct GNUNET_CRYPTO_RsaSignature * | | const struct GNUNET_NAMESTORE_RecordData | |
| signature); | | *rd, | |
| | | const struct GNUNET_CRYPTO_RsaSignature | |
| | | *signature); | |
| | | | |
| /** | | /** | |
| * Store an item in the namestore. If the item is already present, | | * Store an item in the namestore. If the item is already present, | |
| * the expiration time is updated to the max of the existing time and | | * the expiration time is updated to the max of the existing time and | |
| * the new time. This API is used by the authority of a zone. | | * the new time. This API is used by the authority of a zone. | |
| * | | * | |
| * @param h handle to the namestore | | * @param h handle to the namestore | |
| * @param pkey private key of the zone | | * @param pkey private key of the zone | |
| * @param name name that is being mapped (at most 255 characters long) | | * @param name name that is being mapped (at most 255 characters long) | |
| * @param rd record data to store | | * @param rd record data to store | |
| * @param cont continuation to call when done | | * @param cont continuation to call when done | |
| * @param cont_cls closure for cont | | * @param cont_cls closure for cont | |
| * @return handle to abort the request | | * @return handle to abort the request | |
| */ | | */ | |
| struct GNUNET_NAMESTORE_QueueEntry * | | struct GNUNET_NAMESTORE_QueueEntry * | |
| GNUNET_NAMESTORE_record_create (struct GNUNET_NAMESTORE_Handle *h, | | GNUNET_NAMESTORE_record_create (struct GNUNET_NAMESTORE_Handle *h, | |
|
| const struct GNUNET_CRYPTO_RsaPrivateKey *pk | | const struct GNUNET_CRYPTO_RsaPrivateKey *p | |
| ey, | | key, | |
| const char *name, | | const char *name, | |
| const struct GNUNET_NAMESTORE_RecordData *rd | | const struct GNUNET_NAMESTORE_RecordData *r | |
| , | | d, | |
| GNUNET_NAMESTORE_ContinuationWithStatus cont | | GNUNET_NAMESTORE_ContinuationWithStatus con | |
| , | | t, | |
| void *cont_cls); | | void *cont_cls); | |
| | | | |
| /** | | /** | |
| * Explicitly remove some content from the database. The | | * Explicitly remove some content from the database. The | |
| * "cont"inuation will be called with status "GNUNET_OK" if content | | * "cont"inuation will be called with status "GNUNET_OK" if content | |
| * was removed, "GNUNET_NO" if no matching entry was found and | | * was removed, "GNUNET_NO" if no matching entry was found and | |
| * "GNUNET_SYSERR" on all other types of errors. | | * "GNUNET_SYSERR" on all other types of errors. | |
| * This API is used by the authority of a zone. | | * This API is used by the authority of a zone. | |
| * | | * | |
| * @param h handle to the namestore | | * @param h handle to the namestore | |
| * @param pkey private key of the zone | | * @param pkey private key of the zone | |
| * @param name name that is being mapped (at most 255 characters long) | | * @param name name that is being mapped (at most 255 characters long) | |
|
| * @param rd record data | | * @param rd record data, remove specific record, NULL to remove the name
and all records | |
| * @param cont continuation to call when done | | * @param cont continuation to call when done | |
| * @param cont_cls closure for cont | | * @param cont_cls closure for cont | |
| * @return handle to abort the request | | * @return handle to abort the request | |
| */ | | */ | |
| struct GNUNET_NAMESTORE_QueueEntry * | | struct GNUNET_NAMESTORE_QueueEntry * | |
| GNUNET_NAMESTORE_record_remove (struct GNUNET_NAMESTORE_Handle *h, | | GNUNET_NAMESTORE_record_remove (struct GNUNET_NAMESTORE_Handle *h, | |
| const struct GNUNET_CRYPTO_RsaPrivateKey *pk
ey, | | const struct GNUNET_CRYPTO_RsaPrivateKey *pk
ey, | |
| const char *name, | | const char *name, | |
| const struct GNUNET_NAMESTORE_RecordData *rd
, | | const struct GNUNET_NAMESTORE_RecordData *rd
, | |
| GNUNET_NAMESTORE_ContinuationWithStatus cont
, | | GNUNET_NAMESTORE_ContinuationWithStatus cont
, | |
| | | | |
| skipping to change at line 266 | | skipping to change at line 294 | |
| * or the expiration time of the block in the namestore (even
if there are zero | | * or the expiration time of the block in the namestore (even
if there are zero | |
| * records matching the desired record type) | | * records matching the desired record type) | |
| * @param name name that is being mapped (at most 255 characters long) | | * @param name name that is being mapped (at most 255 characters long) | |
| * @param rd_count number of entries in 'rd' array | | * @param rd_count number of entries in 'rd' array | |
| * @param rd array of records with data to store | | * @param rd array of records with data to store | |
| * @param signature signature of the record block, NULL if signature is una
vailable (i.e. | | * @param signature signature of the record block, NULL if signature is una
vailable (i.e. | |
| * because the user queried for a particular record type only) | | * because the user queried for a particular record type only) | |
| */ | | */ | |
| typedef void (*GNUNET_NAMESTORE_RecordProcessor) (void *cls, | | typedef void (*GNUNET_NAMESTORE_RecordProcessor) (void *cls, | |
| const struct GNUNET_CRYPTO
_RsaPublicKeyBinaryEncoded *zone_key, | | const struct GNUNET_CRYPTO
_RsaPublicKeyBinaryEncoded *zone_key, | |
|
| struct GNUNET_TIME_Absolut
e expire, | | struct GNUNET_TIME_Absolut
e freshness, | |
| const char *name, | | const char *name, | |
|
| unsigned int rd_count, | | unsigned int rd_len, | |
| const struct GNUNET_NAMEST
ORE_RecordData *rd, | | const struct GNUNET_NAMEST
ORE_RecordData *rd, | |
| const struct GNUNET_CRYPTO
_RsaSignature *signature); | | const struct GNUNET_CRYPTO
_RsaSignature *signature); | |
| | | | |
| /** | | /** | |
| * Get a result for a particular key from the namestore. The processor | | * Get a result for a particular key from the namestore. The processor | |
| * will only be called once. | | * will only be called once. | |
| * | | * | |
| * @param h handle to the namestore | | * @param h handle to the namestore | |
| * @param zone zone to look up a record from | | * @param zone zone to look up a record from | |
| * @param name name to look up | | * @param name name to look up | |
| * @param record_type desired record type, 0 for all | | * @param record_type desired record type, 0 for all | |
| * @param proc function to call on the matching records, or with | | * @param proc function to call on the matching records, or with | |
| * NULL (rd_count == 0) if there are no matching records | | * NULL (rd_count == 0) if there are no matching records | |
| * @param proc_cls closure for proc | | * @param proc_cls closure for proc | |
| * @return a handle that can be used to | | * @return a handle that can be used to | |
| * cancel | | * cancel | |
| */ | | */ | |
| struct GNUNET_NAMESTORE_QueueEntry * | | struct GNUNET_NAMESTORE_QueueEntry * | |
| GNUNET_NAMESTORE_lookup_record (struct GNUNET_NAMESTORE_Handle *h, | | GNUNET_NAMESTORE_lookup_record (struct GNUNET_NAMESTORE_Handle *h, | |
|
| const GNUNET_HashCode *zone, | | const struct GNUNET_CRYPTO_ShortHashCode *zone
, | |
| const char *name, | | const char *name, | |
| uint32_t record_type, | | uint32_t record_type, | |
| GNUNET_NAMESTORE_RecordProcessor proc, void *p
roc_cls); | | GNUNET_NAMESTORE_RecordProcessor proc, void *p
roc_cls); | |
| | | | |
| /** | | /** | |
|
| | | * Look for an existing PKEY delegation record for a given public key. | |
| | | * Returns at most one result to the processor. | |
| | | * | |
| | | * @param h handle to the namestore | |
| | | * @param zone hash of public key of the zone to look up in, never NULL | |
| | | * @param value_zone hash of the public key of the target zone (value), nev | |
| | | er NULL | |
| | | * @param proc function to call on the matching records, or with | |
| | | * NULL (rd_count == 0) if there are no matching records | |
| | | * @param proc_cls closure for proc | |
| | | * @return a handle that can be used to | |
| | | * cancel | |
| | | */ | |
| | | struct GNUNET_NAMESTORE_QueueEntry * | |
| | | GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h, | |
| | | const struct GNUNET_CRYPTO_ShortHashCode *zon | |
| | | e, | |
| | | const struct GNUNET_CRYPTO_ShortHashCode *val | |
| | | ue_zone, | |
| | | GNUNET_NAMESTORE_RecordProcessor proc, void * | |
| | | proc_cls); | |
| | | | |
| | | /** | |
| * Starts a new zone iteration (used to periodically PUT all of our | | * Starts a new zone iteration (used to periodically PUT all of our | |
|
| * records into our DHT). This MUST lock the GNUNET_NAMESTORE_Handle | | * records into our DHT). "proc" will be called once | |
| * for any other calls than GNUNET_NAMESTORE_zone_iterator_next and | | | |
| * GNUNET_NAMESTORE_zone_iteration_stop. "proc" will be called once | | | |
| * immediately, and then again after | | * immediately, and then again after | |
| * "GNUNET_NAMESTORE_zone_iterator_next" is invoked. | | * "GNUNET_NAMESTORE_zone_iterator_next" is invoked. | |
| * | | * | |
| * @param h handle to the namestore | | * @param h handle to the namestore | |
| * @param zone zone to access, NULL for all zones | | * @param zone zone to access, NULL for all zones | |
| * @param must_have_flags flags that must be set for the record to be retur
ned | | * @param must_have_flags flags that must be set for the record to be retur
ned | |
| * @param must_not_have_flags flags that must NOT be set for the record to
be returned | | * @param must_not_have_flags flags that must NOT be set for the record to
be returned | |
| * @param proc function to call on each name from the zone; it | | * @param proc function to call on each name from the zone; it | |
| * will be called repeatedly with a value (if available) | | * will be called repeatedly with a value (if available) | |
| * and always once at the end with a name of NULL. | | * and always once at the end with a name of NULL. | |
| * @param proc_cls closure for proc | | * @param proc_cls closure for proc | |
| * @return an iterator handle to use for iteration | | * @return an iterator handle to use for iteration | |
| */ | | */ | |
| struct GNUNET_NAMESTORE_ZoneIterator * | | struct GNUNET_NAMESTORE_ZoneIterator * | |
| GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h, | | GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h, | |
|
| const GNUNET_HashCode *zone, | | const struct GNUNET_CRYPTO_ShortHashC
ode *zone, | |
| enum GNUNET_NAMESTORE_RecordFlags mus
t_have_flags, | | enum GNUNET_NAMESTORE_RecordFlags mus
t_have_flags, | |
| enum GNUNET_NAMESTORE_RecordFlags mus
t_not_have_flags, | | enum GNUNET_NAMESTORE_RecordFlags mus
t_not_have_flags, | |
| GNUNET_NAMESTORE_RecordProcessor proc
, | | GNUNET_NAMESTORE_RecordProcessor proc
, | |
| void *proc_cls); | | void *proc_cls); | |
| | | | |
| /** | | /** | |
| * Calls the record processor specified in GNUNET_NAMESTORE_zone_iteration_
start | | * Calls the record processor specified in GNUNET_NAMESTORE_zone_iteration_
start | |
| * for the next record. | | * for the next record. | |
| * | | * | |
| * @param it the iterator | | * @param it the iterator | |
| | | | |
| skipping to change at line 345 | | skipping to change at line 390 | |
| | | | |
| /** | | /** | |
| * Cancel a namestore operation. The final callback from the | | * Cancel a namestore operation. The final callback from the | |
| * operation must not have been done yet. | | * operation must not have been done yet. | |
| * | | * | |
| * @param qe operation to cancel | | * @param qe operation to cancel | |
| */ | | */ | |
| void | | void | |
| GNUNET_NAMESTORE_cancel (struct GNUNET_NAMESTORE_QueueEntry *qe); | | GNUNET_NAMESTORE_cancel (struct GNUNET_NAMESTORE_QueueEntry *qe); | |
| | | | |
|
| | | /* convenience APIs for serializing / deserializing GNS records */ | |
| | | | |
| | | /** | |
| | | * Calculate how many bytes we will need to serialize the given | |
| | | * records. | |
| | | * | |
| | | * @param rd_count number of records in the rd array | |
| | | * @param rd array of GNUNET_NAMESTORE_RecordData with rd_count elements | |
| | | * | |
| | | * @return the required size to serialize | |
| | | * | |
| | | */ | |
| | | size_t | |
| | | GNUNET_NAMESTORE_records_get_size (unsigned int rd_count, | |
| | | const struct GNUNET_NAMESTORE_RecordData | |
| | | *rd); | |
| | | | |
| | | /** | |
| | | * Serialize the given records to the given destination buffer. | |
| | | * | |
| | | * @param rd_count number of records in the rd array | |
| | | * @param rd array of GNUNET_NAMESTORE_RecordData with rd_count elements | |
| | | * @param dest_size size of the destination array | |
| | | * @param dest where to write the result | |
| | | * | |
| | | * @return the size of serialized records | |
| | | */ | |
| | | ssize_t | |
| | | GNUNET_NAMESTORE_records_serialize (unsigned int rd_count, | |
| | | const struct GNUNET_NAMESTORE_RecordData | |
| | | *rd, | |
| | | size_t dest_size, | |
| | | char *dest); | |
| | | | |
| | | /** | |
| | | * Deserialize the given records to the given destination. | |
| | | * | |
| | | * @param len size of the serialized record data | |
| | | * @param src the serialized record data | |
| | | * @param rd_count number of records in the rd array | |
| | | * @param dest where to put the data | |
| | | * | |
| | | * @return GNUNET_OK on success, GNUNET_SYSERR on error | |
| | | */ | |
| | | int | |
| | | GNUNET_NAMESTORE_records_deserialize (size_t len, | |
| | | const char *src, | |
| | | unsigned int rd_count, | |
| | | struct GNUNET_NAMESTORE_RecordData *de | |
| | | st); | |
| | | | |
| | | /** | |
| | | * Checks if a name is wellformed | |
| | | * | |
| | | * @param name the name to check | |
| | | * @return GNUNET_OK on success, GNUNET_SYSERR on error | |
| | | */ | |
| | | int | |
| | | GNUNET_NAMESTORE_check_name (const char * name); | |
| | | | |
| | | /** | |
| | | * Convert the 'value' of a record to a string. | |
| | | * | |
| | | * @param type type of the record | |
| | | * @param data value in binary encoding | |
| | | * @param data_size number of bytes in data | |
| | | * @return NULL on error, otherwise human-readable representation of the va | |
| | | lue | |
| | | */ | |
| | | char * | |
| | | GNUNET_NAMESTORE_value_to_string (uint32_t type, | |
| | | const void *data, | |
| | | size_t data_size); | |
| | | | |
| | | /** | |
| | | * Convert human-readable version of a 'value' of a record to the binary | |
| | | * representation. | |
| | | * | |
| | | * @param type type of the record | |
| | | * @param s human-readable string | |
| | | * @param data set to value in binary encoding (will be allocated) | |
| | | * @param data_size set to number of bytes in data | |
| | | * @return GNUNET_OK on success | |
| | | */ | |
| | | int | |
| | | GNUNET_NAMESTORE_string_to_value (uint32_t type, | |
| | | const char *s, | |
| | | void **data, | |
| | | size_t *data_size); | |
| | | | |
| | | /** | |
| | | * Convert a type name (i.e. "AAAA") to the corresponding number. | |
| | | * | |
| | | * @param typename name to convert | |
| | | * @return corresponding number, UINT32_MAX on error | |
| | | */ | |
| | | uint32_t | |
| | | GNUNET_NAMESTORE_typename_to_number (const char *typename); | |
| | | | |
| | | /** | |
| | | * Convert a type number (i.e. 1) to the corresponding type string (i.e. "A | |
| | | ") | |
| | | * | |
| | | * @param type number of a type to convert | |
| | | * @return corresponding typestring, NULL on error | |
| | | */ | |
| | | const char * | |
| | | GNUNET_NAMESTORE_number_to_typename (uint32_t type); | |
| | | | |
| #if 0 /* keep Emacsens' auto-indent happy */ | | #if 0 /* keep Emacsens' auto-indent happy */ | |
| { | | { | |
| #endif | | #endif | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| /* end of gnunet_namestore_service.h */ | | /* end of gnunet_namestore_service.h */ | |
| #endif | | #endif | |
| | | | |
End of changes. 16 change blocks. |
| 26 lines changed or deleted | | 185 lines changed or added | |
|
| gnunet_protocols.h | | gnunet_protocols.h | |
| | | | |
| skipping to change at line 90 | | skipping to change at line 90 | |
| /** | | /** | |
| * Request ARM service itself to shutdown. | | * Request ARM service itself to shutdown. | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_ARM_SHUTDOWN 10 | | #define GNUNET_MESSAGE_TYPE_ARM_SHUTDOWN 10 | |
| | | | |
| /** | | /** | |
| * Response from ARM. | | * Response from ARM. | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_ARM_RESULT 11 | | #define GNUNET_MESSAGE_TYPE_ARM_RESULT 11 | |
| | | | |
|
| | | /** | |
| | | * Request to ARM to list all currently running services | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_ARM_LIST 12 | |
| | | | |
| | | /** | |
| | | * Response from ARM for listing currently running services | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_ARM_LIST_RESULT 13 | |
| | | | |
| /**************************************************************************
***** | | /**************************************************************************
***** | |
| * HELLO message types | | * HELLO message types | |
| **************************************************************************
****/ | | **************************************************************************
****/ | |
| | | | |
| /** | | /** | |
| * HELLO message used for communicating peer addresses. | | * HELLO message used for communicating peer addresses. | |
| * Managed by libgnunethello. | | * Managed by libgnunethello. | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_HELLO 16 | | #define GNUNET_MESSAGE_TYPE_HELLO 16 | |
| | | | |
| | | | |
| skipping to change at line 121 | | skipping to change at line 131 | |
| * Acknowledgement of a FRAGMENT of a larger message. | | * Acknowledgement of a FRAGMENT of a larger message. | |
| * Managed by libgnunetfragment. | | * Managed by libgnunetfragment. | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_FRAGMENT_ACK 19 | | #define GNUNET_MESSAGE_TYPE_FRAGMENT_ACK 19 | |
| | | | |
| /**************************************************************************
***** | | /**************************************************************************
***** | |
| * Transport-WLAN message types | | * Transport-WLAN message types | |
| **************************************************************************
****/ | | **************************************************************************
****/ | |
| | | | |
| /** | | /** | |
|
| * Type of messages between the gnunet-wlan-helper and the daemon | | * Type of data messages from the plugin to the gnunet-wlan-helper | |
| * | | | |
| */ | | */ | |
|
| #define GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA 40 | | #define GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER 39 | |
| | | | |
| /** | | /** | |
|
| * Control messages between the gnunet-wlan-helper and the daemon | | * Type of data messages from the gnunet-wlan-helper to the plugin | |
| */ | | */ | |
|
| | | #define GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER 40 | |
| | | | |
|
| | | /** | |
| | | * Control message between the gnunet-wlan-helper and the daemon (with the | |
| | | MAC). | |
| | | */ | |
| #define GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL 41 | | #define GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL 41 | |
| | | | |
| /** | | /** | |
| * Type of messages for advertisement over wlan | | * Type of messages for advertisement over wlan | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_WLAN_ADVERTISEMENT 42 | | #define GNUNET_MESSAGE_TYPE_WLAN_ADVERTISEMENT 42 | |
| | | | |
| /** | | /** | |
| * Type of messages for data over the wlan | | * Type of messages for data over the wlan | |
| */ | | */ | |
| | | | |
| skipping to change at line 244 | | skipping to change at line 257 | |
| * Initial setup message from core client to core. | | * Initial setup message from core client to core. | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_CORE_INIT 64 | | #define GNUNET_MESSAGE_TYPE_CORE_INIT 64 | |
| | | | |
| /** | | /** | |
| * Response from core to core client to INIT message. | | * Response from core to core client to INIT message. | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_CORE_INIT_REPLY 65 | | #define GNUNET_MESSAGE_TYPE_CORE_INIT_REPLY 65 | |
| | | | |
| /** | | /** | |
|
| * Notify clients about new peer-to-peer connections (before | | | |
| * key exchange and authentication). | | | |
| */ | | | |
| #define GNUNET_MESSAGE_TYPE_CORE_NOTIFY_PRE_CONNECT 66 | | | |
| | | | |
| /** | | | |
| * Notify clients about new peer-to-peer connections (triggered | | * Notify clients about new peer-to-peer connections (triggered | |
| * after key exchange). | | * after key exchange). | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT 67 | | #define GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT 67 | |
| | | | |
| /** | | /** | |
| * Notify clients about peer disconnecting. | | * Notify clients about peer disconnecting. | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT 68 | | #define GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT 68 | |
| | | | |
| | | | |
| skipping to change at line 516 | | skipping to change at line 523 | |
| * Peer tries to find data in DHT. | | * Peer tries to find data in DHT. | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_DHT_P2P_GET 147 | | #define GNUNET_MESSAGE_TYPE_DHT_P2P_GET 147 | |
| | | | |
| /** | | /** | |
| * Data is returned to peer from DHT. | | * Data is returned to peer from DHT. | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_DHT_P2P_RESULT 148 | | #define GNUNET_MESSAGE_TYPE_DHT_P2P_RESULT 148 | |
| | | | |
| /** | | /** | |
|
| * Request / receive information about transiting GETs | | * Receive information about transiting GETs | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET 149 | | #define GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET 149 | |
| | | | |
| /** | | /** | |
|
| * Request / receive information about transiting GET responses | | * Receive information about transiting GET responses | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET_RESP 150 | | #define GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET_RESP 150 | |
| | | | |
| /** | | /** | |
|
| * Request / receive information about transiting PUTs | | * Receive information about transiting PUTs | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT 151 | | #define GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT 151 | |
| | | | |
| /** | | /** | |
|
| * Request / receive information about transiting PUT responses (TODO) | | * Receive information about transiting PUT responses (TODO) | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT_RESP 152 | | #define GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT_RESP 152 | |
| | | | |
|
| | | /** | |
| | | * Request information about transiting messages | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_DHT_MONITOR_START 153 | |
| | | | |
| | | /** | |
| | | * Stop information about transiting messages | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_DHT_MONITOR_STOP 154 | |
| | | | |
| | | /** | |
| | | * Acknowledge receiving PUT request | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_DHT_CLIENT_PUT_OK 155 | |
| | | | |
| /**************************************************************************
***** | | /**************************************************************************
***** | |
| * HOSTLIST message types | | * HOSTLIST message types | |
| **************************************************************************
****/ | | **************************************************************************
****/ | |
| | | | |
| /** | | /** | |
| * Hostlist advertisement message | | * Hostlist advertisement message | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_HOSTLIST_ADVERTISEMENT 160 | | #define GNUNET_MESSAGE_TYPE_HOSTLIST_ADVERTISEMENT 160 | |
| | | | |
| /**************************************************************************
***** | | /**************************************************************************
***** | |
| | | | |
| skipping to change at line 994 | | skipping to change at line 1016 | |
| * to confirm that a session ID was destroyed. | | * to confirm that a session ID was destroyed. | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_ATS_SESSION_RELEASE 350 | | #define GNUNET_MESSAGE_TYPE_ATS_SESSION_RELEASE 350 | |
| | | | |
| /** | | /** | |
| * Type of the 'struct AddressUseMessage' sent by ATS to client | | * Type of the 'struct AddressUseMessage' sent by ATS to client | |
| * to confirm that an address is used or not used anymore | | * to confirm that an address is used or not used anymore | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_ATS_ADDRESS_IN_USE 351 | | #define GNUNET_MESSAGE_TYPE_ATS_ADDRESS_IN_USE 351 | |
| | | | |
|
| | | /** | |
| | | * Type of the 'struct AddressUseMessage' sent by ATS to client | |
| | | * to confirm that an address is used or not used anymore | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_ATS_RESET_BACKOFF 352 | |
| | | | |
| /**************************************************************************
***** | | /**************************************************************************
***** | |
| * TRANSPORT message types | | * TRANSPORT message types | |
| **************************************************************************
****/ | | **************************************************************************
****/ | |
| | | | |
| /** | | /** | |
| * Message from the core saying that the transport | | * Message from the core saying that the transport | |
| * server should start giving it messages. This | | * server should start giving it messages. This | |
| * should automatically trigger the transmission of | | * should automatically trigger the transmission of | |
| * a HELLO message. | | * a HELLO message. | |
| */ | | */ | |
| | | | |
| skipping to change at line 1243 | | skipping to change at line 1271 | |
| | | | |
| /**************************************************************************
***** | | /**************************************************************************
***** | |
| * NAMESTORE message types | | * NAMESTORE message types | |
| **************************************************************************
****/ | | **************************************************************************
****/ | |
| | | | |
| /** | | /** | |
| * Request update and listing of a peer. | | * Request update and listing of a peer. | |
| */ | | */ | |
| #define GNUNET_MESSAGE_TYPE_NAMESTORE_START 430 | | #define GNUNET_MESSAGE_TYPE_NAMESTORE_START 430 | |
| | | | |
|
| | | /************************************************************************** | |
| | | ***** | |
| | | * LOCKMANAGER message types | |
| | | ************************************************************************** | |
| | | ****/ | |
| | | | |
| | | /** | |
| | | * Message to acquire Lock | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_LOCKMANAGER_ACQUIRE 440 | |
| | | | |
| | | /** | |
| | | * Message to release lock | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_LOCKMANAGER_RELEASE 441 | |
| | | | |
| | | /** | |
| | | * SUCESS reply from lockmanager | |
| | | */ | |
| | | #define GNUNET_MESSAGE_TYPE_LOCKMANAGER_SUCCESS 442 | |
| | | | |
| /** | | /** | |
|
| * Next available: 440 | | * Next available: 450 | |
| */ | | */ | |
| | | | |
| /**************************************************************************
***** | | /**************************************************************************
***** | |
| * TODO: we need a way to register message types centrally (via some webpag
e). | | * TODO: we need a way to register message types centrally (via some webpag
e). | |
| * For now: unofficial extensions should start at 48k, internal extensions | | * For now: unofficial extensions should start at 48k, internal extensions | |
| * define here should leave some room (4-10 additional messages to the prev
ious | | * define here should leave some room (4-10 additional messages to the prev
ious | |
| * extension). | | * extension). | |
| **************************************************************************
****/ | | **************************************************************************
****/ | |
| | | | |
| /** | | /** | |
| | | | |
End of changes. 15 change blocks. |
| 15 lines changed or deleted | | 65 lines changed or added | |
|
| gnunet_pseudonym_lib.h | | gnunet_pseudonym_lib.h | |
| | | | |
| skipping to change at line 47 | | skipping to change at line 47 | |
| | | | |
| #include "gnunet_common.h" | | #include "gnunet_common.h" | |
| #include "gnunet_configuration_lib.h" | | #include "gnunet_configuration_lib.h" | |
| #include "gnunet_container_lib.h" | | #include "gnunet_container_lib.h" | |
| | | | |
| /** | | /** | |
| * Iterator over all known pseudonyms. | | * Iterator over all known pseudonyms. | |
| * | | * | |
| * @param cls closure | | * @param cls closure | |
| * @param pseudonym hash code of public key of pseudonym | | * @param pseudonym hash code of public key of pseudonym | |
|
| | | * @param name name of the pseudonym (might be NULL) | |
| | | * @param unique_name unique name of the pseudonym (might be NULL) | |
| * @param md meta data known about the pseudonym | | * @param md meta data known about the pseudonym | |
| * @param rating the local rating of the pseudonym | | * @param rating the local rating of the pseudonym | |
| * @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort | | * @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort | |
| */ | | */ | |
| typedef int (*GNUNET_PSEUDONYM_Iterator) (void *cls, | | typedef int (*GNUNET_PSEUDONYM_Iterator) (void *cls, | |
| const GNUNET_HashCode * pseudonym
, | | const GNUNET_HashCode * pseudonym
, | |
|
| | | const char *name, | |
| | | const char *unique_name, | |
| const struct GNUNET_CONTAINER_Met
aData | | const struct GNUNET_CONTAINER_Met
aData | |
| * md, int rating); | | * md, int rating); | |
| | | | |
| /** | | /** | |
| * Change the ranking of a pseudonym. | | * Change the ranking of a pseudonym. | |
| * | | * | |
| * @param cfg overall configuration | | * @param cfg overall configuration | |
| * @param nsid id of the pseudonym | | * @param nsid id of the pseudonym | |
| * @param delta by how much should the rating be changed? | | * @param delta by how much should the rating be changed? | |
| * @return new rating of the namespace | | * @return new rating of the namespace | |
| | | | |
| skipping to change at line 112 | | skipping to change at line 116 | |
| iterator, void *closure); | | iterator, void *closure); | |
| | | | |
| /** | | /** | |
| * Unregister namespace discovery callback. | | * Unregister namespace discovery callback. | |
| */ | | */ | |
| int | | int | |
| GNUNET_PSEUDONYM_discovery_callback_unregister (GNUNET_PSEUDONYM_Iterator | | GNUNET_PSEUDONYM_discovery_callback_unregister (GNUNET_PSEUDONYM_Iterator | |
| iterator, void *closure); | | iterator, void *closure); | |
| | | | |
| /** | | /** | |
|
| * Return the unique, human readable name for the given pseudonym. | | * Return unique variant of the namespace name. | |
| * | | * Use after GNUNET_PSEUDONYM_id_to_name() to make sure | |
| * @return NULL on failure (should never happen) | | * that name is unique. | |
| | | * | |
| | | * @param cfg configuration | |
| | | * @param nsid cryptographic ID of the namespace | |
| | | * @param name name to uniquify | |
| | | * @param suffix if not NULL, filled with the suffix value | |
| | | * @return NULL on failure (should never happen), name on success. | |
| | | * Free the name with GNUNET_free(). | |
| */ | | */ | |
| char * | | char * | |
|
| GNUNET_PSEUDONYM_id_to_name (const struct GNUNET_CONFIGURATION_Handle *cfg, | | GNUNET_PSEUDONYM_name_uniquify (const struct GNUNET_CONFIGURATION_Handle *c | |
| const GNUNET_HashCode * pseudo); | | fg, | |
| | | const GNUNET_HashCode * nsid, const char *name, unsigned int *suffix); | |
| | | | |
| | | /** | |
| | | * Get namespace name, metadata and rank | |
| | | * This is a wrapper around internal read_info() call, and ensures that | |
| | | * returned data is not invalid (not NULL). | |
| | | * Writing back information returned by this function will give | |
| | | * a name "no-name" to pseudonyms that have no name. This side-effect is | |
| | | * unavoidable, but hardly harmful. | |
| | | * | |
| | | * @param cfg configuration | |
| | | * @param nsid cryptographic ID of the namespace | |
| | | * @param ret_meta a location to store metadata pointer. NULL, if metadata | |
| | | * is not needed. Destroy with GNUNET_CONTAINER_meta_data_destroy(). | |
| | | * @param ret_rank a location to store rank. NULL, if rank not needed. | |
| | | * @param ret_name a location to store human-readable name. Name is not uni | |
| | | que. | |
| | | * NULL, if name is not needed. Free with GNUNET_free(). | |
| | | * @param name_is_a_dup is set to GNUNET_YES, if ret_name was filled with | |
| | | * a duplicate of a "no-name" placeholder | |
| | | * @return GNUNET_OK on success. GNUENT_SYSERR if the data was | |
| | | * unobtainable (in that case ret_* are filled with placeholders - | |
| | | * empty metadata container, rank -1 and a "no-name" name). | |
| | | */ | |
| | | int | |
| | | GNUNET_PSEUDONYM_get_info (const struct GNUNET_CONFIGURATION_Handle *cfg, | |
| | | const GNUNET_HashCode * nsid, struct GNUNET_CONTAINER_MetaData **ret_me | |
| | | ta, | |
| | | int32_t *ret_rank, char **ret_name, int *name_is_a_dup); | |
| | | | |
| /** | | /** | |
|
| * Get the pseudonym ID belonging to the given human readable name. | | * Get the namespace ID belonging to the given namespace name. | |
| * | | * | |
|
| * @return GNUNET_OK on success | | * @param cfg configuration to use | |
| | | * @param ns_uname unique (!) human-readable name for the namespace | |
| | | * @param nsid set to namespace ID based on 'ns_uname' | |
| | | * @return GNUNET_OK on success, GNUNET_SYSERR on failure | |
| */ | | */ | |
| int | | int | |
| GNUNET_PSEUDONYM_name_to_id (const struct GNUNET_CONFIGURATION_Handle *cfg, | | GNUNET_PSEUDONYM_name_to_id (const struct GNUNET_CONFIGURATION_Handle *cfg, | |
|
| const char *hname, GNUNET_HashCode * psid); | | const char *ns_uname, GNUNET_HashCode * nsid); | |
| | | | |
| | | /** | |
| | | * Set the pseudonym metadata, rank and name. | |
| | | * | |
| | | * @param cfg overall configuration | |
| | | * @param nsid id of the pseudonym | |
| | | * @param name name to set. Must be the non-unique version of it. | |
| | | * May be NULL, in which case it erases pseudonym's name! | |
| | | * @param md metadata to set | |
| | | * May be NULL, in which case it erases pseudonym's metadata! | |
| | | * @param rank rank to assign | |
| | | * @return GNUNET_OK on success, GNUNET_SYSERR on failure | |
| | | */ | |
| | | int | |
| | | GNUNET_PSEUDONYM_set_info (const struct GNUNET_CONFIGURATION_Handle *cfg, | |
| | | const GNUNET_HashCode * nsid, const char *name, | |
| | | const struct GNUNET_CONTAINER_MetaData *md, int rank); | |
| | | | |
| #if 0 /* keep Emacsens' auto-indent happy */ | | #if 0 /* keep Emacsens' auto-indent happy */ | |
| { | | { | |
| #endif | | #endif | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| /* ifndef GNUNET_PSEUDONYM_LIB_H */ | | /* ifndef GNUNET_PSEUDONYM_LIB_H */ | |
| #endif | | #endif | |
| | | | |
End of changes. 7 change blocks. |
| 8 lines changed or deleted | | 68 lines changed or added | |
|
| gnunet_scheduler_lib.h | | gnunet_scheduler_lib.h | |
| | | | |
| skipping to change at line 235 | | skipping to change at line 235 | |
| GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_Task task, void *task_cls); | | GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_Task task, void *task_cls); | |
| | | | |
| /** | | /** | |
| * Request the shutdown of a scheduler. Marks all currently | | * Request the shutdown of a scheduler. Marks all currently | |
| * pending tasks as ready because of shutdown. This will | | * pending tasks as ready because of shutdown. This will | |
| * cause all tasks to run (as soon as possible, respecting | | * cause all tasks to run (as soon as possible, respecting | |
| * priorities and prerequisite tasks). Note that tasks | | * priorities and prerequisite tasks). Note that tasks | |
| * scheduled AFTER this call may still be delayed arbitrarily. | | * scheduled AFTER this call may still be delayed arbitrarily. | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_SCHEDULER_shutdown (); | | GNUNET_SCHEDULER_shutdown (void); | |
| | | | |
| /** | | /** | |
| * Get information about the current load of this scheduler. Use this | | * Get information about the current load of this scheduler. Use this | |
| * function to determine if an elective task should be added or simply | | * function to determine if an elective task should be added or simply | |
| * dropped (if the decision should be made based on the number of | | * dropped (if the decision should be made based on the number of | |
| * tasks ready to run). | | * tasks ready to run). | |
| * | | * | |
| * * @param p priority-level to query, use KEEP to query the level | | * * @param p priority-level to query, use KEEP to query the level | |
| * of the current task, use COUNT to get the sum over | | * of the current task, use COUNT to get the sum over | |
| * all priority levels | | * all priority levels | |
| | | | |
| skipping to change at line 300 | | skipping to change at line 300 | |
| * @param task_cls closure for 'main' | | * @param task_cls closure for 'main' | |
| * @param reason reason for task invocation | | * @param reason reason for task invocation | |
| * @param priority priority to use for the task | | * @param priority priority to use for the task | |
| */ | | */ | |
| void | | void | |
| GNUNET_SCHEDULER_add_continuation_with_priority (GNUNET_SCHEDULER_Task task
, void *task_cls, | | GNUNET_SCHEDULER_add_continuation_with_priority (GNUNET_SCHEDULER_Task task
, void *task_cls, | |
| enum GNUNET_SCHEDULER_Reaso
n reason, | | enum GNUNET_SCHEDULER_Reaso
n reason, | |
| enum GNUNET_SCHEDULER_Prior
ity priority); | | enum GNUNET_SCHEDULER_Prior
ity priority); | |
| | | | |
| /** | | /** | |
|
| * Schedule a new task to be run after the specified prerequisite task | | | |
| * has completed. It will be run with DEFAULT priority. | | | |
| * | | | |
| * * @param prerequisite_task run this task after the task with the given | | | |
| * task identifier completes (and any of our other | | | |
| * conditions, such as delay, read or write-readiness | | | |
| * are satisfied). Use GNUNET_SCHEDULER_NO_TASK to not have any de | | | |
| pendency | | | |
| * on completion of other tasks (this will cause the task to run as | | | |
| * soon as possible). | | | |
| * @param task main function of the task | | | |
| * @param task_cls closure of task | | | |
| * @return unique task identifier for the job | | | |
| * only valid until "task" is started! | | | |
| */ | | | |
| GNUNET_SCHEDULER_TaskIdentifier | | | |
| GNUNET_SCHEDULER_add_after (GNUNET_SCHEDULER_TaskIdentifier prerequisite_ta | | | |
| sk, | | | |
| GNUNET_SCHEDULER_Task task, void *task_cls); | | | |
| | | | |
| /** | | | |
| * Schedule a new task to be run with a specified priority. | | * Schedule a new task to be run with a specified priority. | |
| * | | * | |
| * * @param prio how important is the new task? | | * * @param prio how important is the new task? | |
| * @param task main function of the task | | * @param task main function of the task | |
| * @param task_cls closure of task | | * @param task_cls closure of task | |
| * @return unique task identifier for the job | | * @return unique task identifier for the job | |
| * only valid until "task" is started! | | * only valid until "task" is started! | |
| */ | | */ | |
| GNUNET_SCHEDULER_TaskIdentifier | | GNUNET_SCHEDULER_TaskIdentifier | |
| GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio, | | GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio, | |
| | | | |
| skipping to change at line 416 | | skipping to change at line 397 | |
| * @param task_cls closure of task | | * @param task_cls closure of task | |
| * @return unique task identifier for the job | | * @return unique task identifier for the job | |
| * only valid until "task" is started! | | * only valid until "task" is started! | |
| */ | | */ | |
| GNUNET_SCHEDULER_TaskIdentifier | | GNUNET_SCHEDULER_TaskIdentifier | |
| GNUNET_SCHEDULER_add_read_net (struct GNUNET_TIME_Relative delay, | | GNUNET_SCHEDULER_add_read_net (struct GNUNET_TIME_Relative delay, | |
| struct GNUNET_NETWORK_Handle *rfd, | | struct GNUNET_NETWORK_Handle *rfd, | |
| GNUNET_SCHEDULER_Task task, void *task_cls); | | GNUNET_SCHEDULER_Task task, void *task_cls); | |
| | | | |
| /** | | /** | |
|
| | | * Schedule a new task to be run with a specified priority and to be | |
| | | * run after the specified delay or when the specified file descriptor | |
| | | * is ready for reading. The delay can be used as a timeout on the | |
| | | * socket being ready. The task will be scheduled for execution once | |
| | | * either the delay has expired or the socket operation is ready. It | |
| | | * will be run with the DEFAULT priority. | |
| | | * | |
| | | * @param delay when should this operation time out? Use | |
| | | * GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" | |
| | | * @param priority priority to use for the task | |
| | | * @param rfd read file-descriptor | |
| | | * @param task main function of the task | |
| | | * @param task_cls closure of task | |
| | | * @return unique task identifier for the job | |
| | | * only valid until "task" is started! | |
| | | */ | |
| | | GNUNET_SCHEDULER_TaskIdentifier | |
| | | GNUNET_SCHEDULER_add_read_net_with_priority (struct GNUNET_TIME_Relative de | |
| | | lay, | |
| | | enum GNUNET_SCHEDULER_Priority | |
| | | priority, | |
| | | struct GNUNET_NETWORK_Handle *r | |
| | | fd, | |
| | | GNUNET_SCHEDULER_Task task, voi | |
| | | d *task_cls); | |
| | | | |
| | | /** | |
| * Schedule a new task to be run with a specified delay or when the | | * Schedule a new task to be run with a specified delay or when the | |
| * specified file descriptor is ready for writing. The delay can be | | * specified file descriptor is ready for writing. The delay can be | |
| * used as a timeout on the socket being ready. The task will be | | * used as a timeout on the socket being ready. The task will be | |
| * scheduled for execution once either the delay has expired or the | | * scheduled for execution once either the delay has expired or the | |
| * socket operation is ready. It will be run with the DEFAULT priority. | | * socket operation is ready. It will be run with the DEFAULT priority. | |
| * | | * | |
| * * @param delay when should this operation time out? Use | | * * @param delay when should this operation time out? Use | |
| * GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" | | * GNUNET_TIME_UNIT_FOREVER_REL for "on shutdown" | |
| * @param wfd write file-descriptor | | * @param wfd write file-descriptor | |
| * @param task main function of the task | | * @param task main function of the task | |
| | | | |
| skipping to change at line 492 | | skipping to change at line 496 | |
| * must be satisfied in addition to any of the other conditions. In | | * must be satisfied in addition to any of the other conditions. In | |
| * other words, the task will be started when | | * other words, the task will be started when | |
| * <code> | | * <code> | |
| * (prerequisite-run) | | * (prerequisite-run) | |
| * && (delay-ready | | * && (delay-ready | |
| * || any-rs-ready | | * || any-rs-ready | |
| * || any-ws-ready | | * || any-ws-ready | |
| * || shutdown-active) | | * || shutdown-active) | |
| * </code> | | * </code> | |
| * | | * | |
|
| * * @param prio how important is this task? | | * @param prio how important is this task? | |
| * @param prerequisite_task run this task after the task with the given | | | |
| * task identifier completes (and any of our other | | | |
| * conditions, such as delay, read or write-readiness | | | |
| * are satisfied). Use GNUNET_SCHEDULER_NO_TASK to not have any dep | | | |
| endency | | | |
| * on completion of other tasks. | | | |
| * @param delay how long should we wait? Use GNUNET_TIME_UNIT_FOREVER_REL f
or "forever", | | * @param delay how long should we wait? Use GNUNET_TIME_UNIT_FOREVER_REL f
or "forever", | |
| * which means that the task will only be run after we receive SIGTE
RM | | * which means that the task will only be run after we receive SIGTE
RM | |
| * @param rs set of file descriptors we want to read (can be NULL) | | * @param rs set of file descriptors we want to read (can be NULL) | |
| * @param ws set of file descriptors we want to write (can be NULL) | | * @param ws set of file descriptors we want to write (can be NULL) | |
| * @param task main function of the task | | * @param task main function of the task | |
| * @param task_cls closure of task | | * @param task_cls closure of task | |
| * @return unique task identifier for the job | | * @return unique task identifier for the job | |
| * only valid until "task" is started! | | * only valid until "task" is started! | |
| */ | | */ | |
| GNUNET_SCHEDULER_TaskIdentifier | | GNUNET_SCHEDULER_TaskIdentifier | |
| GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio, | | GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio, | |
|
| GNUNET_SCHEDULER_TaskIdentifier prerequisite_t
ask, | | | |
| struct GNUNET_TIME_Relative delay, | | struct GNUNET_TIME_Relative delay, | |
| const struct GNUNET_NETWORK_FDSet *rs, | | const struct GNUNET_NETWORK_FDSet *rs, | |
| const struct GNUNET_NETWORK_FDSet *ws, | | const struct GNUNET_NETWORK_FDSet *ws, | |
| GNUNET_SCHEDULER_Task task, void *task_cls); | | GNUNET_SCHEDULER_Task task, void *task_cls); | |
| | | | |
| /** | | /** | |
| * Sets the select function to use in the scheduler (scheduler_select). | | * Sets the select function to use in the scheduler (scheduler_select). | |
| * | | * | |
| * @param new_select new select function to use (NULL to reset to default) | | * @param new_select new select function to use (NULL to reset to default) | |
| * @param new_select_cls closure for 'new_select' | | * @param new_select_cls closure for 'new_select' | |
| | | | |
End of changes. 5 change blocks. |
| 30 lines changed or deleted | | 29 lines changed or added | |
|
| gnunet_server_lib.h | | gnunet_server_lib.h | |
| | | | |
| skipping to change at line 63 | | skipping to change at line 63 | |
| * @brief handle for a server | | * @brief handle for a server | |
| */ | | */ | |
| struct GNUNET_SERVER_Handle; | | struct GNUNET_SERVER_Handle; | |
| | | | |
| /** | | /** | |
| * @brief opaque handle for a client of the server | | * @brief opaque handle for a client of the server | |
| */ | | */ | |
| struct GNUNET_SERVER_Client; | | struct GNUNET_SERVER_Client; | |
| | | | |
| /** | | /** | |
|
| | | * @brief opaque handle server returns for aborting transmission to a clien | |
| | | t. | |
| | | */ | |
| | | struct GNUNET_SERVER_TransmitHandle; | |
| | | | |
| | | /** | |
| * Functions with this signature are called whenever a message is | | * Functions with this signature are called whenever a message is | |
| * received. | | * received. | |
| * | | * | |
| * @param cls closure | | * @param cls closure | |
| * @param client identification of the client | | * @param client identification of the client | |
| * @param message the actual message | | * @param message the actual message | |
| */ | | */ | |
| typedef void (*GNUNET_SERVER_MessageCallback) (void *cls, | | typedef void (*GNUNET_SERVER_MessageCallback) (void *cls, | |
| struct GNUNET_SERVER_Client
* | | struct GNUNET_SERVER_Client
* | |
| client, | | client, | |
| | | | |
| skipping to change at line 147 | | skipping to change at line 152 | |
| * (typically, "port" already in use) | | * (typically, "port" already in use) | |
| */ | | */ | |
| struct GNUNET_SERVER_Handle * | | struct GNUNET_SERVER_Handle * | |
| GNUNET_SERVER_create (GNUNET_CONNECTION_AccessCheck access, void *access_cl
s, | | GNUNET_SERVER_create (GNUNET_CONNECTION_AccessCheck access, void *access_cl
s, | |
| struct sockaddr *const *serverAddr, | | struct sockaddr *const *serverAddr, | |
| const socklen_t * socklen, | | const socklen_t * socklen, | |
| struct GNUNET_TIME_Relative idle_timeout, | | struct GNUNET_TIME_Relative idle_timeout, | |
| int require_found); | | int require_found); | |
| | | | |
| /** | | /** | |
|
| | | * Stop the listen socket and get ready to shutdown the server | |
| | | * once only 'monitor' clients are left. | |
| | | * | |
| | | * @param server server to stop listening on | |
| | | */ | |
| | | void | |
| | | GNUNET_SERVER_stop_listening (struct GNUNET_SERVER_Handle *server); | |
| | | | |
| | | /** | |
| * Free resources held by this server. | | * Free resources held by this server. | |
| * | | * | |
|
| * @param s server to destroy | | * @param server server to destroy | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_SERVER_destroy (struct GNUNET_SERVER_Handle *s); | | GNUNET_SERVER_destroy (struct GNUNET_SERVER_Handle *server); | |
| | | | |
| /** | | /** | |
| * Add additional handlers to an existing server. | | * Add additional handlers to an existing server. | |
| * | | * | |
| * @param server the server to add handlers to | | * @param server the server to add handlers to | |
| * @param handlers array of message handlers for | | * @param handlers array of message handlers for | |
| * incoming messages; the last entry must | | * incoming messages; the last entry must | |
| * have "NULL" for the "callback"; multiple | | * have "NULL" for the "callback"; multiple | |
| * entries for the same type are allowed, | | * entries for the same type are allowed, | |
| * they will be called in order of occurence. | | * they will be called in order of occurence. | |
| | | | |
| skipping to change at line 184 | | skipping to change at line 198 | |
| * a message of the given size to the given client. | | * a message of the given size to the given client. | |
| * | | * | |
| * @param client client to transmit message to | | * @param client client to transmit message to | |
| * @param size requested amount of buffer space | | * @param size requested amount of buffer space | |
| * @param timeout after how long should we give up (and call | | * @param timeout after how long should we give up (and call | |
| * notify with buf NULL and size 0)? | | * notify with buf NULL and size 0)? | |
| * @param callback function to call when space is available | | * @param callback function to call when space is available | |
| * @param callback_cls closure for callback | | * @param callback_cls closure for callback | |
| * @return non-NULL if the notify callback was queued; can be used | | * @return non-NULL if the notify callback was queued; can be used | |
| * to cancel the request using | | * to cancel the request using | |
|
| * GNUNET_CONNECTION_notify_transmit_ready_cancel. | | * GNUNET_SERVER_notify_transmit_ready_cancel. | |
| * NULL if we are already going to notify someone else (busy) | | * NULL if we are already going to notify someone else (busy) | |
| */ | | */ | |
|
| struct GNUNET_CONNECTION_TransmitHandle * | | struct GNUNET_SERVER_TransmitHandle * | |
| GNUNET_SERVER_notify_transmit_ready (struct GNUNET_SERVER_Client *client, | | GNUNET_SERVER_notify_transmit_ready (struct GNUNET_SERVER_Client *client, | |
| size_t size, | | size_t size, | |
| struct GNUNET_TIME_Relative timeout, | | struct GNUNET_TIME_Relative timeout, | |
| GNUNET_CONNECTION_TransmitReadyNotify | | GNUNET_CONNECTION_TransmitReadyNotify | |
| callback, void *callback_cls); | | callback, void *callback_cls); | |
| | | | |
| /** | | /** | |
|
| | | * Abort transmission request. | |
| | | * | |
| | | * @param th request to abort | |
| | | */ | |
| | | void | |
| | | GNUNET_SERVER_notify_transmit_ready_cancel (struct GNUNET_SERVER_TransmitHa | |
| | | ndle *th); | |
| | | | |
| | | /** | |
| | | * Set the 'monitor' flag on this client. Clients which have been | |
| | | * marked as 'monitors' won't prevent the server from shutting down | |
| | | * once 'GNUNET_SERVER_stop_listening' has been invoked. The idea is | |
| | | * that for "normal" clients we likely want to allow them to process | |
| | | * their requests; however, monitor-clients are likely to 'never' | |
| | | * disconnect during shutdown and thus will not be considered when | |
| | | * determining if the server should continue to exist after | |
| | | * 'GNUNET_SERVER_destroy' has been called. | |
| | | * | |
| | | * @param client the client to set the 'monitor' flag on | |
| | | */ | |
| | | void | |
| | | GNUNET_SERVER_client_mark_monitor (struct GNUNET_SERVER_Client *client); | |
| | | | |
| | | /** | |
| * Set the persistent flag on this client, used to setup client connection | | * Set the persistent flag on this client, used to setup client connection | |
| * to only be killed when the service it's connected to is actually dead. | | * to only be killed when the service it's connected to is actually dead. | |
| * | | * | |
| * @param client the client to set the persistent flag on | | * @param client the client to set the persistent flag on | |
| */ | | */ | |
| void | | void | |
| GNUNET_SERVER_client_persist_ (struct GNUNET_SERVER_Client *client); | | GNUNET_SERVER_client_persist_ (struct GNUNET_SERVER_Client *client); | |
| | | | |
| /** | | /** | |
| * Resume receiving from this client, we are done processing the | | * Resume receiving from this client, we are done processing the | |
| | | | |
| skipping to change at line 231 | | skipping to change at line 268 | |
| * times out or activity happens on the socket). | | * times out or activity happens on the socket). | |
| * | | * | |
| * @param client the client to update | | * @param client the client to update | |
| * @param timeout new timeout for activities on the socket | | * @param timeout new timeout for activities on the socket | |
| */ | | */ | |
| void | | void | |
| GNUNET_SERVER_client_set_timeout (struct GNUNET_SERVER_Client *client, | | GNUNET_SERVER_client_set_timeout (struct GNUNET_SERVER_Client *client, | |
| struct GNUNET_TIME_Relative timeout); | | struct GNUNET_TIME_Relative timeout); | |
| | | | |
| /** | | /** | |
|
| * Set if a client should finish a pending write when disconnecting. | | | |
| */ | | | |
| void | | | |
| GNUNET_SERVER_client_set_finish_pending_write (struct GNUNET_SERVER_Client | | | |
| *client, | | | |
| int finish); | | | |
| | | | |
| /** | | | |
| * Disable the warning the server issues if a message is not acknowledged | | * Disable the warning the server issues if a message is not acknowledged | |
| * in a timely fashion. Use this call if a client is intentionally delayed | | * in a timely fashion. Use this call if a client is intentionally delayed | |
| * for a while. Only applies to the current message. | | * for a while. Only applies to the current message. | |
| * | | * | |
| * @param client client for which to disable the warning | | * @param client client for which to disable the warning | |
| */ | | */ | |
| void | | void | |
| GNUNET_SERVER_disable_receive_done_warning (struct GNUNET_SERVER_Client | | GNUNET_SERVER_disable_receive_done_warning (struct GNUNET_SERVER_Client | |
| *client); | | *client); | |
| | | | |
| | | | |
| skipping to change at line 372 | | skipping to change at line 402 | |
| * This is the same as returning GNUNET_SYSERR from a message | | * This is the same as returning GNUNET_SYSERR from a message | |
| * handler, except that it allows dropping of a client even | | * handler, except that it allows dropping of a client even | |
| * when not handling a message from that client. | | * when not handling a message from that client. | |
| * | | * | |
| * @param client the client to disconnect from | | * @param client the client to disconnect from | |
| */ | | */ | |
| void | | void | |
| GNUNET_SERVER_client_disconnect (struct GNUNET_SERVER_Client *client); | | GNUNET_SERVER_client_disconnect (struct GNUNET_SERVER_Client *client); | |
| | | | |
| /** | | /** | |
|
| * Configure this server's connections to continue handling client | | | |
| * requests as usual even after we get a shutdown signal. The change | | | |
| * only applies to clients that connect to the server from the outside | | | |
| * using TCP after this call. Clients managed previously or those | | | |
| * added using GNUNET_SERVER_connect_socket and | | | |
| * GNUNET_SERVER_connect_callback are not affected by this option. | | | |
| * | | | |
| * @param h server handle | | | |
| * @param do_ignore GNUNET_YES to ignore, GNUNET_NO to restore default | | | |
| */ | | | |
| void | | | |
| GNUNET_SERVER_ignore_shutdown (struct GNUNET_SERVER_Handle *h, int do_ignor | | | |
| e); | | | |
| | | | |
| /** | | | |
| * Disable the "CORK" feature for communication with the given client, | | * Disable the "CORK" feature for communication with the given client, | |
| * forcing the OS to immediately flush the buffer on transmission | | * forcing the OS to immediately flush the buffer on transmission | |
| * instead of potentially buffering multiple messages. | | * instead of potentially buffering multiple messages. | |
| * | | * | |
| * @param client handle to the client | | * @param client handle to the client | |
| * @return GNUNET_OK on success | | * @return GNUNET_OK on success | |
| */ | | */ | |
| int | | int | |
| GNUNET_SERVER_client_disable_corking (struct GNUNET_SERVER_Client *client); | | GNUNET_SERVER_client_disable_corking (struct GNUNET_SERVER_Client *client); | |
| | | | |
| | | | |
| skipping to change at line 555 | | skipping to change at line 571 | |
| | | | |
| /** | | /** | |
| * Handle to a message stream tokenizer. | | * Handle to a message stream tokenizer. | |
| */ | | */ | |
| struct GNUNET_SERVER_MessageStreamTokenizer; | | struct GNUNET_SERVER_MessageStreamTokenizer; | |
| | | | |
| /** | | /** | |
| * Functions with this signature are called whenever a | | * Functions with this signature are called whenever a | |
| * complete message is received by the tokenizer. | | * complete message is received by the tokenizer. | |
| * | | * | |
|
| | | * Do not call GNUNET_SERVER_mst_destroy in callback | |
| | | * | |
| * @param cls closure | | * @param cls closure | |
| * @param client identification of the client | | * @param client identification of the client | |
| * @param message the actual message | | * @param message the actual message | |
|
| | | * | |
| | | * @return GNUNET_OK on success, GNUNET_SYSERR to stop further processing | |
| */ | | */ | |
|
| typedef void (*GNUNET_SERVER_MessageTokenizerCallback) (void *cls, void *cl
ient, | | typedef int (*GNUNET_SERVER_MessageTokenizerCallback) (void *cls, void *cli
ent, | |
| const struct | | const struct | |
| GNUNET_MessageHeade
r * | | GNUNET_MessageHeade
r * | |
| message); | | message); | |
| | | | |
| /** | | /** | |
| * Create a message stream tokenizer. | | * Create a message stream tokenizer. | |
| * | | * | |
| * @param cb function to call on completed messages | | * @param cb function to call on completed messages | |
| * @param cb_cls closure for cb | | * @param cb_cls closure for cb | |
| * @return handle to tokenizer | | * @return handle to tokenizer | |
| | | | |
End of changes. 12 change blocks. |
| 28 lines changed or deleted | | 48 lines changed or added | |
|
| gnunet_service_lib.h | | gnunet_service_lib.h | |
| | | | |
| skipping to change at line 45 | | skipping to change at line 45 | |
| #endif | | #endif | |
| #endif | | #endif | |
| | | | |
| #include "gnunet_configuration_lib.h" | | #include "gnunet_configuration_lib.h" | |
| #include "gnunet_server_lib.h" | | #include "gnunet_server_lib.h" | |
| | | | |
| /** | | /** | |
| * Get the list of addresses that a server for the given service | | * Get the list of addresses that a server for the given service | |
| * should bind to. | | * should bind to. | |
| * | | * | |
|
| * @param serviceName name of the service | | * @param service_name name of the service | |
| * @param cfg configuration (which specifies the addresses) | | * @param cfg configuration (which specifies the addresses) | |
| * @param addrs set (call by reference) to an array of pointers to the | | * @param addrs set (call by reference) to an array of pointers to the | |
| * addresses the server should bind to and listen on; the | | * addresses the server should bind to and listen on; the | |
| * array will be NULL-terminated (on success) | | * array will be NULL-terminated (on success) | |
| * @param addr_lens set (call by reference) to an array of the lengths | | * @param addr_lens set (call by reference) to an array of the lengths | |
| * of the respective 'struct sockaddr' struct in the 'addrs' | | * of the respective 'struct sockaddr' struct in the 'addrs' | |
| * array (on success) | | * array (on success) | |
| * @return number of addresses found on success, | | * @return number of addresses found on success, | |
| * GNUNET_SYSERR if the configuration | | * GNUNET_SYSERR if the configuration | |
| * did not specify reasonable finding information or | | * did not specify reasonable finding information or | |
| * if it specified a hostname that could not be resolved; | | * if it specified a hostname that could not be resolved; | |
| * GNUNET_NO if the number of addresses configured is | | * GNUNET_NO if the number of addresses configured is | |
| * zero (in this case, '*addrs' and '*addr_lens' will be | | * zero (in this case, '*addrs' and '*addr_lens' will be | |
| * set to NULL). | | * set to NULL). | |
| */ | | */ | |
| int | | int | |
|
| GNUNET_SERVICE_get_server_addresses (const char *serviceName, | | GNUNET_SERVICE_get_server_addresses (const char *service_name, | |
| const struct GNUNET_CONFIGURATION_Hand
le | | const struct GNUNET_CONFIGURATION_Hand
le | |
| *cfg, struct sockaddr ***addrs, | | *cfg, struct sockaddr ***addrs, | |
| socklen_t ** addr_lens); | | socklen_t ** addr_lens); | |
| | | | |
| /** | | /** | |
| * Function called by the service's run | | * Function called by the service's run | |
| * method to run service-specific setup code. | | * method to run service-specific setup code. | |
| * | | * | |
| * @param cls closure | | * @param cls closure | |
| * @param server the initialized server | | * @param server the initialized server | |
| | | | |
| skipping to change at line 85 | | skipping to change at line 85 | |
| typedef void (*GNUNET_SERVICE_Main) (void *cls, | | typedef void (*GNUNET_SERVICE_Main) (void *cls, | |
| struct GNUNET_SERVER_Handle * server, | | struct GNUNET_SERVER_Handle * server, | |
| const struct GNUNET_CONFIGURATION_Hand
le * | | const struct GNUNET_CONFIGURATION_Hand
le * | |
| cfg); | | cfg); | |
| | | | |
| /** | | /** | |
| * Options for the service (bitmask). | | * Options for the service (bitmask). | |
| */ | | */ | |
| enum GNUNET_SERVICE_Options | | enum GNUNET_SERVICE_Options | |
| { | | { | |
|
| /** | | /** | |
| * Use defaults. | | * Use defaults. | |
| */ | | */ | |
| GNUNET_SERVICE_OPTION_NONE = 0, | | GNUNET_SERVICE_OPTION_NONE = 0, | |
| | | | |
|
| /** | | /** | |
| * Do not trigger server shutdown on signals, allow for the user | | * Do not trigger server shutdown on signals, allow for the user | |
| * to terminate the server explicitly when needed. | | * to terminate the server explicitly when needed. | |
| */ | | */ | |
| GNUNET_SERVICE_OPTION_MANUAL_SHUTDOWN = 1 | | GNUNET_SERVICE_OPTION_MANUAL_SHUTDOWN = 1, | |
| | | | |
| | | /** | |
| | | * Trigger a SOFT server shutdown on signals, allowing active | |
| | | * non-monitor clients to complete their transactions. | |
| | | */ | |
| | | GNUNET_SERVICE_OPTION_SOFT_SHUTDOWN = 2 | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * Run a standard GNUnet service startup sequence (initialize loggers | | * Run a standard GNUnet service startup sequence (initialize loggers | |
| * and configuration, parse options). | | * and configuration, parse options). | |
| * | | * | |
| * @param argc number of command line arguments | | * @param argc number of command line arguments | |
| * @param argv command line arguments | | * @param argv command line arguments | |
|
| * @param serviceName our service name | | * @param service_name our service name | |
| * @param opt service options | | * @param options service options | |
| * @param task main task of the service | | * @param task main task of the service | |
| * @param task_cls closure for task | | * @param task_cls closure for task | |
| * @return GNUNET_SYSERR on error, GNUNET_OK | | * @return GNUNET_SYSERR on error, GNUNET_OK | |
| * if we shutdown nicely | | * if we shutdown nicely | |
| */ | | */ | |
| int | | int | |
|
| GNUNET_SERVICE_run (int argc, char *const *argv, const char *serviceName, | | GNUNET_SERVICE_run (int argc, char *const *argv, const char *service_name, | |
| enum GNUNET_SERVICE_Options opt, GNUNET_SERVICE_Main ta | | enum GNUNET_SERVICE_Options options, GNUNET_SERVICE_Mai | |
| sk, | | n task, | |
| void *task_cls); | | void *task_cls); | |
| | | | |
|
| | | /** | |
| | | * Opaque handle for a service. | |
| | | */ | |
| struct GNUNET_SERVICE_Context; | | struct GNUNET_SERVICE_Context; | |
| | | | |
| /** | | /** | |
| * Run a service startup sequence within an existing | | * Run a service startup sequence within an existing | |
| * initialized system. | | * initialized system. | |
| * | | * | |
|
| * @param serviceName our service name | | * @param service_name our service name | |
| * @param cfg configuration to use | | * @param cfg configuration to use | |
|
| | | * @param options service options | |
| * @return NULL on error, service handle | | * @return NULL on error, service handle | |
| */ | | */ | |
| struct GNUNET_SERVICE_Context * | | struct GNUNET_SERVICE_Context * | |
|
| GNUNET_SERVICE_start (const char *serviceName, | | GNUNET_SERVICE_start (const char *service_name, | |
| const struct GNUNET_CONFIGURATION_Handle *cfg); | | const struct GNUNET_CONFIGURATION_Handle *cfg, | |
| | | enum GNUNET_SERVICE_Options options); | |
| | | | |
| /** | | /** | |
| * Obtain the server used by a service. Note that the server must NOT | | * Obtain the server used by a service. Note that the server must NOT | |
| * be destroyed by the caller. | | * be destroyed by the caller. | |
| * | | * | |
| * @param ctx the service context returned from the start function | | * @param ctx the service context returned from the start function | |
| * @return handle to the server for this service, NULL if there is none | | * @return handle to the server for this service, NULL if there is none | |
| */ | | */ | |
| struct GNUNET_SERVER_Handle * | | struct GNUNET_SERVER_Handle * | |
| GNUNET_SERVICE_get_server (struct GNUNET_SERVICE_Context *ctx); | | GNUNET_SERVICE_get_server (struct GNUNET_SERVICE_Context *ctx); | |
| | | | |
End of changes. 10 change blocks. |
| 18 lines changed or deleted | | 29 lines changed or added | |
|
| gnunet_stream_lib.h | | gnunet_stream_lib.h | |
| | | | |
| skipping to change at line 65 | | skipping to change at line 65 | |
| | | | |
| /** | | /** | |
| * Other side has shutdown the socket for this type of operation | | * Other side has shutdown the socket for this type of operation | |
| * (reading/writing) | | * (reading/writing) | |
| */ | | */ | |
| GNUNET_STREAM_SHUTDOWN = 2, | | GNUNET_STREAM_SHUTDOWN = 2, | |
| | | | |
| /** | | /** | |
| * A serious error occured while operating on this stream | | * A serious error occured while operating on this stream | |
| */ | | */ | |
|
| GNUNET_STREAM_SYSERR = 3 | | GNUNET_STREAM_SYSERR = 3, | |
| | | | |
| | | /** | |
| | | * An error resulted in an unusable stream | |
| | | */ | |
| | | GNUNET_STREAM_BROKEN | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * Opaque handler for stream | | * Opaque handler for stream | |
| */ | | */ | |
| struct GNUNET_STREAM_Socket; | | struct GNUNET_STREAM_Socket; | |
| | | | |
| /** | | /** | |
| * Functions of this type will be called when a stream is established | | * Functions of this type will be called when a stream is established | |
| * | | * | |
| | | | |
| skipping to change at line 125 | | skipping to change at line 130 | |
| */ | | */ | |
| struct GNUNET_STREAM_Socket * | | struct GNUNET_STREAM_Socket * | |
| GNUNET_STREAM_open (const struct GNUNET_CONFIGURATION_Handle *cfg, | | GNUNET_STREAM_open (const struct GNUNET_CONFIGURATION_Handle *cfg, | |
| const struct GNUNET_PeerIdentity *target, | | const struct GNUNET_PeerIdentity *target, | |
| GNUNET_MESH_ApplicationType app_port, | | GNUNET_MESH_ApplicationType app_port, | |
| GNUNET_STREAM_OpenCallback open_cb, | | GNUNET_STREAM_OpenCallback open_cb, | |
| void *open_cb_cls, | | void *open_cb_cls, | |
| ...); | | ...); | |
| | | | |
| /** | | /** | |
|
| * Shutdown the stream for reading or writing (man 2 shutdown). | | * Handle for shutdown | |
| | | */ | |
| | | struct GNUNET_STREAM_ShutdownHandle; | |
| | | | |
| | | /** | |
| | | * Completion callback for shutdown | |
| | | * | |
| | | * @param cls the closure from GNUNET_STREAM_shutdown call | |
| | | * @param operation the operation that was shutdown (SHUT_RD, SHUT_WR, | |
| | | * SHUT_RDWR) | |
| | | */ | |
| | | typedef void (*GNUNET_STREAM_ShutdownCompletion) (void *cls, | |
| | | int operation); | |
| | | | |
| | | /** | |
| | | * Shutdown the stream for reading or writing (similar to man 2 shutdown). | |
| * | | * | |
| * @param socket the stream socket | | * @param socket the stream socket | |
|
| * @param how SHUT_RD, SHUT_WR or SHUT_RDWR | | * @param operation SHUT_RD, SHUT_WR or SHUT_RDWR | |
| | | * @param completion_cb the callback that will be called upon successful | |
| | | * shutdown of given operation | |
| | | * @param completion_cls the closure for the completion callback | |
| | | * @return the shutdown handle; NULL in case of any error | |
| */ | | */ | |
|
| void | | struct GNUNET_STREAM_ShutdownHandle * | |
| GNUNET_STREAM_shutdown (struct GNUNET_STREAM_Socket *socket, | | GNUNET_STREAM_shutdown (struct GNUNET_STREAM_Socket *socket, | |
|
| int how); | | int operation, | |
| | | GNUNET_STREAM_ShutdownCompletion completion_cb, | |
| | | void *completion_cls); | |
| | | | |
| /** | | /** | |
|
| * Closes the stream | | * Cancels a pending shutdown | |
| | | * | |
| | | * @param handle the shutdown handle returned from GNUNET_STREAM_shutdown | |
| | | */ | |
| | | void | |
| | | GNUNET_STREAM_shutdown_cancel (struct GNUNET_STREAM_ShutdownHandle *handle) | |
| | | ; | |
| | | | |
| | | /** | |
| | | * Closes the stream and frees the associated state. The stream should be | |
| | | * shutdown before closing. | |
| * | | * | |
| * @param socket the stream socket | | * @param socket the stream socket | |
| */ | | */ | |
| void | | void | |
| GNUNET_STREAM_close (struct GNUNET_STREAM_Socket *socket); | | GNUNET_STREAM_close (struct GNUNET_STREAM_Socket *socket); | |
| | | | |
| /** | | /** | |
| * Functions of this type are called upon new stream connection from other
peers | | * Functions of this type are called upon new stream connection from other
peers | |
| * | | * | |
| * @param cls the closure from GNUNET_STREAM_listen | | * @param cls the closure from GNUNET_STREAM_listen | |
| | | | |
| skipping to change at line 181 | | skipping to change at line 216 | |
| */ | | */ | |
| struct GNUNET_STREAM_ListenSocket * | | struct GNUNET_STREAM_ListenSocket * | |
| GNUNET_STREAM_listen (const struct GNUNET_CONFIGURATION_Handle *cfg, | | GNUNET_STREAM_listen (const struct GNUNET_CONFIGURATION_Handle *cfg, | |
| GNUNET_MESH_ApplicationType app_port, | | GNUNET_MESH_ApplicationType app_port, | |
| GNUNET_STREAM_ListenCallback listen_cb, | | GNUNET_STREAM_ListenCallback listen_cb, | |
| void *listen_cb_cls); | | void *listen_cb_cls); | |
| | | | |
| /** | | /** | |
| * Closes the listen socket | | * Closes the listen socket | |
| * | | * | |
|
| * @param socket the listen socket | | * @param lsocket the listen socket | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_STREAM_listen_close (struct GNUNET_STREAM_ListenSocket *socket); | | GNUNET_STREAM_listen_close (struct GNUNET_STREAM_ListenSocket *lsocket); | |
| | | | |
| /** | | /** | |
| * Functions of this signature are called whenever writing operations | | * Functions of this signature are called whenever writing operations | |
| * on a stream are executed | | * on a stream are executed | |
| * | | * | |
| * @param cls the closure from GNUNET_STREAM_write | | * @param cls the closure from GNUNET_STREAM_write | |
| * @param status the status of the stream at the time this function is call
ed | | * @param status the status of the stream at the time this function is call
ed | |
| * @param size the number of bytes written | | * @param size the number of bytes written | |
| */ | | */ | |
| typedef void (*GNUNET_STREAM_CompletionContinuation) (void *cls, | | typedef void (*GNUNET_STREAM_CompletionContinuation) (void *cls, | |
| | | | |
| skipping to change at line 210 | | skipping to change at line 245 | |
| * Handle to cancel IO write operations. | | * Handle to cancel IO write operations. | |
| */ | | */ | |
| struct GNUNET_STREAM_IOWriteHandle; | | struct GNUNET_STREAM_IOWriteHandle; | |
| | | | |
| /** | | /** | |
| * Handle to cancel IO read operations. | | * Handle to cancel IO read operations. | |
| */ | | */ | |
| struct GNUNET_STREAM_IOReadHandle; | | struct GNUNET_STREAM_IOReadHandle; | |
| | | | |
| /** | | /** | |
|
| * Tries to write the given data to the stream | | * Tries to write the given data to the stream. The maximum size of data th | |
| | | at | |
| | | * can be written as part of a write operation is (64 * (64000 - sizeof (st | |
| | | ruct | |
| | | * GNUNET_STREAM_DataMessage))). If size is greater than this it is not an | |
| | | API | |
| | | * violation, however only the said number of maximum bytes will be written | |
| | | . | |
| * | | * | |
| * @param socket the socket representing a stream | | * @param socket the socket representing a stream | |
| * @param data the data buffer from where the data is written into the stre
am | | * @param data the data buffer from where the data is written into the stre
am | |
| * @param size the number of bytes to be written from the data buffer | | * @param size the number of bytes to be written from the data buffer | |
| * @param timeout the timeout period | | * @param timeout the timeout period | |
|
| * @param write_cont the function to call upon writing some bytes into the | | * @param write_cont the function to call upon writing some bytes into the | |
| stream | | * stream | |
| * @param write_cont_cls the closure | | * @param write_cont_cls the closure | |
|
| * @return handle to cancel the operation; NULL if a previous write is pend | | * | |
| ing | | * @return handle to cancel the operation; if a previous write is pending o | |
| | | r | |
| | | * the stream has been shutdown for this operation then write_con | |
| | | t is | |
| | | * immediately called and NULL is returned. | |
| */ | | */ | |
| struct GNUNET_STREAM_IOWriteHandle * | | struct GNUNET_STREAM_IOWriteHandle * | |
| GNUNET_STREAM_write (struct GNUNET_STREAM_Socket *socket, | | GNUNET_STREAM_write (struct GNUNET_STREAM_Socket *socket, | |
| const void *data, | | const void *data, | |
| size_t size, | | size_t size, | |
| struct GNUNET_TIME_Relative timeout, | | struct GNUNET_TIME_Relative timeout, | |
| GNUNET_STREAM_CompletionContinuation write_cont, | | GNUNET_STREAM_CompletionContinuation write_cont, | |
| void *write_cont_cls); | | void *write_cont_cls); | |
| | | | |
| /** | | /** | |
| * Functions of this signature are called whenever data is available from t
he | | * Functions of this signature are called whenever data is available from t
he | |
| * stream. | | * stream. | |
| * | | * | |
| * @param cls the closure from GNUNET_STREAM_read | | * @param cls the closure from GNUNET_STREAM_read | |
| * @param status the status of the stream at the time this function is call
ed | | * @param status the status of the stream at the time this function is call
ed | |
| * @param data traffic from the other side | | * @param data traffic from the other side | |
|
| * @param size the number of bytes available in data read | | * @param size the number of bytes available in data read; will be 0 on tim
eout | |
| * @return number of bytes of processed from 'data' (any data remaining sho
uld be | | * @return number of bytes of processed from 'data' (any data remaining sho
uld be | |
| * given to the next time the read processor is called). | | * given to the next time the read processor is called). | |
| */ | | */ | |
| typedef size_t (*GNUNET_STREAM_DataProcessor) (void *cls, | | typedef size_t (*GNUNET_STREAM_DataProcessor) (void *cls, | |
| enum GNUNET_STREAM_Status st
atus, | | enum GNUNET_STREAM_Status st
atus, | |
| const void *data, | | const void *data, | |
| size_t size); | | size_t size); | |
| | | | |
| /** | | /** | |
|
| * Tries to read data from the stream | | * Tries to read data from the stream. | |
| * | | * | |
| * @param socket the socket representing a stream | | * @param socket the socket representing a stream | |
| * @param timeout the timeout period | | * @param timeout the timeout period | |
| * @param proc function to call with data (once only) | | * @param proc function to call with data (once only) | |
| * @param proc_cls the closure for proc | | * @param proc_cls the closure for proc | |
|
| * @return handle to cancel the operation | | * | |
| | | * @return handle to cancel the operation; if the stream has been shutdown | |
| | | for | |
| | | * this type of opeartion then the DataProcessor is immediately | |
| | | * called with GNUNET_STREAM_SHUTDOWN as status and NULL if retur | |
| | | ned | |
| */ | | */ | |
| struct GNUNET_STREAM_IOReadHandle * | | struct GNUNET_STREAM_IOReadHandle * | |
| GNUNET_STREAM_read (struct GNUNET_STREAM_Socket *socket, | | GNUNET_STREAM_read (struct GNUNET_STREAM_Socket *socket, | |
| struct GNUNET_TIME_Relative timeout, | | struct GNUNET_TIME_Relative timeout, | |
| GNUNET_STREAM_DataProcessor proc, | | GNUNET_STREAM_DataProcessor proc, | |
| void *proc_cls); | | void *proc_cls); | |
| | | | |
| /** | | /** | |
|
| * Cancel pending write operation. | | * Cancels pending write operation. Also cancels packet retransmissions whi | |
| | | ch | |
| | | * may have resulted otherwise. | |
| | | * | |
| | | * CAUTION: Normally a write operation is considered successful if the data | |
| | | * given to it is sent and acknowledged by the receiver. As data is divided | |
| | | * into packets, it is possible that not all packets are received by the | |
| | | * receiver. Any missing packets are then retransmitted till the receiver | |
| | | * acknowledges all packets or until a timeout . During this scenario if th | |
| | | e | |
| | | * write operation is cancelled all such retransmissions are also | |
| | | * cancelled. This may leave the receiver's receive buffer incompletely fil | |
| | | led | |
| | | * as some missing packets are never retransmitted. So this operation shoul | |
| | | d be | |
| | | * used before shutting down transmission from our side or before closing t | |
| | | he | |
| | | * socket. | |
| * | | * | |
| * @param ioh handle to operation to cancel | | * @param ioh handle to operation to cancel | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_STREAM_io_write_cancel (struct GNUNET_STREAM_IOWriteHandle *ioh); | | GNUNET_STREAM_io_write_cancel (struct GNUNET_STREAM_IOWriteHandle *iowh); | |
| | | | |
| /** | | /** | |
| * Cancel pending read operation. | | * Cancel pending read operation. | |
| * | | * | |
| * @param ioh handle to operation to cancel | | * @param ioh handle to operation to cancel | |
| */ | | */ | |
| void | | void | |
|
| GNUNET_STREAM_io_read_cancel (struct GNUNET_STREAM_IOReadHandle *ioh); | | GNUNET_STREAM_io_read_cancel (struct GNUNET_STREAM_IOReadHandle *iorh); | |
| | | | |
| #if 0 | | #if 0 | |
| { | | { | |
| #endif | | #endif | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif /* STREAM_PROTOCOL_H */ | | #endif /* STREAM_PROTOCOL_H */ | |
| | | | |
End of changes. 17 change blocks. |
| 19 lines changed or deleted | | 88 lines changed or added | |
|
| gnunet_strings_lib.h | | gnunet_strings_lib.h | |
| | | | |
| skipping to change at line 67 | | skipping to change at line 67 | |
| * @return GNUNET_OK on success, GNUNET_SYSERR on error | | * @return GNUNET_OK on success, GNUNET_SYSERR on error | |
| */ | | */ | |
| int | | int | |
| GNUNET_STRINGS_fancy_size_to_bytes (const char *fancy_size, | | GNUNET_STRINGS_fancy_size_to_bytes (const char *fancy_size, | |
| unsigned long long *size); | | unsigned long long *size); | |
| | | | |
| /** | | /** | |
| * Convert a given fancy human-readable time to our internal | | * Convert a given fancy human-readable time to our internal | |
| * representation. | | * representation. | |
| * | | * | |
|
| * @param fancy_size human readable string (i.e. 1 minute) | | * @param fancy_time human readable string (i.e. 1 minute) | |
| * @param rtime set to the relative time | | * @param rtime set to the relative time | |
| * @return GNUNET_OK on success, GNUNET_SYSERR on error | | * @return GNUNET_OK on success, GNUNET_SYSERR on error | |
| */ | | */ | |
| int | | int | |
|
| GNUNET_STRINGS_fancy_time_to_relative (const char *fancy_size, | | GNUNET_STRINGS_fancy_time_to_relative (const char *fancy_time, | |
| struct GNUNET_TIME_Relative *rtime); | | struct GNUNET_TIME_Relative *rtime); | |
| | | | |
| /** | | /** | |
| * Convert a given filesize into a fancy human-readable format. | | * Convert a given filesize into a fancy human-readable format. | |
| * | | * | |
| * @param size number of bytes | | * @param size number of bytes | |
| * @return fancy representation of the size (possibly rounded) for humans | | * @return fancy representation of the size (possibly rounded) for humans | |
| */ | | */ | |
| char * | | char * | |
| GNUNET_STRINGS_byte_size_fancy (unsigned long long size); | | GNUNET_STRINGS_byte_size_fancy (unsigned long long size); | |
| | | | |
| skipping to change at line 121 | | skipping to change at line 121 | |
| * given in input to the given charset. | | * given in input to the given charset. | |
| | | | |
| * @return the converted string (0-terminated), | | * @return the converted string (0-terminated), | |
| * if conversion fails, a copy of the orignal | | * if conversion fails, a copy of the orignal | |
| * string is returned. | | * string is returned. | |
| */ | | */ | |
| char * | | char * | |
| GNUNET_STRINGS_from_utf8 (const char *input, size_t len, const char *charse
t); | | GNUNET_STRINGS_from_utf8 (const char *input, size_t len, const char *charse
t); | |
| | | | |
| /** | | /** | |
|
| | | * Convert the utf-8 input string to lowercase | |
| | | * Output needs to be allocated appropriately | |
| | | * | |
| | | * @param input input string | |
| | | * @param output output buffer | |
| | | */ | |
| | | void | |
| | | GNUNET_STRINGS_utf8_tolower(const char* input, char** output); | |
| | | | |
| | | /** | |
| | | * Convert the utf-8 input string to lowercase | |
| | | * Output needs to be allocated appropriately | |
| | | * | |
| | | * @param input input string | |
| | | * @param output output buffer | |
| | | */ | |
| | | void | |
| | | GNUNET_STRINGS_utf8_toupper(const char* input, char** output); | |
| | | | |
| | | /** | |
| * Complete filename (a la shell) from abbrevition. | | * Complete filename (a la shell) from abbrevition. | |
| * | | * | |
| * @param fil the name of the file, may contain ~/ or | | * @param fil the name of the file, may contain ~/ or | |
| * be relative to the current directory | | * be relative to the current directory | |
| * @return the full file name, | | * @return the full file name, | |
| * NULL is returned on error | | * NULL is returned on error | |
| */ | | */ | |
| char * | | char * | |
| GNUNET_STRINGS_filename_expand (const char *fil); | | GNUNET_STRINGS_filename_expand (const char *fil); | |
| | | | |
| | | | |
| skipping to change at line 206 | | skipping to change at line 226 | |
| * @param filename filename to extract basename from | | * @param filename filename to extract basename from | |
| * @return short (base) name of the file (that is, everything following the | | * @return short (base) name of the file (that is, everything following the | |
| * last directory separator in filename. If filename ends with a | | * last directory separator in filename. If filename ends with a | |
| * directory separator, the result will be a zero-length string. | | * directory separator, the result will be a zero-length string. | |
| * If filename has no directory separators, the result is filename | | * If filename has no directory separators, the result is filename | |
| * itself. | | * itself. | |
| */ | | */ | |
| const char * | | const char * | |
| GNUNET_STRINGS_get_short_name (const char *filename); | | GNUNET_STRINGS_get_short_name (const char *filename); | |
| | | | |
|
| | | /** | |
| | | * Convert binary data to ASCII encoding. The ASCII encoding is rather | |
| | | * GNUnet specific. It was chosen such that it only uses characters | |
| | | * in [0-9A-V], can be produced without complex arithmetics and uses a | |
| | | * small number of characters. The GNUnet encoding uses 103 characters. | |
| | | * Does not append 0-terminator, but returns a pointer to the place where | |
| | | * it should be placed, if needed. | |
| | | * | |
| | | * @param data data to encode | |
| | | * @param size size of data (in bytes) | |
| | | * @param out buffer to fill | |
| | | * @param out_size size of the buffer. Must be large enough to hold | |
| | | * ((size*8) + (((size*8) % 5) > 0 ? 5 - ((size*8) % 5) : 0)) / 5 | |
| | | * @return pointer to the next byte in 'out' or NULL on error. | |
| | | */ | |
| | | char * | |
| | | GNUNET_STRINGS_data_to_string (const unsigned char *data, size_t size, | |
| | | char *out, size_t out_size); | |
| | | | |
| | | /** | |
| | | * Convert ASCII encoding back to data | |
| | | * out_size must match exactly the size of the data before it was encoded. | |
| | | * | |
| | | * @param enc the encoding | |
| | | * @param enclen number of characters in 'enc' (without 0-terminator, which | |
| | | can be missing) | |
| | | * @param out location where to store the decoded data | |
| | | * @param out_size sizeof the output buffer | |
| | | * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong enco | |
| | | ding | |
| | | */ | |
| | | int | |
| | | GNUNET_STRINGS_string_to_data (const char *enc, size_t enclen, | |
| | | unsigned char *out, size_t out_size); | |
| | | | |
| #if 0 /* keep Emacsens' auto-indent happy */ | | #if 0 /* keep Emacsens' auto-indent happy */ | |
| { | | { | |
| #endif | | #endif | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
|
| | | enum GNUNET_STRINGS_FilenameCheck | |
| | | { | |
| | | GNUNET_STRINGS_CHECK_EXISTS = 0x00000001, | |
| | | GNUNET_STRINGS_CHECK_IS_DIRECTORY = 0x00000002, | |
| | | GNUNET_STRINGS_CHECK_IS_LINK = 0x00000004, | |
| | | GNUNET_STRINGS_CHECK_IS_ABSOLUTE = 0x00000008 | |
| | | }; | |
| | | | |
| | | /** | |
| | | * Parse a path that might be an URI. | |
| | | * | |
| | | * @param path path to parse. Must be NULL-terminated. | |
| | | * @param scheme_part a pointer to 'char *' where a pointer to a string tha | |
| | | t | |
| | | * represents the URI scheme will be stored. Can be NULL. The string | |
| | | is | |
| | | * allocated by the function, and should be freed by GNUNET_free() w | |
| | | hen | |
| | | * it is no longer needed. | |
| | | * @param path_part a pointer to 'const char *' where a pointer to the path | |
| | | * part of the URI will be stored. Can be NULL. Points to the same b | |
| | | lock | |
| | | * of memory as 'path', and thus must not be freed. Might point to ' | |
| | | \0', | |
| | | * if path part is zero-length. | |
| | | * @return GNUNET_YES if it's an URI, GNUNET_NO otherwise. If 'path' is not | |
| | | * an URI, '* scheme_part' and '*path_part' will remain unchanged | |
| | | * (if they weren't NULL). | |
| | | */ | |
| | | int | |
| | | GNUNET_STRINGS_parse_uri (const char *path, char **scheme_part, | |
| | | const char **path_part); | |
| | | | |
| | | /** | |
| | | * Check whether filename is absolute or not, and if it's an URI | |
| | | * | |
| | | * @param filename filename to check | |
| | | * @param can_be_uri GNUNET_YES to check for being URI, GNUNET_NO - to | |
| | | * assume it's not URI | |
| | | * @param r_is_uri a pointer to an int that is set to GNUNET_YES if 'filena | |
| | | me' | |
| | | * is URI and to GNUNET_NO otherwise. Can be NULL. If 'can_be_uri' i | |
| | | s | |
| | | * not GNUNET_YES, *r_is_uri is set to GNUNET_NO. | |
| | | * @param r_uri_scheme a pointer to a char * that is set to a pointer to UR | |
| | | I scheme. | |
| | | * The string is allocated by the function, and should be freed with | |
| | | * GNUNET_free (). Can be NULL. | |
| | | * @return GNUNET_YES if 'filename' is absolute, GNUNET_NO otherwise. | |
| | | */ | |
| | | int | |
| | | GNUNET_STRINGS_path_is_absolute (const char *filename, | |
| | | int can_be_uri, | |
| | | int *r_is_uri, | |
| | | char **r_uri_scheme); | |
| | | | |
| | | /** | |
| | | * Perform checks on 'filename; | |
| | | * | |
| | | * @param filename file to check | |
| | | * @param checks checks to perform | |
| | | * @return GNUNET_YES if all checks pass, GNUNET_NO if at least one of them | |
| | | * fails, GNUNET_SYSERR when a check can't be performed | |
| | | */ | |
| | | int | |
| | | GNUNET_STRINGS_check_filename (const char *filename, | |
| | | enum GNUNET_STRINGS_FilenameCheck checks); | |
| | | | |
| | | /** | |
| | | * Tries to convert 'zt_addr' string to an IPv6 address. | |
| | | * The string is expected to have the format "[ABCD::01]:80". | |
| | | * | |
| | | * @param zt_addr 0-terminated string. May be mangled by the function. | |
| | | * @param addrlen length of zt_addr (not counting 0-terminator). | |
| | | * @param r_buf a buffer to fill. Initially gets filled with zeroes, | |
| | | * then its sin6_port, sin6_family and sin6_addr are set appropriate | |
| | | ly. | |
| | | * @return GNUNET_OK if conversion succeded. GNUNET_SYSERR otherwise, in wh | |
| | | ich | |
| | | * case the contents of r_buf are undefined. | |
| | | */ | |
| | | int | |
| | | GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr, | |
| | | uint16_t addrlen, | |
| | | struct sockaddr_in6 *r_buf); | |
| | | | |
| | | /** | |
| | | * Tries to convert 'zt_addr' string to an IPv4 address. | |
| | | * The string is expected to have the format "1.2.3.4:80". | |
| | | * | |
| | | * @param zt_addr 0-terminated string. May be mangled by the function. | |
| | | * @param addrlen length of zt_addr (not counting 0-terminator). | |
| | | * @param r_buf a buffer to fill. | |
| | | * @return GNUNET_OK if conversion succeded. GNUNET_SYSERR otherwise, in wh | |
| | | ich case | |
| | | * the contents of r_buf are undefined. | |
| | | */ | |
| | | int | |
| | | GNUNET_STRINGS_to_address_ipv4 (const char *zt_addr, | |
| | | uint16_t addrlen, | |
| | | struct sockaddr_in *r_buf); | |
| | | | |
| | | /** | |
| | | * Tries to convert 'addr' string to an IP (v4 or v6) address. | |
| | | * Will automatically decide whether to treat 'addr' as v4 or v6 address. | |
| | | * | |
| | | * @param addr a string, may not be 0-terminated. | |
| | | * @param addrlen number of bytes in addr (if addr is 0-terminated, | |
| | | * 0-terminator should not be counted towards addrlen). | |
| | | * @param r_buf a buffer to fill. | |
| | | * @return GNUNET_OK if conversion succeded. GNUNET_SYSERR otherwise, in wh | |
| | | ich | |
| | | * case the contents of r_buf are undefined. | |
| | | */ | |
| | | int | |
| | | GNUNET_STRINGS_to_address_ip (const char *addr, | |
| | | uint16_t addrlen, | |
| | | struct sockaddr_storage *r_buf); | |
| | | | |
| /* ifndef GNUNET_UTIL_STRING_H */ | | /* ifndef GNUNET_UTIL_STRING_H */ | |
| #endif | | #endif | |
| /* end of gnunet_util_string.h */ | | /* end of gnunet_util_string.h */ | |
| | | | |
End of changes. 5 change blocks. |
| 2 lines changed or deleted | | 176 lines changed or added | |
|
| gnunet_time_lib.h | | gnunet_time_lib.h | |
| | | | |
| skipping to change at line 92 | | skipping to change at line 92 | |
| /** | | /** | |
| * The actual value (in network byte order). | | * The actual value (in network byte order). | |
| */ | | */ | |
| uint64_t abs_value__ GNUNET_PACKED; | | uint64_t abs_value__ GNUNET_PACKED; | |
| }; | | }; | |
| GNUNET_NETWORK_STRUCT_END | | GNUNET_NETWORK_STRUCT_END | |
| | | | |
| /** | | /** | |
| * Relative time zero. | | * Relative time zero. | |
| */ | | */ | |
|
| #define GNUNET_TIME_UNIT_ZERO GNUNET_TIME_relative_get_zero() | | #define GNUNET_TIME_UNIT_ZERO GNUNET_TIME_relative_get_zero_() | |
| | | | |
| /** | | /** | |
| * Absolute time zero. | | * Absolute time zero. | |
| */ | | */ | |
|
| #define GNUNET_TIME_UNIT_ZERO_ABS GNUNET_TIME_absolute_get_zero() | | #define GNUNET_TIME_UNIT_ZERO_ABS GNUNET_TIME_absolute_get_zero_() | |
| | | | |
| /** | | /** | |
| * One millisecond, our basic time unit. | | * One millisecond, our basic time unit. | |
| */ | | */ | |
|
| #define GNUNET_TIME_UNIT_MILLISECONDS GNUNET_TIME_relative_get_unit() | | #define GNUNET_TIME_UNIT_MILLISECONDS GNUNET_TIME_relative_get_unit_() | |
| | | | |
| /** | | /** | |
| * One second. | | * One second. | |
| */ | | */ | |
|
| #define GNUNET_TIME_UNIT_SECONDS GNUNET_TIME_relative_multiply(GNUNET_TIME_
UNIT_MILLISECONDS, 1000) | | #define GNUNET_TIME_UNIT_SECONDS GNUNET_TIME_relative_get_second_() | |
| | | | |
| /** | | /** | |
| * One minute. | | * One minute. | |
| */ | | */ | |
|
| #define GNUNET_TIME_UNIT_MINUTES GNUNET_TIME_relative_multiply(GNUNET_TIME_
UNIT_SECONDS, 60) | | #define GNUNET_TIME_UNIT_MINUTES GNUNET_TIME_relative_get_minute_() | |
| | | | |
| /** | | /** | |
| * One hour. | | * One hour. | |
| */ | | */ | |
|
| #define GNUNET_TIME_UNIT_HOURS GNUNET_TIME_relative_multiply(GNUNET_TIME_
UNIT_MINUTES, 60) | | #define GNUNET_TIME_UNIT_HOURS GNUNET_TIME_relative_get_hour_() | |
| | | | |
| /** | | /** | |
| * One day. | | * One day. | |
| */ | | */ | |
| #define GNUNET_TIME_UNIT_DAYS GNUNET_TIME_relative_multiply(GNUNET_TIME_
UNIT_HOURS, 24) | | #define GNUNET_TIME_UNIT_DAYS GNUNET_TIME_relative_multiply(GNUNET_TIME_
UNIT_HOURS, 24) | |
| | | | |
| /** | | /** | |
| * One week. | | * One week. | |
| */ | | */ | |
| #define GNUNET_TIME_UNIT_WEEKS GNUNET_TIME_relative_multiply(GNUNET_TIME_
UNIT_DAYS, 7) | | #define GNUNET_TIME_UNIT_WEEKS GNUNET_TIME_relative_multiply(GNUNET_TIME_
UNIT_DAYS, 7) | |
| | | | |
| skipping to change at line 143 | | skipping to change at line 143 | |
| | | | |
| /** | | /** | |
| * One year (365 days). | | * One year (365 days). | |
| */ | | */ | |
| #define GNUNET_TIME_UNIT_YEARS GNUNET_TIME_relative_multiply(GNUNET_TIME_
UNIT_DAYS, 365) | | #define GNUNET_TIME_UNIT_YEARS GNUNET_TIME_relative_multiply(GNUNET_TIME_
UNIT_DAYS, 365) | |
| | | | |
| /** | | /** | |
| * Constant used to specify "forever". This constant | | * Constant used to specify "forever". This constant | |
| * will be treated specially in all time operations. | | * will be treated specially in all time operations. | |
| */ | | */ | |
|
| #define GNUNET_TIME_UNIT_FOREVER_REL GNUNET_TIME_relative_get_forever () | | #define GNUNET_TIME_UNIT_FOREVER_REL GNUNET_TIME_relative_get_forever_ () | |
| | | | |
| /** | | /** | |
| * Constant used to specify "forever". This constant | | * Constant used to specify "forever". This constant | |
| * will be treated specially in all time operations. | | * will be treated specially in all time operations. | |
| */ | | */ | |
|
| #define GNUNET_TIME_UNIT_FOREVER_ABS GNUNET_TIME_absolute_get_forever () | | #define GNUNET_TIME_UNIT_FOREVER_ABS GNUNET_TIME_absolute_get_forever_ () | |
| | | | |
| /** | | /** | |
| * Return relative time of 0ms. | | * Return relative time of 0ms. | |
| */ | | */ | |
| struct GNUNET_TIME_Relative | | struct GNUNET_TIME_Relative | |
|
| GNUNET_TIME_relative_get_zero (void); | | GNUNET_TIME_relative_get_zero_ (void); | |
| | | | |
| /** | | /** | |
| * Return absolute time of 0ms. | | * Return absolute time of 0ms. | |
| */ | | */ | |
| struct GNUNET_TIME_Absolute | | struct GNUNET_TIME_Absolute | |
|
| GNUNET_TIME_absolute_get_zero (void); | | GNUNET_TIME_absolute_get_zero_ (void); | |
| | | | |
| /** | | /** | |
| * Return relative time of 1ms. | | * Return relative time of 1ms. | |
| */ | | */ | |
| struct GNUNET_TIME_Relative | | struct GNUNET_TIME_Relative | |
|
| GNUNET_TIME_relative_get_unit (void); | | GNUNET_TIME_relative_get_unit_ (void); | |
| | | | |
| | | /** | |
| | | * Return relative time of 1s. | |
| | | */ | |
| | | struct GNUNET_TIME_Relative | |
| | | GNUNET_TIME_relative_get_second_ (void); | |
| | | | |
| | | /** | |
| | | * Return relative time of 1 minute. | |
| | | */ | |
| | | struct GNUNET_TIME_Relative | |
| | | GNUNET_TIME_relative_get_minute_ (void); | |
| | | | |
| | | /** | |
| | | * Return relative time of 1 hour. | |
| | | */ | |
| | | struct GNUNET_TIME_Relative | |
| | | GNUNET_TIME_relative_get_hour_ (void); | |
| | | | |
| /** | | /** | |
| * Return "forever". | | * Return "forever". | |
| */ | | */ | |
| struct GNUNET_TIME_Relative | | struct GNUNET_TIME_Relative | |
|
| GNUNET_TIME_relative_get_forever (void); | | GNUNET_TIME_relative_get_forever_ (void); | |
| | | | |
| /** | | /** | |
| * Return "forever". | | * Return "forever". | |
| */ | | */ | |
| struct GNUNET_TIME_Absolute | | struct GNUNET_TIME_Absolute | |
|
| GNUNET_TIME_absolute_get_forever (void); | | GNUNET_TIME_absolute_get_forever_ (void); | |
| | | | |
| /** | | /** | |
| * Get the current time. | | * Get the current time. | |
| * | | * | |
| * @return the current time | | * @return the current time | |
| */ | | */ | |
| struct GNUNET_TIME_Absolute | | struct GNUNET_TIME_Absolute | |
| GNUNET_TIME_absolute_get (void); | | GNUNET_TIME_absolute_get (void); | |
| | | | |
| /** | | /** | |
| | | | |
End of changes. 13 change blocks. |
| 13 lines changed or deleted | | 31 lines changed or added | |
|
| gnunet_transport_plugin.h | | gnunet_transport_plugin.h | |
| | | | |
| skipping to change at line 137 | | skipping to change at line 137 | |
| | | | |
| /** | | /** | |
| * Function that will be called to figure if an address is an loopback, | | * Function that will be called to figure if an address is an loopback, | |
| * LAN, WAN etc. address | | * LAN, WAN etc. address | |
| * | | * | |
| * @param cls closure | | * @param cls closure | |
| * @param addr binary address | | * @param addr binary address | |
| * @param addrlen length of the address | | * @param addrlen length of the address | |
| * @return ATS Information containing the network type | | * @return ATS Information containing the network type | |
| */ | | */ | |
|
| typedef const struct GNUNET_ATS_Information | | typedef struct GNUNET_ATS_Information | |
| (*GNUNET_TRANSPORT_AddressToType) (void *cls, | | (*GNUNET_TRANSPORT_AddressToType) (void *cls, | |
| const struct sockaddr *addr, | | const struct sockaddr *addr, | |
| size_t addrlen); | | size_t addrlen); | |
| | | | |
| /** | | /** | |
| * Function that will be called for each address the transport | | * Function that will be called for each address the transport | |
| * is aware that it might be reachable under. | | * is aware that it might be reachable under. | |
| * | | * | |
| * @param cls closure | | * @param cls closure | |
| * @param add_remove should the address added (YES) or removed (NO) from th
e | | * @param add_remove should the address added (YES) or removed (NO) from th
e | |
| | | | |
| skipping to change at line 216 | | skipping to change at line 216 | |
| */ | | */ | |
| void *cls; | | void *cls; | |
| | | | |
| /** | | /** | |
| * Handle for reporting statistics. | | * Handle for reporting statistics. | |
| */ | | */ | |
| struct GNUNET_STATISTICS_Handle *stats; | | struct GNUNET_STATISTICS_Handle *stats; | |
| | | | |
| /** | | /** | |
| * Function that should be called by the transport plugin | | * Function that should be called by the transport plugin | |
|
| * whenever a message is received. | | * whenever a message is received. If this field is "NULL", | |
| | | * the plugin should load in 'stub' mode and NOT fully | |
| | | * initialize and instead only return an API with the | |
| | | * 'address_pretty_printer', 'address_to_string' and | |
| | | * 'string_to_address' functions. | |
| */ | | */ | |
| GNUNET_TRANSPORT_PluginReceiveCallback receive; | | GNUNET_TRANSPORT_PluginReceiveCallback receive; | |
| | | | |
| /** | | /** | |
| * Function that returns our HELLO. | | * Function that returns our HELLO. | |
| */ | | */ | |
| GNUNET_TRANSPORT_GetHelloCallback get_our_hello; | | GNUNET_TRANSPORT_GetHelloCallback get_our_hello; | |
| | | | |
| /** | | /** | |
| * Function that must be called by each plugin to notify the | | * Function that must be called by each plugin to notify the | |
| | | | |
| skipping to change at line 304 | | skipping to change at line 308 | |
| * @param cont continuation to call once the message has | | * @param cont continuation to call once the message has | |
| * been transmitted (or if the transport is ready | | * been transmitted (or if the transport is ready | |
| * for the next transmission call; or if the | | * for the next transmission call; or if the | |
| * peer disconnected...); can be NULL | | * peer disconnected...); can be NULL | |
| * @param cont_cls closure for cont | | * @param cont_cls closure for cont | |
| * @return number of bytes used (on the physical network, with overheads); | | * @return number of bytes used (on the physical network, with overheads); | |
| * -1 on hard errors (i.e. address invalid); 0 is a legal value | | * -1 on hard errors (i.e. address invalid); 0 is a legal value | |
| * and does NOT mean that the message was not transmitted (DV) | | * and does NOT mean that the message was not transmitted (DV) | |
| */ | | */ | |
| typedef ssize_t (*GNUNET_TRANSPORT_TransmitFunction) (void *cls, | | typedef ssize_t (*GNUNET_TRANSPORT_TransmitFunction) (void *cls, | |
|
| struct Session *session, | | struct Session *sessio | |
| const char *msgbuf, size_t msgbuf_size, | | n, | |
| unsigned int priority, | | const char *msgbuf, si | |
| struct GNUNET_TIME_Relative to, | | ze_t msgbuf_size, | |
| GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls); | | unsigned int priority, | |
| | | struct GNUNET_TIME_Rel | |
| | | ative to, | |
| | | GNUNET_TRANSPORT_Trans | |
| | | mitContinuation cont, | |
| | | void *cont_cls); | |
| | | | |
| /** | | /** | |
| * Function that can be called to force a disconnect from the | | * Function that can be called to force a disconnect from the | |
| * specified neighbour. This should also cancel all previously | | * specified neighbour. This should also cancel all previously | |
| * scheduled transmissions. Obviously the transmission may have been | | * scheduled transmissions. Obviously the transmission may have been | |
| * partially completed already, which is OK. The plugin is supposed | | * partially completed already, which is OK. The plugin is supposed | |
| * to close the connection (if applicable) and no longer call the | | * to close the connection (if applicable) and no longer call the | |
| * transmit continuation(s). | | * transmit continuation(s). | |
| * | | * | |
| * Finally, plugin MUST NOT call the services's receive function to | | * Finally, plugin MUST NOT call the services's receive function to | |
| | | | |
| skipping to change at line 414 | | skipping to change at line 419 | |
| * @param cls closure | | * @param cls closure | |
| * @param addr binary address | | * @param addr binary address | |
| * @param addr_len length of the address | | * @param addr_len length of the address | |
| * @return string representing the same address | | * @return string representing the same address | |
| */ | | */ | |
| typedef const char *(*GNUNET_TRANSPORT_AddressToString) (void *cls, | | typedef const char *(*GNUNET_TRANSPORT_AddressToString) (void *cls, | |
| const void *addr, | | const void *addr, | |
| size_t addrlen); | | size_t addrlen); | |
| | | | |
| /** | | /** | |
|
| | | * Function called to convert a string address to | |
| | | * a binary address. | |
| | | * | |
| | | * @param cls closure ('struct Plugin*') | |
| | | * @param addr string address | |
| | | * @param addrlen length of the address | |
| | | * @param buf location to store the buffer | |
| | | * If the function returns GNUNET_SYSERR, its contents are undefined | |
| | | . | |
| | | * @param added length of created address | |
| | | * @return GNUNET_OK on success, GNUNET_SYSERR on failure | |
| | | */ | |
| | | typedef int (*GNUNET_TRANSPORT_StringToAddress) (void *cls, | |
| | | const char *addr, | |
| | | uint16_t addrlen, | |
| | | void **buf, | |
| | | size_t *added); | |
| | | | |
| | | /** | |
| * Each plugin is required to return a pointer to a struct of this | | * Each plugin is required to return a pointer to a struct of this | |
| * type as the return value from its entry point. | | * type as the return value from its entry point. | |
| */ | | */ | |
| struct GNUNET_TRANSPORT_PluginFunctions | | struct GNUNET_TRANSPORT_PluginFunctions | |
| { | | { | |
| | | | |
| /** | | /** | |
| * Closure for all of the callbacks. | | * Closure for all of the callbacks. | |
| */ | | */ | |
| void *cls; | | void *cls; | |
| | | | |
| skipping to change at line 466 | | skipping to change at line 489 | |
| */ | | */ | |
| GNUNET_TRANSPORT_CheckAddress check_address; | | GNUNET_TRANSPORT_CheckAddress check_address; | |
| | | | |
| /** | | /** | |
| * Function that will be called to convert a binary address | | * Function that will be called to convert a binary address | |
| * to a string (numeric conversion only). | | * to a string (numeric conversion only). | |
| */ | | */ | |
| GNUNET_TRANSPORT_AddressToString address_to_string; | | GNUNET_TRANSPORT_AddressToString address_to_string; | |
| | | | |
| /** | | /** | |
|
| | | * Function that will be called to convert a string address | |
| | | * to binary (numeric conversion only). | |
| | | */ | |
| | | GNUNET_TRANSPORT_StringToAddress string_to_address; | |
| | | | |
| | | /** | |
| * Function that will be called tell the plugin to create a session | | * Function that will be called tell the plugin to create a session | |
| * object | | * object | |
| */ | | */ | |
| GNUNET_TRANSPORT_CreateSession get_session; | | GNUNET_TRANSPORT_CreateSession get_session; | |
| }; | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 5 change blocks. |
| 7 lines changed or deleted | | 41 lines changed or added | |
|
| plibc.h | | plibc.h | |
| | | | |
| skipping to change at line 25 | | skipping to change at line 25 | |
| You should have received a copy of the GNU Lesser General Public | | You should have received a copy of the GNU Lesser General Public | |
| License along with this library; if not, write to the Free Softwa
re | | License along with this library; if not, write to the Free Softwa
re | |
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1
307 USA | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1
307 USA | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * @file include/plibc.h | | * @file include/plibc.h | |
| * @brief PlibC header | | * @brief PlibC header | |
| * @attention This file is usually not installed under Unix, | | * @attention This file is usually not installed under Unix, | |
| * so ship it with your application | | * so ship it with your application | |
|
| * @version $Revision$ | | * @version $Revision: 84 $ | |
| */ | | */ | |
| | | | |
| #ifndef _PLIBC_H_ | | #ifndef _PLIBC_H_ | |
| #define _PLIBC_H_ | | #define _PLIBC_H_ | |
| | | | |
| #ifndef SIGALRM | | #ifndef SIGALRM | |
| #define SIGALRM 14 | | #define SIGALRM 14 | |
| #endif | | #endif | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| | | | |
| skipping to change at line 339 | | skipping to change at line 339 | |
| #define SHUT_WR SD_SEND | | #define SHUT_WR SD_SEND | |
| #define SHUT_RD SD_RECEIVE | | #define SHUT_RD SD_RECEIVE | |
| #define SHUT_RDWR SD_BOTH | | #define SHUT_RDWR SD_BOTH | |
| | | | |
| #define SIGKILL 9 | | #define SIGKILL 9 | |
| #define SIGTERM 15 | | #define SIGTERM 15 | |
| | | | |
| #define SetErrnoFromWinError(e) _SetErrnoFromWinError(e, __FILE__, __LINE__
) | | #define SetErrnoFromWinError(e) _SetErrnoFromWinError(e, __FILE__, __LINE__
) | |
| | | | |
| BOOL _plibc_CreateShortcut(const char *pszSrc, const char *pszDest); | | BOOL _plibc_CreateShortcut(const char *pszSrc, const char *pszDest); | |
|
| | | BOOL _plibc_CreateShortcutW(const wchar_t *pwszSrc, const wchar_t *pwszDest
); | |
| BOOL _plibc_DereferenceShortcut(char *pszShortcut); | | BOOL _plibc_DereferenceShortcut(char *pszShortcut); | |
|
| | | BOOL _plibc_DereferenceShortcutW(wchar_t *pwszShortcut); | |
| char *plibc_ChooseDir(char *pszTitle, unsigned long ulFlags); | | char *plibc_ChooseDir(char *pszTitle, unsigned long ulFlags); | |
|
| | | wchar_t *plibc_ChooseDirW(wchar_t *pwszTitle, unsigned long ulFlags); | |
| char *plibc_ChooseFile(char *pszTitle, unsigned long ulFlags); | | char *plibc_ChooseFile(char *pszTitle, unsigned long ulFlags); | |
|
| | | wchar_t *plibc_ChooseFileW(wchar_t *pwszTitle, unsigned long ulFlags); | |
| | | | |
| long QueryRegistry(HKEY hMainKey, const char *pszKey, const char *pszSubKey
, | | long QueryRegistry(HKEY hMainKey, const char *pszKey, const char *pszSubKey
, | |
| char *pszBuffer, long *pdLength); | | char *pszBuffer, long *pdLength); | |
| long QueryRegistryW(HKEY hMainKey, const wchar_t *pszKey, const wchar_t *ps
zSubKey, | | long QueryRegistryW(HKEY hMainKey, const wchar_t *pszKey, const wchar_t *ps
zSubKey, | |
| wchar_t *pszBuffer, long *pdLength); | | wchar_t *pszBuffer, long *pdLength); | |
| | | | |
| BOOL __win_IsHandleMarkedAsBlocking(int hHandle); | | BOOL __win_IsHandleMarkedAsBlocking(int hHandle); | |
| void __win_SetHandleBlockingMode(int s, BOOL bBlocking); | | void __win_SetHandleBlockingMode(int s, BOOL bBlocking); | |
| void __win_DiscardHandleBlockingMode(int s); | | void __win_DiscardHandleBlockingMode(int s); | |
| int _win_isSocketValid(int s); | | int _win_isSocketValid(int s); | |
| | | | |
| skipping to change at line 379 | | skipping to change at line 383 | |
| #endif | | #endif | |
| int truncate(const char *fname, int distance); | | int truncate(const char *fname, int distance); | |
| int statfs(const char *path, struct statfs *buf); | | int statfs(const char *path, struct statfs *buf); | |
| const char *hstrerror(int err); | | const char *hstrerror(int err); | |
| int mkstemp(char *tmplate); | | int mkstemp(char *tmplate); | |
| char *strptime (const char *buf, const char *format, struct tm *tm); | | char *strptime (const char *buf, const char *format, struct tm *tm); | |
| const char *inet_ntop(int af, const void *src, char *dst, size_t size); | | const char *inet_ntop(int af, const void *src, char *dst, size_t size); | |
| struct tm *gmtime_r(const time_t *clock, struct tm *result); | | struct tm *gmtime_r(const time_t *clock, struct tm *result); | |
| | | | |
| int plibc_init(char *pszOrg, char *pszApp); | | int plibc_init(char *pszOrg, char *pszApp); | |
|
| | | int plibc_init_utf8(char *pszOrg, char *pszApp, int utf8_mode); | |
| void plibc_shutdown(); | | void plibc_shutdown(); | |
| int plibc_initialized(); | | int plibc_initialized(); | |
| | | | |
| void _SetErrnoFromWinError(long lWinError, char *pszCaller, int iLine); | | void _SetErrnoFromWinError(long lWinError, char *pszCaller, int iLine); | |
| void SetErrnoFromWinsockError(long lWinError); | | void SetErrnoFromWinsockError(long lWinError); | |
| void SetHErrnoFromWinError(long lWinError); | | void SetHErrnoFromWinError(long lWinError); | |
| void SetErrnoFromHRESULT(HRESULT hRes); | | void SetErrnoFromHRESULT(HRESULT hRes); | |
| int GetErrnoFromWinsockError(long lWinError); | | int GetErrnoFromWinsockError(long lWinError); | |
| FILE *_win_fopen(const char *filename, const char *mode); | | FILE *_win_fopen(const char *filename, const char *mode); | |
| int _win_fclose(FILE *); | | int _win_fclose(FILE *); | |
| | | | |
End of changes. 6 change blocks. |
| 1 lines changed or deleted | | 6 lines changed or added | |
|