• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://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,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <string.h>
17 
18 #include "softbus_config_adapter.h"
19 #include "softbus_def.h"
20 
21 #define LNN_SUPPORT_ENHANCE_FEATURE 0x30FF7EA
22 #define ENHANCE_SUPPORT_AUTH_CAPACITY 0xFF
23 #define ENHANCE_LNN_NET_IF_NAME "0:eth0,1:wlan0,2:br0,3:ble0,4:ncm0,4:wwan0"
24 
SoftbusConfigAdapterInit(const ConfigSetProc * sets)25 void SoftbusConfigAdapterInit(const ConfigSetProc *sets)
26 {
27     if (sets == NULL) {
28         return;
29     }
30 #ifndef DSOFTBUS_CONFIG_ENHANCE
31     int32_t val = 0x1;
32     sets->SetConfig(SOFTBUS_INT_AUTH_ABILITY_COLLECTION, (unsigned char *)&val, sizeof(val));
33 #else
34     /* enable ble trigger and tlv capability */
35     uint64_t featureVal = LNN_SUPPORT_ENHANCE_FEATURE;
36     sets->SetConfig(SOFTBUS_INT_LNN_SUPPORT_FEATURE, (unsigned char *)&featureVal, sizeof(featureVal));
37 
38     /* auth support as server */
39     int32_t authVal = 0x1;
40     sets->SetConfig(SOFTBUS_INT_AUTH_ABILITY_COLLECTION, (unsigned char *)&authVal, sizeof(authVal));
41 
42     /* set auth capacity */
43     uint32_t authCapacity = ENHANCE_SUPPORT_AUTH_CAPACITY;
44     sets->SetConfig(SOFTBUS_INT_AUTH_CAPACITY, (unsigned char *)&authCapacity, sizeof(authCapacity));
45 
46     /* set lnn net ifname */
47     const char *netIfname = ENHANCE_LNN_NET_IF_NAME;
48     sets->SetConfig(SOFTBUS_STR_LNN_NET_IF_NAME, (unsigned char *)netIfname, strlen(netIfname) + 1);
49 #endif
50 }