Implement stubs for actual connection manager methods
This commit is contained in:
parent
99ffeec323
commit
0960a768e6
6 changed files with 63 additions and 11 deletions
2
Makefile
2
Makefile
|
|
@ -14,7 +14,7 @@ webui-dev: webui-deps
|
|||
export RQBIT_UPNP_SERVER_ENABLE ?= true
|
||||
export RQBIT_UPNP_SERVER_FRIENDLY_NAME ?= rqbit-dev
|
||||
export RQBIT_HTTP_API_LISTEN_ADDR ?= 0.0.0.0:3030
|
||||
CARGO_RUN_FLAGS ?= ""
|
||||
CARGO_RUN_FLAGS ?=
|
||||
RQBIT_OUTPUT_FOLDER ?= /tmp/scratch
|
||||
RQBIT_POSTGRES_CONNECTION_STRING ?= postgres:///rqbit
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0"?>
|
||||
<s:Envelope
|
||||
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<s:Body>
|
||||
<u:GetCurrentConnectionIDsResponse xmlns:u="urn:schemas-upnp-org:service:ConnectionManager:1">
|
||||
<ConnectionIDs></ConnectionIDs>
|
||||
</u:GetCurrentConnectionIDsResponse>
|
||||
</s:Body>
|
||||
</s:Envelope>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0"?>
|
||||
<s:Envelope
|
||||
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<s:Body>
|
||||
<u:GetCurrentConnectionInfoResponse xmlns:u="urn:schemas-upnp-org:service:ConnectionManager:1">
|
||||
<RcsID>0</RcsID>
|
||||
<AVTransportID>0</AVTransportID>
|
||||
<ProtocolInfo>http-get:*:*:DLNA.ORG_OP=01</ProtocolInfo>
|
||||
<PeerConnectionManager></PeerConnectionManager>
|
||||
<PeerConnectionID>-1</PeerConnectionID>
|
||||
<Direction>Output</Direction>
|
||||
<Status>OK</Status>
|
||||
</u:GetCurrentConnectionInfoResponse>
|
||||
</s:Body>
|
||||
</s:Envelope>
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
</argument>
|
||||
</argumentList>
|
||||
</action>
|
||||
<action>
|
||||
<!--action>
|
||||
<name>PrepareForConnection</name>
|
||||
<argumentList>
|
||||
<argument>
|
||||
|
|
@ -59,8 +59,8 @@
|
|||
<relatedStateVariable>A_ARG_TYPE_RcsID</relatedStateVariable>
|
||||
</argument>
|
||||
</argumentList>
|
||||
</action>
|
||||
<action>
|
||||
</action-->
|
||||
<!--action>
|
||||
<name>ConnectionComplete</name>
|
||||
<argumentList>
|
||||
<argument>
|
||||
|
|
@ -69,7 +69,7 @@
|
|||
<relatedStateVariable>A_ARG_TYPE_ConnectionID</relatedStateVariable>
|
||||
</argument>
|
||||
</argumentList>
|
||||
</action>
|
||||
</action-->
|
||||
<action>
|
||||
<name>GetCurrentConnectionIDs</name>
|
||||
<argumentList>
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ pub(crate) async fn http_handler(
|
|||
}
|
||||
};
|
||||
|
||||
let not_implemented = StatusCode::NOT_IMPLEMENTED.into_response();
|
||||
let not_implemented = || StatusCode::NOT_IMPLEMENTED.into_response();
|
||||
|
||||
match action.as_ref() {
|
||||
SOAP_ACTION_GET_PROTOCOL_INFO => (
|
||||
|
|
@ -46,10 +46,23 @@ pub(crate) async fn http_handler(
|
|||
include_str!("../resources/templates/connection_manager/control/get_protocol_info.xml"),
|
||||
)
|
||||
.into_response(),
|
||||
SOAP_ACTION_CONNECTION_COMPLETE => not_implemented,
|
||||
SOAP_ACTION_GET_CURRENT_CONNECTION_INFO => not_implemented,
|
||||
SOAP_ACTION_GET_CURRENT_CONNECTION_IDS => not_implemented,
|
||||
SOAP_ACTION_PREPARE_FOR_CONNECTION => not_implemented,
|
||||
|
||||
SOAP_ACTION_GET_CURRENT_CONNECTION_INFO => (
|
||||
[(CONTENT_TYPE, CONTENT_TYPE_XML_UTF8)],
|
||||
include_str!(
|
||||
"../resources/templates/connection_manager/control/get_current_connection_info.xml"
|
||||
),
|
||||
)
|
||||
.into_response(),
|
||||
SOAP_ACTION_GET_CURRENT_CONNECTION_IDS => (
|
||||
[(CONTENT_TYPE, CONTENT_TYPE_XML_UTF8)],
|
||||
include_str!(
|
||||
"../resources/templates/connection_manager/control/get_current_connection_ids.xml"
|
||||
),
|
||||
)
|
||||
.into_response(),
|
||||
SOAP_ACTION_PREPARE_FOR_CONNECTION => not_implemented(),
|
||||
SOAP_ACTION_CONNECTION_COMPLETE => not_implemented(),
|
||||
_ => StatusCode::BAD_REQUEST.into_response(),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,6 +82,19 @@ pub enum SubscribeRequest {
|
|||
},
|
||||
}
|
||||
|
||||
impl core::fmt::Display for SubscribeRequest {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
SubscribeRequest::Create { callback, timeout } => {
|
||||
write!(f, "create;callback={callback};timeout={timeout:?}")
|
||||
}
|
||||
SubscribeRequest::Renew { sid, timeout } => {
|
||||
write!(f, "renew;sid={sid};timeout={timeout:?}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl SubscribeRequest {
|
||||
fn timeout(&self) -> Duration {
|
||||
match self {
|
||||
|
|
@ -159,7 +172,7 @@ pub(crate) fn subscription_into_response(
|
|||
request: &SubscribeRequest,
|
||||
result: anyhow::Result<SubscriptionResult>,
|
||||
) -> axum::response::Response {
|
||||
trace!(?request, ?result, "subscription request->response");
|
||||
trace!(%request, ?result, "request->response");
|
||||
|
||||
let result = match result {
|
||||
Ok(r) => r,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue