pub struct Forwardable {
pub method: Method,
pub module: ModuleId,
pub interface: InterfaceRole,
pub path: String,
pub query: Option<String>,
pub routing: RoutingHeaders,
pub ids: RequestIds,
pub body: Option<Vec<u8>>,
pub version: VersionNumber,
}hub only.Expand description
What the hub was asked to relay.
Fields§
§method: MethodThe HTTP method of the incoming request.
module: ModuleIdThe module it addresses.
interface: InterfaceRoleWhich interface of that module.
path: StringThe path below the module endpoint, e.g. NL/TNM/LOC1.
query: Option<String>The query string, without the leading ?.
routing: RoutingHeadersThe routing headers as they arrived.
ids: RequestIdsThe IDs as they arrived. The hub renews the request ID and keeps the correlation ID.
body: Option<Vec<u8>>The request body, if any.
version: VersionNumberThe OCPI version the body is written in — the version of the endpoint it arrived on.
A hub is the one place where the two ends of a conversation need not agree on it, so the
forwarder translates between this and whatever the receiving platform speaks. See
Forwarder::relay.
Implementations§
Source§impl Forwardable
impl Forwardable
Sourcepub fn scenario(&self, hub: &PartyRef) -> Result<RoutingScenario, OcpiError>
pub fn scenario(&self, hub: &PartyRef) -> Result<RoutingScenario, OcpiError>
The scenario this request is, from its headers and method.
To send a Broadcast Push, the client uses the party-id and country-code of the Hub in the ‘OCPI-to-’ headers.
When … the requesting party does not know the destination of a request, the ‘OCPI-to-’ headers can be omitted.
To request a GET All from a Hub, the client uses the party-id and country-code of the Hub in the ‘OCPI-to-’ headers, and calls the GET method on the Sender interface.
§Why this can fail
Addressing the hub itself is the one ambiguous case: it means a Broadcast Push for a
write and a GET All for a GET on a Sender interface, and the two remaining combinations
are not scenarios at all.
GET SHALL NOT be used in combination with Broadcast Push. If the requesting party wants to GET information of which it does not know the receiving party, an Open Routing Request MUST be used.
A GET on a Receiver interface addressed to the hub is therefore refused rather than
quietly broadcast — the sender is told to omit the OCPI-to- headers instead — and so is
a write addressed to the hub on a Sender interface, which is neither a push to the
connected parties nor a read to merge.
§Errors
Returns OcpiError::NotRoutable, a 2001, for those two combinations.
Spec: 2.3.0 §transport_and_format_message_routing