Skip to main content

encode_intent

Function encode_intent 

Source
pub fn encode_intent(intent: &Value, peer_asn4: bool) -> Result<Vec<u8>>
Expand description

Turn the validated intent produced by a send_bgp_* action into wire bytes.

The action executor cannot do this itself: Protocol::execute_action is a pure function of the action JSON with no access to the session, and the correct encoding of an UPDATE depends on whether four-octet AS was negotiated with this peer. So the executor validates and normalises, returning ActionResult::Custom, and the session calls this with the negotiated state.