diff options
Diffstat (limited to 'src/include/gnunet_pq_lib.h')
-rw-r--r-- | src/include/gnunet_pq_lib.h | 67 |
1 files changed, 10 insertions, 57 deletions
diff --git a/src/include/gnunet_pq_lib.h b/src/include/gnunet_pq_lib.h index 1f2915165..ecc2b9719 100644 --- a/src/include/gnunet_pq_lib.h +++ b/src/include/gnunet_pq_lib.h | |||
@@ -853,7 +853,7 @@ GNUNET_PQ_reconnect (struct GNUNET_PQ_Context *db); | |||
853 | 853 | ||
854 | 854 | ||
855 | /** | 855 | /** |
856 | * Function called whenever the socket needed for | 856 | * Function called whenever the socket needed for |
857 | * notifications from postgres changes. | 857 | * notifications from postgres changes. |
858 | * | 858 | * |
859 | * @param cls closure | 859 | * @param cls closure |
@@ -868,7 +868,7 @@ typedef void | |||
868 | * Obtain the file descriptor to poll on for notifications. | 868 | * Obtain the file descriptor to poll on for notifications. |
869 | * Useful if the GNUnet scheduler is NOT to be used for | 869 | * Useful if the GNUnet scheduler is NOT to be used for |
870 | * such notifications. | 870 | * such notifications. |
871 | * | 871 | * |
872 | * @param db database handle | 872 | * @param db database handle |
873 | * @param sc function to call with the socket | 873 | * @param sc function to call with the socket |
874 | * @param sc_cls closure for @a sc | 874 | * @param sc_cls closure for @a sc |
@@ -911,55 +911,8 @@ GNUNET_PQ_event_scheduler_stop (struct GNUNET_PQ_Context *db); | |||
911 | 911 | ||
912 | 912 | ||
913 | /** | 913 | /** |
914 | * Handle for an active LISTENer to the database. | ||
915 | */ | ||
916 | struct GNUNET_PQ_EventHandler; | ||
917 | |||
918 | /** | ||
919 | * Function called on events received from Postgres. | ||
920 | * | ||
921 | * @param cls closure | ||
922 | * @param extra additional event data provided | ||
923 | * @param extra_size number of bytes in @a extra | ||
924 | */ | ||
925 | typedef void | ||
926 | (*GNUNET_PQ_EventCallback)(void *cls, | ||
927 | const void *extra, | ||
928 | size_t extra_size); | ||
929 | |||
930 | GNUNET_NETWORK_STRUCT_BEGIN | ||
931 | |||
932 | |||
933 | /** | ||
934 | * Header of a structure that describes an | ||
935 | * event channel we may subscribe to or notify on. | ||
936 | */ | ||
937 | struct GNUNET_PQ_EventHeaderP | ||
938 | { | ||
939 | /** | ||
940 | * The length of the struct (in bytes, including the length field itself), | ||
941 | * in big-endian format. | ||
942 | */ | ||
943 | uint16_t size GNUNET_PACKED; | ||
944 | |||
945 | /** | ||
946 | * The type of the message (GNUNET_PQ_EVENT_TYPE_XXXX), in big-endian format. | ||
947 | */ | ||
948 | uint16_t type GNUNET_PACKED; | ||
949 | |||
950 | }; | ||
951 | |||
952 | GNUNET_NETWORK_STRUCT_END | ||
953 | |||
954 | |||
955 | /** | ||
956 | * Handle for an active LISTENer to the database. | ||
957 | */ | ||
958 | struct GNUNET_PQ_EventHandler; | ||
959 | |||
960 | /** | ||
961 | * Register callback to be invoked on events of type @a es. | 914 | * Register callback to be invoked on events of type @a es. |
962 | * | 915 | * |
963 | * Unlike many other calls, this function is thread-safe | 916 | * Unlike many other calls, this function is thread-safe |
964 | * and may be called from threads that are different | 917 | * and may be called from threads that are different |
965 | * from the one that setup @a db. However, the @a cb | 918 | * from the one that setup @a db. However, the @a cb |
@@ -973,16 +926,16 @@ struct GNUNET_PQ_EventHandler; | |||
973 | * @param cb_cls closure for @a cb | 926 | * @param cb_cls closure for @a cb |
974 | * @return handle useful to cancel the listener | 927 | * @return handle useful to cancel the listener |
975 | */ | 928 | */ |
976 | struct GNUNET_PQ_EventHandler * | 929 | struct GNUNET_DB_EventHandler * |
977 | GNUNET_PQ_event_listen (struct GNUNET_PQ_Context *db, | 930 | GNUNET_PQ_event_listen (struct GNUNET_PQ_Context *db, |
978 | const struct GNUNET_PQ_EventHeaderP *es, | 931 | const struct GNUNET_DB_EventHeaderP *es, |
979 | GNUNET_PQ_EventCallback cb, | 932 | GNUNET_DB_EventCallback cb, |
980 | void *cb_cls); | 933 | void *cb_cls); |
981 | 934 | ||
982 | 935 | ||
983 | /** | 936 | /** |
984 | * Stop notifications. | 937 | * Stop notifications. |
985 | * | 938 | * |
986 | * Unlike many other calls, this function is thread-safe | 939 | * Unlike many other calls, this function is thread-safe |
987 | * and may be called from threads that are different | 940 | * and may be called from threads that are different |
988 | * from the one that setup @a db. However, the @a cb | 941 | * from the one that setup @a db. However, the @a cb |
@@ -992,12 +945,12 @@ GNUNET_PQ_event_listen (struct GNUNET_PQ_Context *db, | |||
992 | * @param eh handle to unregister. | 945 | * @param eh handle to unregister. |
993 | */ | 946 | */ |
994 | void | 947 | void |
995 | GNUNET_PQ_event_listen_cancel (struct GNUNET_PQ_EventHandler *eh); | 948 | GNUNET_PQ_event_listen_cancel (struct GNUNET_DB_EventHandler *eh); |
996 | 949 | ||
997 | 950 | ||
998 | /** | 951 | /** |
999 | * Notify all that listen on @a es of an event. | 952 | * Notify all that listen on @a es of an event. |
1000 | * | 953 | * |
1001 | * Unlike many other calls, this function is thread-safe | 954 | * Unlike many other calls, this function is thread-safe |
1002 | * and may be called from threads that are different | 955 | * and may be called from threads that are different |
1003 | * from the one that setup @a db. However, the @a cb | 956 | * from the one that setup @a db. However, the @a cb |
@@ -1011,7 +964,7 @@ GNUNET_PQ_event_listen_cancel (struct GNUNET_PQ_EventHandler *eh); | |||
1011 | */ | 964 | */ |
1012 | void | 965 | void |
1013 | GNUNET_PQ_event_notify (struct GNUNET_PQ_Context *db, | 966 | GNUNET_PQ_event_notify (struct GNUNET_PQ_Context *db, |
1014 | const struct GNUNET_PQ_EventHeaderP *es, | 967 | const struct GNUNET_DB_EventHeaderP *es, |
1015 | const void *extra, | 968 | const void *extra, |
1016 | size_t extra_size); | 969 | size_t extra_size); |
1017 | 970 | ||