Commit ec49a574 authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

server: Add a request to get socket information.

parent f5023dda
...@@ -1529,6 +1529,22 @@ struct get_socket_event_reply ...@@ -1529,6 +1529,22 @@ struct get_socket_event_reply
struct get_socket_info_request
{
struct request_header __header;
obj_handle_t handle;
};
struct get_socket_info_reply
{
struct reply_header __header;
int family;
int type;
int protocol;
char __pad_20[4];
};
struct enable_socket_event_request struct enable_socket_event_request
{ {
struct request_header __header; struct request_header __header;
...@@ -5082,6 +5098,7 @@ enum request ...@@ -5082,6 +5098,7 @@ enum request
REQ_accept_into_socket, REQ_accept_into_socket,
REQ_set_socket_event, REQ_set_socket_event,
REQ_get_socket_event, REQ_get_socket_event,
REQ_get_socket_info,
REQ_enable_socket_event, REQ_enable_socket_event,
REQ_set_socket_deferred, REQ_set_socket_deferred,
REQ_alloc_console, REQ_alloc_console,
...@@ -5341,6 +5358,7 @@ union generic_request ...@@ -5341,6 +5358,7 @@ union generic_request
struct accept_into_socket_request accept_into_socket_request; struct accept_into_socket_request accept_into_socket_request;
struct set_socket_event_request set_socket_event_request; struct set_socket_event_request set_socket_event_request;
struct get_socket_event_request get_socket_event_request; struct get_socket_event_request get_socket_event_request;
struct get_socket_info_request get_socket_info_request;
struct enable_socket_event_request enable_socket_event_request; struct enable_socket_event_request enable_socket_event_request;
struct set_socket_deferred_request set_socket_deferred_request; struct set_socket_deferred_request set_socket_deferred_request;
struct alloc_console_request alloc_console_request; struct alloc_console_request alloc_console_request;
...@@ -5598,6 +5616,7 @@ union generic_reply ...@@ -5598,6 +5616,7 @@ union generic_reply
struct accept_into_socket_reply accept_into_socket_reply; struct accept_into_socket_reply accept_into_socket_reply;
struct set_socket_event_reply set_socket_event_reply; struct set_socket_event_reply set_socket_event_reply;
struct get_socket_event_reply get_socket_event_reply; struct get_socket_event_reply get_socket_event_reply;
struct get_socket_info_reply get_socket_info_reply;
struct enable_socket_event_reply enable_socket_event_reply; struct enable_socket_event_reply enable_socket_event_reply;
struct set_socket_deferred_reply set_socket_deferred_reply; struct set_socket_deferred_reply set_socket_deferred_reply;
struct alloc_console_reply alloc_console_reply; struct alloc_console_reply alloc_console_reply;
...@@ -5802,6 +5821,6 @@ union generic_reply ...@@ -5802,6 +5821,6 @@ union generic_reply
struct set_suspend_context_reply set_suspend_context_reply; struct set_suspend_context_reply set_suspend_context_reply;
}; };
#define SERVER_PROTOCOL_VERSION 447 #define SERVER_PROTOCOL_VERSION 448
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */ #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
...@@ -1236,6 +1236,16 @@ enum server_fd_type ...@@ -1236,6 +1236,16 @@ enum server_fd_type
@END @END
/* Get socket info */
@REQ(get_socket_info)
obj_handle_t handle; /* handle to the socket */
@REPLY
int family; /* family, see socket manpage */
int type; /* type, see socket manpage */
int protocol; /* protocol, see socket manpage */
@END
/* Re-enable pending socket events */ /* Re-enable pending socket events */
@REQ(enable_socket_event) @REQ(enable_socket_event)
obj_handle_t handle; /* handle to the socket */ obj_handle_t handle; /* handle to the socket */
......
...@@ -156,6 +156,7 @@ DECL_HANDLER(accept_socket); ...@@ -156,6 +156,7 @@ DECL_HANDLER(accept_socket);
DECL_HANDLER(accept_into_socket); DECL_HANDLER(accept_into_socket);
DECL_HANDLER(set_socket_event); DECL_HANDLER(set_socket_event);
DECL_HANDLER(get_socket_event); DECL_HANDLER(get_socket_event);
DECL_HANDLER(get_socket_info);
DECL_HANDLER(enable_socket_event); DECL_HANDLER(enable_socket_event);
DECL_HANDLER(set_socket_deferred); DECL_HANDLER(set_socket_deferred);
DECL_HANDLER(alloc_console); DECL_HANDLER(alloc_console);
...@@ -414,6 +415,7 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] = ...@@ -414,6 +415,7 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
(req_handler)req_accept_into_socket, (req_handler)req_accept_into_socket,
(req_handler)req_set_socket_event, (req_handler)req_set_socket_event,
(req_handler)req_get_socket_event, (req_handler)req_get_socket_event,
(req_handler)req_get_socket_info,
(req_handler)req_enable_socket_event, (req_handler)req_enable_socket_event,
(req_handler)req_set_socket_deferred, (req_handler)req_set_socket_deferred,
(req_handler)req_alloc_console, (req_handler)req_alloc_console,
...@@ -972,6 +974,12 @@ C_ASSERT( FIELD_OFFSET(struct get_socket_event_reply, mask) == 8 ); ...@@ -972,6 +974,12 @@ C_ASSERT( FIELD_OFFSET(struct get_socket_event_reply, mask) == 8 );
C_ASSERT( FIELD_OFFSET(struct get_socket_event_reply, pmask) == 12 ); C_ASSERT( FIELD_OFFSET(struct get_socket_event_reply, pmask) == 12 );
C_ASSERT( FIELD_OFFSET(struct get_socket_event_reply, state) == 16 ); C_ASSERT( FIELD_OFFSET(struct get_socket_event_reply, state) == 16 );
C_ASSERT( sizeof(struct get_socket_event_reply) == 24 ); C_ASSERT( sizeof(struct get_socket_event_reply) == 24 );
C_ASSERT( FIELD_OFFSET(struct get_socket_info_request, handle) == 12 );
C_ASSERT( sizeof(struct get_socket_info_request) == 16 );
C_ASSERT( FIELD_OFFSET(struct get_socket_info_reply, family) == 8 );
C_ASSERT( FIELD_OFFSET(struct get_socket_info_reply, type) == 12 );
C_ASSERT( FIELD_OFFSET(struct get_socket_info_reply, protocol) == 16 );
C_ASSERT( sizeof(struct get_socket_info_reply) == 24 );
C_ASSERT( FIELD_OFFSET(struct enable_socket_event_request, handle) == 12 ); C_ASSERT( FIELD_OFFSET(struct enable_socket_event_request, handle) == 12 );
C_ASSERT( FIELD_OFFSET(struct enable_socket_event_request, mask) == 16 ); C_ASSERT( FIELD_OFFSET(struct enable_socket_event_request, mask) == 16 );
C_ASSERT( FIELD_OFFSET(struct enable_socket_event_request, sstate) == 20 ); C_ASSERT( FIELD_OFFSET(struct enable_socket_event_request, sstate) == 20 );
......
...@@ -1073,3 +1073,17 @@ DECL_HANDLER(set_socket_deferred) ...@@ -1073,3 +1073,17 @@ DECL_HANDLER(set_socket_deferred)
sock->deferred = acceptsock; sock->deferred = acceptsock;
release_object( sock ); release_object( sock );
} }
DECL_HANDLER(get_socket_info)
{
struct sock *sock;
sock = (struct sock *)get_handle_obj( current->process, req->handle, FILE_READ_ATTRIBUTES, &sock_ops );
if (!sock) return;
reply->family = sock->family;
reply->type = sock->type;
reply->protocol = sock->proto;
release_object( &sock->obj );
}
...@@ -1712,6 +1712,18 @@ static void dump_get_socket_event_reply( const struct get_socket_event_reply *re ...@@ -1712,6 +1712,18 @@ static void dump_get_socket_event_reply( const struct get_socket_event_reply *re
dump_varargs_ints( ", errors=", cur_size ); dump_varargs_ints( ", errors=", cur_size );
} }
static void dump_get_socket_info_request( const struct get_socket_info_request *req )
{
fprintf( stderr, " handle=%04x", req->handle );
}
static void dump_get_socket_info_reply( const struct get_socket_info_reply *req )
{
fprintf( stderr, " family=%d", req->family );
fprintf( stderr, ", type=%d", req->type );
fprintf( stderr, ", protocol=%d", req->protocol );
}
static void dump_enable_socket_event_request( const struct enable_socket_event_request *req ) static void dump_enable_socket_event_request( const struct enable_socket_event_request *req )
{ {
fprintf( stderr, " handle=%04x", req->handle ); fprintf( stderr, " handle=%04x", req->handle );
...@@ -4107,6 +4119,7 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = { ...@@ -4107,6 +4119,7 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_accept_into_socket_request, (dump_func)dump_accept_into_socket_request,
(dump_func)dump_set_socket_event_request, (dump_func)dump_set_socket_event_request,
(dump_func)dump_get_socket_event_request, (dump_func)dump_get_socket_event_request,
(dump_func)dump_get_socket_info_request,
(dump_func)dump_enable_socket_event_request, (dump_func)dump_enable_socket_event_request,
(dump_func)dump_set_socket_deferred_request, (dump_func)dump_set_socket_deferred_request,
(dump_func)dump_alloc_console_request, (dump_func)dump_alloc_console_request,
...@@ -4362,6 +4375,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = { ...@@ -4362,6 +4375,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
NULL, NULL,
NULL, NULL,
(dump_func)dump_get_socket_event_reply, (dump_func)dump_get_socket_event_reply,
(dump_func)dump_get_socket_info_reply,
NULL, NULL,
NULL, NULL,
(dump_func)dump_alloc_console_reply, (dump_func)dump_alloc_console_reply,
...@@ -4617,6 +4631,7 @@ static const char * const req_names[REQ_NB_REQUESTS] = { ...@@ -4617,6 +4631,7 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
"accept_into_socket", "accept_into_socket",
"set_socket_event", "set_socket_event",
"get_socket_event", "get_socket_event",
"get_socket_info",
"enable_socket_event", "enable_socket_event",
"set_socket_deferred", "set_socket_deferred",
"alloc_console", "alloc_console",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment