src/line_proto.h
changeset 19 8c80580ccde9
parent 18 dedf137b504f
child 28 9c1050bc8709
equal deleted inserted replaced
18:dedf137b504f 19:8c80580ccde9
    30 /*
    30 /*
    31  * Runs the socket recv() into our internal buffer. If a full line was received, a pointer to our internal bufffer is
    31  * Runs the socket recv() into our internal buffer. If a full line was received, a pointer to our internal bufffer is
    32  * returned via *line_ptr, and we return SUCCESS. If we don't yet have a full line, and receiving more would block,
    32  * returned via *line_ptr, and we return SUCCESS. If we don't yet have a full line, and receiving more would block,
    33  * NULL is returned via *line_ptr instead. Otherwise, nonzero error return code.
    33  * NULL is returned via *line_ptr instead. Otherwise, nonzero error return code.
    34  */
    34  */
    35 err_t line_proto_read (struct line_proto *lp, char **line_ptr);
    35 err_t line_proto_recv (struct line_proto *lp, char **line_ptr);
    36 
    36 
    37 /*
    37 /*
    38  * Write a single line to the sock_stream, buffering any incomplete fragment that remains unset. Returns zero if the
    38  * Write a single line to the sock_stream, buffering any incomplete fragment that remains unset. Returns zero if the
    39  * line was succesfully sent, >0 if it was only partially sent, or -err on errors.
    39  * line was succesfully sent, >0 if it was only partially sent, or -err on errors.
    40  *
    40  *
    41  * The given line should already include the terminating '\r\n' character sequence.
    41  * The given line should already include the terminating '\r\n' character sequence.
    42  */
    42  */
    43 int line_proto_write (struct line_proto *lp, const char *line);
    43 int line_proto_send (struct line_proto *lp, const char *line);
       
    44 
       
    45 /*
       
    46  * Flush out any buffered line fragment. Returns zero if the buffer was flushed empty, >0 if there's still fragments
       
    47  * remaining, or -err on errors.
       
    48  */
       
    49 int line_proto_flush (struct line_proto *lp);
    44 
    50 
    45 /*
    51 /*
    46  * Get current error_info*
    52  * Get current error_info*
    47  */
    53  */
    48 const struct error_info* line_proto_error (struct line_proto *lp);
    54 const struct error_info* line_proto_error (struct line_proto *lp);