diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-06-22 07:22:50 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-06-22 07:22:50 +0000 |
commit | 09082d4872f060aedf1364fb5ebc1584ee4c47d6 (patch) | |
tree | 005d7dc42a1c38d6c79a522d6384035e18db4c93 /src/include/gnunet_server_lib.h | |
parent | c7f9e2399e5d703f0137ebb0038173c56894b8e2 (diff) | |
download | gnunet-09082d4872f060aedf1364fb5ebc1584ee4c47d6.tar.gz gnunet-09082d4872f060aedf1364fb5ebc1584ee4c47d6.zip |
refine API to make it usable for server itself
Diffstat (limited to 'src/include/gnunet_server_lib.h')
-rw-r--r-- | src/include/gnunet_server_lib.h | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/include/gnunet_server_lib.h b/src/include/gnunet_server_lib.h index 7af133b89..070d254ad 100644 --- a/src/include/gnunet_server_lib.h +++ b/src/include/gnunet_server_lib.h | |||
@@ -657,14 +657,36 @@ GNUNET_SERVER_mst_create (size_t maxbuf, | |||
657 | * @param size number of bytes in buf | 657 | * @param size number of bytes in buf |
658 | * @param purge should any excess bytes in the buffer be discarded | 658 | * @param purge should any excess bytes in the buffer be discarded |
659 | * (i.e. for packet-based services like UDP) | 659 | * (i.e. for packet-based services like UDP) |
660 | * @return GNUNET_NO if the data stream is corrupt | 660 | * @param one_shot only call callback once, keep rest of message in buffer |
661 | * GNUNET_SYSERR if the data stream is corrupt beyond repair | 661 | * @return GNUNET_OK if we are done processing (need more data) |
662 | * GNUNET_NO if one_shot was set and we have another message ready | ||
663 | * GNUNET_SYSERR if the data stream is corrupt | ||
662 | */ | 664 | */ |
663 | int | 665 | int |
664 | GNUNET_SERVER_mst_receive (struct GNUNET_SERVER_MessageStreamTokenizer *mst, | 666 | GNUNET_SERVER_mst_receive (struct GNUNET_SERVER_MessageStreamTokenizer *mst, |
665 | const char *buf, | 667 | const char *buf, |
666 | size_t size, | 668 | size_t size, |
667 | int purge); | 669 | int purge, |
670 | int one_shot); | ||
671 | |||
672 | |||
673 | /** | ||
674 | * Read incoming data into the receive buffer and call the | ||
675 | * callback for all complete messages. | ||
676 | * | ||
677 | * @param mst tokenizer to use | ||
678 | * @param sock socket to read from (must be ready according to select) | ||
679 | * @param purge should any excess bytes in the buffer be discarded | ||
680 | * (i.e. for packet-based services like UDP) | ||
681 | * @return GNUNET_NO if the data stream is corrupt | ||
682 | * GNUNET_SYSERR if the data stream is corrupt beyond repair | ||
683 | */ | ||
684 | int | ||
685 | GNUNET_SERVER_mst_read (struct GNUNET_SERVER_MessageStreamTokenizer *mst, | ||
686 | const char *buf, | ||
687 | size_t size, | ||
688 | int purge); | ||
689 | |||
668 | 690 | ||
669 | /** | 691 | /** |
670 | * Destroys a tokenizer. | 692 | * Destroys a tokenizer. |