Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
3d5e517e
Commit
3d5e517e
authored
Apr 21, 2006
by
Mike McCormack
Committed by
Alexandre Julliard
Apr 21, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rpcrt4: Add support for the ncacn_ip_tcp transport layer.
parent
5bfb579f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
6 deletions
+82
-6
rpc_transport.c
dlls/rpcrt4/rpc_transport.c
+82
-6
No files found.
dlls/rpcrt4/rpc_transport.c
View file @
3d5e517e
...
...
@@ -22,11 +22,29 @@
*
*/
#include "config.h"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#ifdef HAVE_SYS_TYPES
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
...
...
@@ -45,6 +63,8 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
rpc
);
/**** ncacn_np support ****/
typedef
struct
_RpcConnection_np
{
RpcConnection
common
;
...
...
@@ -180,7 +200,7 @@ static RPC_STATUS rpcrt4_conn_np_handoff(RpcConnection *old_conn, RpcConnection
RpcConnection_np
*
new_npc
=
(
RpcConnection_np
*
)
new_conn
;
/* because of the way named pipes work, we'll transfer the connected pipe
* to the child, then reopen the server binding to continue listening */
new_npc
->
pipe
=
old_npc
->
pipe
;
new_npc
->
ovl
=
old_npc
->
ovl
;
old_npc
->
pipe
=
0
;
...
...
@@ -224,9 +244,12 @@ static int rpcrt4_conn_np_close(RpcConnection *Connection)
return
0
;
}
/**** ncacn_ip_tcp support ****/
typedef
struct
_RpcConnection_tcp
{
RpcConnection
common
;
int
sock
;
}
RpcConnection_tcp
;
static
RpcConnection
*
rpcrt4_conn_tcp_alloc
(
void
)
...
...
@@ -236,35 +259,86 @@ static RpcConnection *rpcrt4_conn_tcp_alloc(void)
static
RPC_STATUS
rpcrt4_ncacn_ip_tcp_open
(
RpcConnection
*
Connection
)
{
FIXME
(
"(%s, %s) unimplemented
\n
"
,
Connection
->
NetworkAddr
,
Connection
->
Endpoint
);
RpcConnection_tcp
*
tcpc
=
(
RpcConnection_tcp
*
)
Connection
;
struct
sockaddr_in
sa
;
int
sock
;
TRACE
(
"(%s, %s)
\n
"
,
Connection
->
NetworkAddr
,
Connection
->
Endpoint
);
if
(
Connection
->
server
)
{
ERR
(
"ncacn_ip_tcp servers not supported yet
\n
"
);
return
RPC_S_SERVER_UNAVAILABLE
;
}
if
(
tcpc
->
sock
)
return
RPC_S_OK
;
sa
.
sin_family
=
AF_INET
;
inet_pton
(
AF_INET
,
Connection
->
NetworkAddr
,
&
sa
.
sin_addr
);
sa
.
sin_port
=
htons
(
atoi
(
Connection
->
Endpoint
));
sock
=
socket
(
PF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
);
if
(
sock
<
0
)
{
ERR
(
"socket() failed
\n
"
);
goto
error
;
}
if
(
0
>
connect
(
sock
,
(
struct
sockaddr
*
)
&
sa
,
sizeof
(
sa
)))
{
ERR
(
"connect() failed
\n
"
);
goto
error
;
}
tcpc
->
sock
=
sock
;
return
RPC_S_OK
;
error:
close
(
sock
);
return
RPC_S_SERVER_UNAVAILABLE
;
}
static
HANDLE
rpcrt4_conn_tcp_get_wait_handle
(
RpcConnection
*
Connection
)
{
return
NULL
;
assert
(
0
);
return
0
;
}
static
RPC_STATUS
rpcrt4_conn_tcp_handoff
(
RpcConnection
*
old_conn
,
RpcConnection
*
new_conn
)
{
assert
(
0
);
return
RPC_S_SERVER_UNAVAILABLE
;
}
static
int
rpcrt4_conn_tcp_read
(
RpcConnection
*
Connection
,
void
*
buffer
,
unsigned
int
count
)
{
return
-
1
;
RpcConnection_tcp
*
tcpc
=
(
RpcConnection_tcp
*
)
Connection
;
int
r
=
read
(
tcpc
->
sock
,
buffer
,
count
);
TRACE
(
"%d %p %u -> %d
\n
"
,
tcpc
->
sock
,
buffer
,
count
,
r
);
return
r
;
}
static
int
rpcrt4_conn_tcp_write
(
RpcConnection
*
Connection
,
const
void
*
buffer
,
unsigned
int
count
)
{
return
-
1
;
RpcConnection_tcp
*
tcpc
=
(
RpcConnection_tcp
*
)
Connection
;
int
r
=
write
(
tcpc
->
sock
,
buffer
,
count
);
TRACE
(
"%d %p %u -> %d
\n
"
,
tcpc
->
sock
,
buffer
,
count
,
r
);
return
r
;
}
static
int
rpcrt4_conn_tcp_close
(
RpcConnection
*
Connection
)
{
return
-
1
;
RpcConnection_tcp
*
tcpc
=
(
RpcConnection_tcp
*
)
Connection
;
TRACE
(
"%d
\n
"
,
tcpc
->
sock
);
if
(
tcpc
->
sock
)
close
(
tcpc
->
sock
);
tcpc
->
sock
=
0
;
return
0
;
}
struct
protseq_ops
protseq_list
[]
=
{
...
...
@@ -308,6 +382,8 @@ static struct protseq_ops *rpcrt4_get_protseq_ops(const char *protseq)
return
NULL
;
}
/**** interface to rest of code ****/
RPC_STATUS
RPCRT4_OpenConnection
(
RpcConnection
*
Connection
)
{
TRACE
(
"(Connection == ^%p)
\n
"
,
Connection
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment