terom@1: terom@1: #include "sock_internal.h" terom@2: #include "sock_gnutls.h" terom@2: terom@3: #include terom@3: terom@3: err_t sock_init (void) terom@2: { terom@3: err_t err; terom@3: terom@3: // XXX: just call these all directly for now terom@3: terom@3: if ((err = sock_gnutls_init())) terom@3: return err; terom@2: } terom@1: terom@3: void sock_stream_init (struct sock_stream *sock, struct sock_stream_type *type) terom@3: { terom@3: // be strict terom@3: assert(sock->type == NULL); terom@3: terom@3: // store type terom@3: sock->type = type; terom@3: } terom@3: terom@3: err_t sock_stream_read (struct sock_stream *sock, void *buf, size_t len) terom@1: { terom@1: // proxy off to method handler terom@1: return sock->type->methods.read(sock, buf, len); terom@1: } terom@1: terom@3: err_t sock_stream_write (struct sock_stream *sock, const void *buf, size_t len) terom@1: { terom@1: // proxy off to method handler terom@1: return sock->type->methods.write(sock, buf, len); terom@1: } terom@1: terom@3: void sock_stream_error (struct sock_stream *sock, struct error_info *err) terom@3: { terom@3: // copy from SOCK_ER terom@3: *err = SOCK_ERR(sock); terom@3: }