blob: 9df2367e1e48cbef546d86bce0211bca738100b2 [file] [log] [blame]
Joel Scherpelzf3fa5cc2017-05-22 12:30:03 +09001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "netdutils/Status.h"
18#include "android-base/stringprintf.h"
19
20namespace android {
21namespace netdutils {
22
23void expectOk(const Status) {
24 // TODO: put something here, for now this function serves solely as documentation.
25}
26
27Status statusFromErrno(int err, const std::string& msg) {
28 return Status(err, base::StringPrintf("%d : [%s] : %s", err, strerror(err), msg.c_str()));
29}
30
31std::ostream& operator<<(std::ostream& os, const Status& s) {
32 return os << "Status[code: " << s.code() << ", msg: " << s.msg() << "]";
33}
34
35} // namespace netdutils
36} // namespace android