1 // Copyright 2023 The Pigweed Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not
4 // use this file except in compliance with the License. You may obtain a copy of
5 // the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 // License for the specific language governing permissions and limitations under
13 // the License.
14
15 #define PW_LOG_MODULE_NAME "PW_RPC"
16
17 #include "pw_rpc_transport/egress_ingress.h"
18
19 #include <cinttypes>
20
21 #include "pw_log/log.h"
22
23 namespace pw::rpc::internal {
24
LogBadPacket()25 void LogBadPacket() { PW_LOG_ERROR("Received malformed RPC packet"); }
26
LogChannelIdOverflow(uint32_t channel_id,uint32_t max_channel_id)27 void LogChannelIdOverflow(uint32_t channel_id, uint32_t max_channel_id) {
28 PW_LOG_ERROR(
29 "Received RPC packet for channel ID %d, max supported channel ID %d",
30 static_cast<int>(channel_id),
31 static_cast<int>(max_channel_id));
32 }
33
LogMissingEgressForChannel(uint32_t channel_id)34 void LogMissingEgressForChannel(uint32_t channel_id) {
35 PW_LOG_ERROR(
36 "Received RPC packet for channel ID %d"
37 " which doesn't have a registered egress",
38 static_cast<int>(channel_id));
39 }
40
LogIngressSendFailure(uint32_t channel_id,pw::Status status)41 void LogIngressSendFailure(uint32_t channel_id, pw::Status status) {
42 PW_LOG_ERROR(
43 "Failed to send RPC packet received on channel ID %d"
44 " to its configured egress. Status %d",
45 static_cast<int>(channel_id),
46 static_cast<int>(status.code()));
47 }
48
49 } // namespace pw::rpc::internal
50