author | Tero Marttila <terom@fixme.fi> |
Sun, 22 Feb 2009 08:21:22 +0200 | |
changeset 8 | be88e543c8ff |
child 10 | 9fe218576d13 |
permissions | -rw-r--r-- |
8
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
1 |
#ifndef LINE_PROTO_H |
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
2 |
#define LINE_PROTO_H |
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
3 |
|
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
4 |
/* |
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
5 |
* Support for protocols that send/receive lines |
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
6 |
*/ |
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
7 |
#include "sock.h" |
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
8 |
#include "error.h" |
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
9 |
|
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
10 |
/* |
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
11 |
* The state handle |
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
12 |
*/ |
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
13 |
struct line_proto; |
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
14 |
|
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
15 |
/* |
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
16 |
* Create a new line_proto off the the given sock_stream. The newly allocated line_proto will be returned via *lp_ptr. |
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
17 |
*/ |
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
18 |
err_t line_proto_create (struct line_proto **lp_ptr, struct sock_stream *sock, struct error_info *err); |
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
19 |
|
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
20 |
/* |
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
21 |
* Receive one line into the given buffer. The line will be terminated with '\r\n', and said terminator will be |
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
22 |
* NUL'd out, so the buffer is safe for use as a C-string after succesfull return. |
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
23 |
* |
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
24 |
* Note: currently this uses the buffer to store intermediate state, so always pass the same buffer (for now). |
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
25 |
*/ |
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
26 |
err_t line_proto_read (struct line_proto *lp, char *buf, size_t len); |
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
27 |
|
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
28 |
/* |
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
29 |
* Get current error_info* |
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
30 |
*/ |
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
31 |
const struct error_info* line_proto_error (struct line_proto *lp); |
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
32 |
|
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
33 |
#endif /* LINE_PROTO_H */ |