2 * A dummy Socket implementation which just holds an error message.
8 #define DEFINE_PLUG_METHOD_MACROS
13 typedef struct Socket_error_tag *Error_Socket;
15 struct Socket_error_tag {
16 const struct socket_function_table *fn;
17 /* the above variable absolutely *must* be the first in this structure */
23 static Plug sk_error_plug(Socket s, Plug p)
25 Error_Socket ps = (Error_Socket) s;
32 static void sk_error_close(Socket s)
34 Error_Socket ps = (Error_Socket) s;
40 static const char *sk_error_socket_error(Socket s)
42 Error_Socket ps = (Error_Socket) s;
46 Socket new_error_socket(const char *errmsg, Plug plug)
48 static const struct socket_function_table socket_fn_table = {
55 NULL /* set_frozen */,
61 ret = snew(struct Socket_error_tag);
62 ret->fn = &socket_fn_table;
64 ret->error = dupstr(errmsg);