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 static char *sk_error_peer_info(Socket s
)
51 Socket
new_error_socket(const char *errmsg
, Plug plug
)
53 static const struct socket_function_table socket_fn_table
= {
60 NULL
/* set_frozen */,
61 sk_error_socket_error
,
67 ret
= snew(struct Socket_error_tag
);
68 ret
->fn
= &socket_fn_table
;
70 ret
->error
= dupstr(errmsg
);