blob: ad19ac36f79efce2a0a24c38bbb3d4b632f4eac5 [file] [log] [blame]
Jorge E. Moreirad6c129e2018-01-05 14:52:21 -08001/*
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 <arpa/inet.h>
18
19#include <mutex>
20
21#include "common/vsoc/lib/ril_region_view.h"
22
23namespace vsoc {
24namespace ril {
25
Jorge E. Moreirad6c129e2018-01-05 14:52:21 -080026const char* RilRegionView::address_and_prefix_length() const {
27 static char buffer[sizeof(data().ipaddr) + 3]{}; // <ipaddr>/dd
28 if (buffer[0] == '\0') {
29 snprintf(buffer, sizeof(buffer), "%s/%d", data().ipaddr, data().prefixlen);
30 }
31 return &buffer[0];
32}
33
34} // namespace ril
35} // namespace vsoc