Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
c6dc14d8
Commit
c6dc14d8
authored
Jul 12, 2007
by
Rob Shearman
Committed by
Alexandre Julliard
Jul 13, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rpcrt4: Make binding to an interface a function of RpcAssoc instead of
binding handles, since binding requires information from the association and not from the binding handle.
parent
1cd222b4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
96 additions
and
80 deletions
+96
-80
rpc_binding.c
dlls/rpcrt4/rpc_binding.c
+5
-77
rpc_binding.h
dlls/rpcrt4/rpc_binding.h
+1
-1
rpc_transport.c
dlls/rpcrt4/rpc_transport.c
+90
-2
No files found.
dlls/rpcrt4/rpc_binding.c
View file @
c6dc14d8
...
...
@@ -277,93 +277,21 @@ RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding, RpcConnection** Connection,
PRPC_SYNTAX_IDENTIFIER
TransferSyntax
,
PRPC_SYNTAX_IDENTIFIER
InterfaceId
)
{
RpcConnection
*
NewConnection
;
RPC_STATUS
status
;
TRACE
(
"(Binding == ^%p)
\n
"
,
Binding
);
if
(
!
Binding
->
server
)
{
/* try to find a compatible connection from the connection pool */
NewConnection
=
RpcAssoc_GetIdleConnection
(
Binding
->
Assoc
,
InterfaceId
,
TransferSyntax
,
Binding
->
AuthInfo
,
Binding
->
QOS
);
if
(
NewConnection
)
{
*
Connection
=
NewConnection
;
return
RPC_S_OK
;
}
return
RpcAssoc_GetClientConnection
(
Binding
->
Assoc
,
InterfaceId
,
TransferSyntax
,
Binding
->
AuthInfo
,
Binding
->
QOS
,
Connection
);
}
else
{
/* we already have a connection with acceptable binding, so use it */
if
(
Binding
->
FromConn
)
{
*
Connection
=
Binding
->
FromConn
;
return
RPC_S_OK
;
}
else
{
ERR
(
"no connection in binding
\n
"
);
return
RPC_S_INTERNAL_ERROR
;
}
}
/* create a new connection */
status
=
RPCRT4_CreateConnection
(
&
NewConnection
,
Binding
->
server
,
Binding
->
Protseq
,
Binding
->
NetworkAddr
,
Binding
->
Endpoint
,
Binding
->
NetworkOptions
,
Binding
->
AuthInfo
,
Binding
->
QOS
);
if
(
status
!=
RPC_S_OK
)
return
status
;
status
=
RPCRT4_OpenClientConnection
(
NewConnection
);
if
(
status
!=
RPC_S_OK
)
{
RPCRT4_DestroyConnection
(
NewConnection
);
return
status
;
}
/* we need to send a binding packet if we are client. */
if
(
!
NewConnection
->
server
)
{
RpcPktHdr
*
hdr
;
RpcPktHdr
*
response_hdr
;
RPC_MESSAGE
msg
;
TRACE
(
"sending bind request to server
\n
"
);
hdr
=
RPCRT4_BuildBindHeader
(
NDR_LOCAL_DATA_REPRESENTATION
,
RPC_MAX_PACKET_SIZE
,
RPC_MAX_PACKET_SIZE
,
Binding
->
Assoc
->
assoc_group_id
,
InterfaceId
,
TransferSyntax
);
status
=
RPCRT4_Send
(
NewConnection
,
hdr
,
NULL
,
0
);
RPCRT4_FreeHeader
(
hdr
);
if
(
status
!=
RPC_S_OK
)
{
RPCRT4_DestroyConnection
(
NewConnection
);
return
status
;
}
status
=
RPCRT4_Receive
(
NewConnection
,
&
response_hdr
,
&
msg
);
if
(
status
!=
RPC_S_OK
)
{
ERR
(
"receive failed
\n
"
);
RPCRT4_DestroyConnection
(
NewConnection
);
return
status
;
}
if
(
response_hdr
->
common
.
ptype
!=
PKT_BIND_ACK
||
response_hdr
->
bind_ack
.
max_tsize
<
RPC_MIN_PACKET_SIZE
)
{
ERR
(
"failed to bind for interface %s, %d.%d
\n
"
,
debugstr_guid
(
&
InterfaceId
->
SyntaxGUID
),
InterfaceId
->
SyntaxVersion
.
MajorVersion
,
InterfaceId
->
SyntaxVersion
.
MinorVersion
);
RPCRT4_FreeHeader
(
response_hdr
);
RPCRT4_DestroyConnection
(
NewConnection
);
return
RPC_S_PROTOCOL_ERROR
;
}
/* FIXME: do more checks? */
NewConnection
->
MaxTransmissionSize
=
response_hdr
->
bind_ack
.
max_tsize
;
NewConnection
->
assoc_group_id
=
response_hdr
->
bind_ack
.
assoc_gid
;
NewConnection
->
ActiveInterface
=
*
InterfaceId
;
RPCRT4_FreeHeader
(
response_hdr
);
}
if
(
Binding
->
server
)
Binding
->
FromConn
=
NewConnection
;
*
Connection
=
NewConnection
;
return
RPC_S_OK
;
}
RPC_STATUS
RPCRT4_CloseBinding
(
RpcBinding
*
Binding
,
RpcConnection
*
Connection
)
...
...
dlls/rpcrt4/rpc_binding.h
View file @
c6dc14d8
...
...
@@ -146,7 +146,7 @@ ULONG RpcQualityOfService_Release(RpcQualityOfService *qos);
BOOL
RpcQualityOfService_IsEqual
(
const
RpcQualityOfService
*
qos1
,
const
RpcQualityOfService
*
qos2
);
RPC_STATUS
RPCRT4_GetAssociation
(
LPCSTR
Protseq
,
LPCSTR
NetworkAddr
,
LPCSTR
Endpoint
,
LPCWSTR
NetworkOptions
,
RpcAssoc
**
assoc
);
R
pcConnection
*
RpcAssoc_GetIdleConnection
(
RpcAssoc
*
assoc
,
const
RPC_SYNTAX_IDENTIFIER
*
InterfaceId
,
const
RPC_SYNTAX_IDENTIFIER
*
TransferSyntax
,
const
RpcAuthInfo
*
AuthInfo
,
const
RpcQualityOfService
*
QOS
);
R
PC_STATUS
RpcAssoc_GetClientConnection
(
RpcAssoc
*
assoc
,
const
RPC_SYNTAX_IDENTIFIER
*
InterfaceId
,
const
RPC_SYNTAX_IDENTIFIER
*
TransferSyntax
,
RpcAuthInfo
*
AuthInfo
,
RpcQualityOfService
*
QOS
,
RpcConnection
**
Connection
);
void
RpcAssoc_ReleaseIdleConnection
(
RpcAssoc
*
assoc
,
RpcConnection
*
Connection
);
ULONG
RpcAssoc_Release
(
RpcAssoc
*
assoc
);
...
...
dlls/rpcrt4/rpc_transport.c
View file @
c6dc14d8
...
...
@@ -1473,15 +1473,63 @@ ULONG RpcAssoc_Release(RpcAssoc *assoc)
return
refs
;
}
RpcConnection
*
RpcAssoc_GetIdleConnection
(
RpcAssoc
*
assoc
,
static
RPC_STATUS
RpcAssoc_BindConnection
(
RpcAssoc
*
assoc
,
RpcConnection
*
conn
,
const
RPC_SYNTAX_IDENTIFIER
*
InterfaceId
,
const
RPC_SYNTAX_IDENTIFIER
*
TransferSyntax
)
{
RpcPktHdr
*
hdr
;
RpcPktHdr
*
response_hdr
;
RPC_MESSAGE
msg
;
RPC_STATUS
status
;
TRACE
(
"sending bind request to server
\n
"
);
hdr
=
RPCRT4_BuildBindHeader
(
NDR_LOCAL_DATA_REPRESENTATION
,
RPC_MAX_PACKET_SIZE
,
RPC_MAX_PACKET_SIZE
,
assoc
->
assoc_group_id
,
InterfaceId
,
TransferSyntax
);
status
=
RPCRT4_Send
(
conn
,
hdr
,
NULL
,
0
);
RPCRT4_FreeHeader
(
hdr
);
if
(
status
!=
RPC_S_OK
)
return
status
;
status
=
RPCRT4_Receive
(
conn
,
&
response_hdr
,
&
msg
);
if
(
status
!=
RPC_S_OK
)
{
ERR
(
"receive failed
\n
"
);
return
status
;
}
if
(
response_hdr
->
common
.
ptype
!=
PKT_BIND_ACK
)
{
ERR
(
"failed to bind for interface %s, %d.%d
\n
"
,
debugstr_guid
(
&
InterfaceId
->
SyntaxGUID
),
InterfaceId
->
SyntaxVersion
.
MajorVersion
,
InterfaceId
->
SyntaxVersion
.
MinorVersion
);
RPCRT4_FreeHeader
(
response_hdr
);
return
RPC_S_PROTOCOL_ERROR
;
}
/* FIXME: do more checks? */
conn
->
assoc_group_id
=
response_hdr
->
bind_ack
.
assoc_gid
;
conn
->
MaxTransmissionSize
=
response_hdr
->
bind_ack
.
max_tsize
;
conn
->
ActiveInterface
=
*
InterfaceId
;
RPCRT4_FreeHeader
(
response_hdr
);
return
RPC_S_OK
;
}
static
RpcConnection
*
RpcAssoc_GetIdleConnection
(
RpcAssoc
*
assoc
,
const
RPC_SYNTAX_IDENTIFIER
*
InterfaceId
,
const
RPC_SYNTAX_IDENTIFIER
*
TransferSyntax
,
const
RpcAuthInfo
*
AuthInfo
,
const
RpcQualityOfService
*
QOS
)
{
RpcConnection
*
Connection
;
/* try to find a compatible connection from the connection pool */
EnterCriticalSection
(
&
assoc
->
cs
);
/* try to find a compatible connection from the connection pool */
LIST_FOR_EACH_ENTRY
(
Connection
,
&
assoc
->
connection_pool
,
RpcConnection
,
conn_pool_entry
)
{
if
(
!
memcmp
(
&
Connection
->
ActiveInterface
,
InterfaceId
,
sizeof
(
RPC_SYNTAX_IDENTIFIER
))
&&
RpcAuthInfo_IsEqual
(
Connection
->
AuthInfo
,
AuthInfo
)
&&
...
...
@@ -1492,11 +1540,51 @@ RpcConnection *RpcAssoc_GetIdleConnection(RpcAssoc *assoc,
TRACE
(
"got connection from pool %p
\n
"
,
Connection
);
return
Connection
;
}
}
LeaveCriticalSection
(
&
assoc
->
cs
);
return
NULL
;
}
RPC_STATUS
RpcAssoc_GetClientConnection
(
RpcAssoc
*
assoc
,
const
RPC_SYNTAX_IDENTIFIER
*
InterfaceId
,
const
RPC_SYNTAX_IDENTIFIER
*
TransferSyntax
,
RpcAuthInfo
*
AuthInfo
,
RpcQualityOfService
*
QOS
,
RpcConnection
**
Connection
)
{
RpcConnection
*
NewConnection
;
RPC_STATUS
status
;
*
Connection
=
RpcAssoc_GetIdleConnection
(
assoc
,
InterfaceId
,
TransferSyntax
,
AuthInfo
,
QOS
);
if
(
*
Connection
)
return
RPC_S_OK
;
/* create a new connection */
status
=
RPCRT4_CreateConnection
(
&
NewConnection
,
FALSE
/* is this a server connection? */
,
assoc
->
Protseq
,
assoc
->
NetworkAddr
,
assoc
->
Endpoint
,
assoc
->
NetworkOptions
,
AuthInfo
,
QOS
);
if
(
status
!=
RPC_S_OK
)
return
status
;
status
=
RPCRT4_OpenClientConnection
(
NewConnection
);
if
(
status
!=
RPC_S_OK
)
{
RPCRT4_DestroyConnection
(
NewConnection
);
return
status
;
}
status
=
RpcAssoc_BindConnection
(
assoc
,
NewConnection
,
InterfaceId
,
TransferSyntax
);
if
(
status
!=
RPC_S_OK
)
{
RPCRT4_DestroyConnection
(
NewConnection
);
return
status
;
}
*
Connection
=
NewConnection
;
return
RPC_S_OK
;
}
void
RpcAssoc_ReleaseIdleConnection
(
RpcAssoc
*
assoc
,
RpcConnection
*
Connection
)
{
assert
(
!
Connection
->
server
);
...
...
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