equal
deleted
inserted
replaced
49 * XXX: doesn't do any certificate verification. |
49 * XXX: doesn't do any certificate verification. |
50 */ |
50 */ |
51 err_t sock_gnutls_connect (struct sock_stream **sock_ptr, const char *host, const char *service, struct error_info *err); |
51 err_t sock_gnutls_connect (struct sock_stream **sock_ptr, const char *host, const char *service, struct error_info *err); |
52 |
52 |
53 /* |
53 /* |
54 * The generic read/write API for stream sockets. |
54 * The generic read/write API for stream sockets. These are mostly identical to the equivalent read/write syscalls, but |
|
55 * the handling of EOF and EAGAIN is different. Normally, these return the (positive) number of bytes written. For |
|
56 * EAGAIN, these return zero. For EOF, these return -ERR_READ_EOF/ERR_WRITE_EOF. Otherwise, these return the -ERR_* |
|
57 * code. |
55 */ |
58 */ |
56 int sock_stream_read (struct sock_stream *sock, void *buf, size_t len); |
59 int sock_stream_read (struct sock_stream *sock, void *buf, size_t len); |
57 int sock_stream_write (struct sock_stream *sock, const void *buf, size_t len); |
60 int sock_stream_write (struct sock_stream *sock, const void *buf, size_t len); |
58 |
61 |
59 /* |
62 /* |
63 * Note that the callbacks struct isn't copied - it's used as-is-given. |
66 * Note that the callbacks struct isn't copied - it's used as-is-given. |
64 */ |
67 */ |
65 err_t sock_stream_event_init (struct sock_stream *sock, const struct sock_stream_callbacks *callbacks, void *arg); |
68 err_t sock_stream_event_init (struct sock_stream *sock, const struct sock_stream_callbacks *callbacks, void *arg); |
66 |
69 |
67 /* |
70 /* |
68 * Prime the callbacks set up earlier with sock_stream_event_init to fire once ready. |
71 * Enable the events for this sock, as set up earlier with event_init. Mask should contain EV_READ/EV_WRITE. |
69 * |
72 * |
70 * \a mask is a bitmask of EV_* bits, such as EV_READ, EV_WRITE or EV_PERSIST. See event_set() for more info about the |
73 * The implementation of this is slightly hazy for complex protocols; this should only be used to map from |
71 * behaviour of those. |
74 * sock_stream_read/write to the corresponding sock_stream_callback. That is, if sock_stream_read returns zero, then |
|
75 * call event_enable(EV_READ), wherepon on_read will later be called. |
72 */ |
76 */ |
73 err_t sock_stream_event_enable (struct sock_stream *sock, short mask); |
77 err_t sock_stream_event_enable (struct sock_stream *sock, short mask); |
74 |
78 |
75 /** |
79 /** |
76 * Get current error_info for \a sock. |
80 * Get current error_info for \a sock. |