MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / _handle

Method _handle

chirpstack/src/uplink/join.rs:86–144  ·  view source on GitHub ↗
(ufs: UplinkFrameSet)

Source from the content-addressed store, hash-verified

84 }
85
86 async fn _handle(ufs: UplinkFrameSet) -> Result<()> {
87 let mut ctx = JoinRequest {
88 uplink_frame_set: ufs,
89 relay_context: None,
90 js_client: None,
91 join_request: None,
92 device: None,
93 application: None,
94 tenant: None,
95 device_profile: None,
96 device_keys: None,
97 join_accept: None,
98 device_info: None,
99 relay_rx_info: None,
100 f_nwk_s_int_key: None,
101 s_nwk_s_int_key: None,
102 nwk_s_enc_key: None,
103 app_s_key: None,
104 js_session_key_id: vec![],
105 };
106
107 ctx.get_join_request_payload()?;
108
109 // Add resolved DevEUI to the span
110 let span = tracing::Span::current();
111 span.record(
112 "dev_eui",
113 ctx.join_request.as_ref().unwrap().dev_eui.to_string(),
114 );
115
116 ctx.get_device_data_or_try_pr_roaming().await?;
117 ctx.get_device_keys_or_js_client().await?; // used to validate MIC + if we need external JS
118 ctx.set_device_info()?;
119 ctx.validate_region_config_id()?;
120 ctx.filter_rx_info_by_tenant()?;
121 ctx.abort_on_device_is_disabled()?;
122 ctx.abort_on_relay_only_comm()?;
123 ctx.log_uplink_frame_set().await?;
124 ctx.abort_on_otaa_is_disabled()?;
125 ctx.set_random_dev_addr()?;
126 if ctx.js_client.is_some() {
127 // Using join-server
128 ctx.get_join_accept_from_js().await?;
129 } else {
130 // Using internal keys
131 ctx.validate_mic().await?;
132 ctx.validate_dev_nonce_and_get_device_keys().await?;
133 ctx.construct_join_accept_and_set_keys()?;
134 }
135 ctx.log_uplink_meta().await?;
136 ctx.set_device_session().await?;
137 ctx.flush_device_queue().await?;
138 ctx.set_device_mode().await?;
139 ctx.update_device().await?;
140 ctx.start_downlink_join_accept_flow().await?;
141 ctx.send_join_event().await?;
142
143 Ok(())

Callers

nothing calls this directly

Calls 15

to_stringMethod · 0.80
unwrapMethod · 0.80
as_refMethod · 0.80
set_random_dev_addrMethod · 0.80
set_device_modeMethod · 0.80
set_device_infoMethod · 0.45

Tested by

no test coverage detected