memcache/command.h
changeset 43 e5b714190dee
parent 41 540737bf6bac
child 46 8a832c0e01ee
--- a/memcache/command.h	Wed Aug 27 22:42:27 2008 +0300
+++ b/memcache/command.h	Thu Aug 28 00:29:39 2008 +0300
@@ -13,6 +13,17 @@
 int memcache_cmd_init (struct memcache_cmd *cmd, enum memcache_command cmd_type, struct memcache_key *key, struct memcache_obj *obj);
 
 int memcache_cmd_format_header (struct evbuffer *buf, enum memcache_command cmd_type, struct memcache_key *key, struct memcache_obj *obj);
+
+/*
+ * Attempt to parse a response line from the given buf. *header_data will be set to NULL if no complete response line
+ * was found, or a pointer to the line received (which may contain NULs between tokens), which must be freed by the
+ * caller. *reply_type will be set to the parsed `enum memcache_reply` type. If the reply is of type
+ * MEMCACHE_RPL_VALUE, then key and obj will be updated to correspond to what was returned (key.buf will point into
+ * *header_data). has_data will be set to true if the response also contains cache data.
+ *
+ * Empty lines will be skipped based on the assumption that they are, in fact, the newline between the data and the
+ * MEMCACHE_RPL_END line of a MEMCACHE_RPL_VALUE reply.
+ */
 int memcache_cmd_parse_header (struct evbuffer *buf, char **header_data, enum memcache_reply *reply_type, struct memcache_key *key, struct memcache_obj *obj, int *has_data);
 
 #endif /* MEMCACHE_COMMAND_H */