/foundation/communication/dhcp/services/dhcp_client/src/ |
H A D | dhcp_socket.cpp | 69 /* Kernel socket can receive data frames or data packets from the local network interface, ip and port. */ 217 udpPackets.ip.tot_len = udpPackets.udp.len; in SendToDhcpPacket() 218 udpPackets.ip.protocol = IPPROTO_UDP; in SendToDhcpPacket() 219 udpPackets.ip.saddr = srcIp; in SendToDhcpPacket() 220 udpPackets.ip.daddr = destIp; in SendToDhcpPacket() 227 udpPackets.ip.ihl = sizeof(udpPackets.ip) >> DHCP_UINT16_BYTES; in SendToDhcpPacket() 228 udpPackets.ip.version = IPVERSION; in SendToDhcpPacket() 229 udpPackets.ip.tot_len = htons(sendLen); in SendToDhcpPacket() 230 udpPackets.ip in SendToDhcpPacket() [all...] |
/foundation/communication/dhcp/services/dhcp_server/src/ |
H A D | address_utils.cpp | 40 uint32_t NetworkAddress(uint32_t ip, uint32_t netmask) in NetworkAddress() argument 42 return (ip & netmask); in NetworkAddress() 45 uint32_t FirstIpAddress(uint32_t ip, uint32_t netmask) in FirstIpAddress() argument 47 uint32_t network = NetworkAddress(ip, netmask); in FirstIpAddress() 78 uint32_t LastIpAddress(uint32_t ip, uint32_t netmask) in LastIpAddress() argument 80 uint32_t network = NetworkAddress(ip, netmask); in LastIpAddress() 88 int IpInNetwork(uint32_t ip, uint32_t network, uint32_t netmask) in IpInNetwork() argument 90 uint32_t firstNet = NetworkAddress(ip, netmask); in IpInNetwork() 97 if (ip >= beginIp && ip < in IpInNetwork() 104 IpInRange(uint32_t ip, uint32_t beginIp, uint32_t endIp, uint32_t netmask) IpInRange() argument 118 BroadCastAddress(uint32_t ip, uint32_t netmask) BroadCastAddress() argument 167 uint32_t ip = 0; ParseIpAddr() local 180 uint32_t ip = ParseIpAddr(strIp); ParseIpHtonl() local 186 uint32_t ip = 0; ParseIp() local [all...] |
/foundation/communication/dsoftbus/core/bus_center/utils/src/ |
H A D | lnn_connection_addr_utils.c | 53 return (strncmp(addr1->info.ip.ip, addr2->info.ip.ip, IP_STR_MAX_LEN) == 0) && in LnnIsSameConnectionAddr() 54 (addr1->info.ip.port == addr2->info.ip.port); in LnnIsSameConnectionAddr() 95 if (strncpy_s(option->socketOption.addr, sizeof(option->socketOption.addr), addr->info.ip.ip, in LnnConvertAddrToOption() 96 strlen(addr->info.ip.ip)) ! in LnnConvertAddrToOption() [all...] |
/foundation/communication/dsoftbus/core/bus_center/lnn/disc_mgr/src/ |
H A D | lnn_coap_discovery_impl.c | 52 if (device->addr[0].info.ip.port == 0) { in LnnCheckDiscoveryDeviceInfo() 54 LnnCoapConnect(device->addr[0].info.ip.ip); in LnnCheckDiscoveryDeviceInfo() 63 if (strcpy_s(addr->info.ip.ip, IP_STR_MAX_LEN, device->addr[0].info.ip.ip) != EOK) { in GetConnectDeviceInfo() 64 LNN_LOGE(LNN_BUILDER, "strcpy ip failed"); in GetConnectDeviceInfo() 67 if (strcpy_s((char *)addr->info.ip.udidHash, UDID_HASH_LEN, device->devId) != EOK) { in GetConnectDeviceInfo() 71 addr->info.ip in GetConnectDeviceInfo() [all...] |
H A D | lnn_coap_adapter_virtual.c | 22 void LnnCoapConnect(const char *ip) in LnnCoapConnect() argument 24 (void)ip; in LnnCoapConnect()
|
/foundation/communication/dsoftbus/core/connection/wifi_direct_cpp/data/ |
H A D | ipv4_info.cpp | 23 Ipv4Info::Ipv4Info(const std::string &ip) in Ipv4Info() argument 25 FromIpString(ip); in Ipv4Info() 38 auto ip = ntohl(ip_); in Marshalling() local 39 auto p = reinterpret_cast<uint8_t *>(&ip); in Marshalling() 40 output.insert(output.begin(), p, p + sizeof(ip)); in Marshalling() 77 uint32_t ip = ntohl(ip_); in ToIpString() local 79 const char *ret = inet_ntop(AF_INET, &ip, ipStr, IP_STR_MAX_LEN); in ToIpString()
|
H A D | ipv4_info.h | 27 explicit Ipv4Info(const std::string &ip); 37 void SetIp(uint32_t ip) in SetIp() argument 39 ip_ = ip; in SetIp()
|
/foundation/communication/netmanager_base/services/netmanagernative/bpf/include/ |
H A D | bpf_def.h | 14 #define GET_IP_SEGMENT(ip, seg) (((ip) >> (((seg)-1) * 8)) & 0xFF) 15 #define IS_MATCHED_IP(ip, target) \ 16 GET_IP_SEGMENT(ip, 1) == (target)[0] && GET_IP_SEGMENT(ip, 2) == (target)[1] && \ 17 GET_IP_SEGMENT(ip, 3) == (target)[2] && GET_IP_SEGMENT(ip, 4) == (target)[3] \ 35 static const uint32_t IPV4_HEADERS_LENGTH = 54; // transfer header:20, ip header:20, link header:14 36 static const uint32_t IPV6_HEADERS_LENGTH = 74; // transfer header:20, ip header:40, link header:14
|
/foundation/communication/dsoftbus/tests/core/bus_center/lnn/net_builder/src/ |
H A D | lnn_net_builder_test.cpp | 88 .info.ip.port = PORT in HWTEST_F() 93 memcpy_s(target.info.ip.ip, IP_STR_MAX_LEN, IP, strlen(IP)); in HWTEST_F() 184 .info.ip.port = PORT in HWTEST_F() 187 memcpy_s(target.info.ip.ip, IP_STR_MAX_LEN, IP, strlen(IP)); in HWTEST_F() 280 .info.ip.port = PORT in HWTEST_F() 282 (void)strcpy_s(addr.info.ip.ip, IP_STR_MAX_LEN, IP); in HWTEST_F() 305 .info.ip in HWTEST_F() [all...] |
/foundation/communication/dsoftbus/tests/core/bus_center/lnn/net_buscenter/ |
H A D | lnn_ip_network_impl_mock.cpp | 46 const char *ifName, char *ip, char *netmask, uint32_t len) in ActionOfGetNetworkIpByIfName() 52 if (memcpy_s(ip, strlen("127.0.0.2") + 1, "127.0.0.2", strlen("127.0.0.2") + 1) != EOK) { in ActionOfGetNetworkIpByIfName() 130 int32_t AuthStartListening(AuthLinkType type, const char *ip, int32_t port) in AuthStartListening() argument 132 return GetLnnIpNetworkImplInterface()->AuthStartListening(type, ip, port); in AuthStartListening() 165 int32_t GetNetworkIpByIfName(const char *ifName, char *ip, char *netmask, uint32_t len) in GetNetworkIpByIfName() argument 167 return GetLnnIpNetworkImplInterface()->GetNetworkIpByIfName(ifName, ip, netmask, len); in GetNetworkIpByIfName() 175 int32_t LnnGetWlanIpv4Addr(char *ip, uint32_t size) in LnnGetWlanIpv4Addr() argument 177 return GetLnnIpNetworkImplInterface()->GetWlanIpv4Addr(ip, size); in LnnGetWlanIpv4Addr() 45 ActionOfGetNetworkIpByIfName( const char *ifName, char *ip, char *netmask, uint32_t len) ActionOfGetNetworkIpByIfName() argument
|
/foundation/communication/dhcp/services/dhcp_server/include/ |
H A D | address_utils.h | 29 uint32_t NetworkAddress(uint32_t ip, uint32_t netmask); 30 uint32_t FirstIpAddress(uint32_t ip, uint32_t netmask); 33 uint32_t LastIpAddress(uint32_t ip, uint32_t netmask); 34 int IpInNetwork(uint32_t ip, uint32_t network, uint32_t netmask); 35 int IpInRange(uint32_t ip, uint32_t beginIp, uint32_t endIp, uint32_t netmask); 36 uint32_t BroadCastAddress(uint32_t ip, uint32_t netmask);
|
/foundation/communication/dsoftbus/sdk/transmission/trans_channel/udp/file/src/ |
H A D | file_adapter.c | 48 static int CreateServerSocketByIpv4(const char *ip, int port) in CreateServerSocketByIpv4() argument 51 int32_t ret = Ipv4AddrToAddrIn(&addr, ip, port); in CreateServerSocketByIpv4() 90 static int CreateServerSocketByIpv6(const char *ip, int port) in CreateServerSocketByIpv6() argument 93 int32_t ret = Ipv6AddrToAddrIn(&addr, ip, port); in CreateServerSocketByIpv6() 131 static int32_t CreateServerSocket(const char *ip, int32_t *fd, int32_t *port) in CreateServerSocket() argument 133 if (ip == NULL || fd == NULL || port == NULL) { in CreateServerSocket() 139 if (GetDomainByAddr(ip) == SOFTBUS_AF_INET6) { in CreateServerSocket() 140 socketFd = CreateServerSocketByIpv6(ip, 0); in CreateServerSocket() 142 socketFd = CreateServerSocketByIpv4(ip, 0); in CreateServerSocket() 151 TRANS_LOGE(TRANS_FILE, "no ip supportte in CreateServerSocket() 167 InitSockAddrInByIpPort(const char *ip, int32_t port, struct sockaddr_in *addr) InitSockAddrInByIpPort() argument 179 InitSockAddrIn6ByIpPort(const char *ip, int32_t port, struct sockaddr_in6 *addr) InitSockAddrIn6ByIpPort() argument [all...] |
/foundation/communication/dhcp/test/unittest/services/dhcp_client/ |
H A D | dhcp_socket_test.cpp | 183 packet.ip.protocol = 0; in HWTEST_F() 184 packet.ip.version = 0; in HWTEST_F() 187 packet.ip.protocol = IPPROTO_UDP; in HWTEST_F() 188 packet.ip.version = IPVERSION; in HWTEST_F() 189 packet.ip.ihl = 0; in HWTEST_F() 192 packet.ip.ihl = (uint32_t)(sizeof(packet.ip) >> DHCP_UINT16_BYTES); in HWTEST_F() 200 uint16_t uLen = (uint16_t)(total - (int)sizeof(packet.ip)); in HWTEST_F() 214 packet.ip.protocol = IPPROTO_UDP; in HWTEST_F() 215 packet.ip in HWTEST_F() [all...] |
/foundation/communication/wifi/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_p2p/hid2d/ |
H A D | wifi_hid2d_service_utils.cpp | 37 WIFI_LOGI("Init ip pool"); in InitIpPool() 60 WIFI_LOGI("Get ip, gcMac: %{public}s", MacAnonymize(gcMac).c_str()); in GetIp() 63 std::string ip = ""; in GetIp() local 65 WIFI_LOGE("Alloc ip failed!"); in GetIp() 66 return ip; in GetIp() 68 ip = ipList.front(); in GetIp() 70 mapGcMacToAllocIp[gcMac] = ip; in GetIp() 71 return ip; in GetIp() 76 WIFI_LOGI("Release ip, gcMac: %{public}s", MacAnonymize(gcMac).c_str()); in ReleaseIp() 95 WIFI_LOGI("Release ip poo in ReleaseIpPool() 102 IsValidIp(const std::string& ip) IsValidIp() argument [all...] |
/foundation/communication/dsoftbus/components/nstackx/nstackx_ctrl/core/ |
H A D | nstackx_device_local.c | 40 struct in_addr ip; member 174 iface->ctx = CoapServerInit(&iface->ip, (void *)iface); in LocalIfaceCreateContextTimeout() 198 static int LocalIfaceInit(struct LocalIface *iface, const char *ifname, const struct in_addr *ip, const char *ipStr) in LocalIfaceInit() argument 207 DFINDER_LOGE(TAG, "copy ip string failed"); in LocalIfaceInit() 211 iface->ip.s_addr = ip->s_addr; in LocalIfaceInit() 214 iface->ctx = CoapServerInit(ip, (void *)iface); in LocalIfaceInit() 237 static struct LocalIface *CreateLocalIface(const char *ifname, const struct in_addr *ip, const char *ipStr) in CreateLocalIface() argument 245 if (LocalIfaceInit(iface, ifname, ip, ipStr) != NSTACKX_EOK) { in CreateLocalIface() 272 static struct LocalIface *GetLocalIface(List *head, const char *ifname, const struct in_addr *ip) in GetLocalIface() argument 313 AddLocalIface(const char *ifname, const struct in_addr *ip) AddLocalIface() argument 390 struct in_addr ip; AddLocalIfaceIpChanged() local 612 struct in_addr *ip = &((struct sockaddr_in *)&req[i].ifr_addr)->sin_addr; DetectLocalIface() local 687 GetLocalIfaceByLocalIp(const struct in_addr *ip) GetLocalIfaceByLocalIp() argument [all...] |
/foundation/communication/dsoftbus/adapter/common/kernel/posix/ |
H A D | lnn_ip_utils_adapter.c | 26 static int32_t GetNetworkIfIp(int32_t fd, struct ifreq *req, char *ip, char *netmask, uint32_t len) in GetNetworkIfIp() argument 40 if (inet_ntop(sockAddr->sin_family, &sockAddr->sin_addr, ip, len) == NULL) { in GetNetworkIfIp() 41 COMM_LOGE(COMM_ADAPTER, "convert ip addr to string failed"); in GetNetworkIfIp() 60 int32_t GetNetworkIpByIfName(const char *ifName, char *ip, char *netmask, uint32_t len) in GetNetworkIpByIfName() argument 62 if (ifName == NULL || ip == NULL) { in GetNetworkIpByIfName() 63 COMM_LOGE(COMM_ADAPTER, "ifName or ip buffer is NULL!"); in GetNetworkIpByIfName() 77 if (GetNetworkIfIp(fd, &ifr, ip, netmask, len) != SOFTBUS_OK) { in GetNetworkIpByIfName()
|
/foundation/communication/dsoftbus/core/authentication/src/virtual/ |
H A D | auth_tcp_connection_virtual.c | 35 int32_t AuthOpenChannel(const char *ip, int32_t port) in AuthOpenChannel() argument 37 (void)ip; in AuthOpenChannel() 68 int32_t SocketConnectDevice(const char *ip, int32_t port, bool isBlockMode) in SocketConnectDevice() argument 70 (void)ip; in SocketConnectDevice()
|
/foundation/communication/dhcp/test/fuzztest/addressutils_fuzzer/ |
H A D | addressutils_fuzzer.cpp | 34 uint32_t ip = static_cast<uint32_t>(data[index++]); in NetworkAddressTest() local 36 NetworkAddress(ip, netmask); in NetworkAddressTest() 42 uint32_t ip = static_cast<uint32_t>(data[index++]); in FirstIpAddressTest() local 44 FirstIpAddress(ip, netmask); in FirstIpAddressTest() 66 uint32_t ip = static_cast<uint32_t>(data[index++]); in LastIpAddressTest() local 68 LastIpAddress(ip, netmask); in LastIpAddressTest() 74 uint32_t ip = static_cast<uint32_t>(data[index++]); in IpInNetworkTest() local 77 IpInNetwork(ip, network, netmask); in IpInNetworkTest() 83 uint32_t ip = static_cast<uint32_t>(data[index++]); in IpInRangeTest() local 87 IpInRange(ip, beginI in IpInRangeTest() 93 uint32_t ip = static_cast<uint32_t>(data[index++]); BroadCastAddressTest() local [all...] |
/foundation/communication/dsoftbus/core/discovery/coap/common/src/ |
H A D | disc_coap_parser.c | 62 if (!GetJsonObjectStringItem(data, JSON_WLAN_IP, device->addr[0].info.ip.ip, sizeof(device->addr[0].info.ip.ip))) { in DiscCoapParseWifiIpAddr() 63 DISC_LOGE(DISC_COAP, "parse wifi ip address failed."); in DiscCoapParseWifiIpAddr() 68 Anonymize(device->addr[0].info.ip.ip, &anonymizedStr); in DiscCoapParseWifiIpAddr() 69 DISC_LOGD(DISC_COAP, "ip=%{public}s", AnonymizeWrapper(anonymizedStr)); in DiscCoapParseWifiIpAddr() 132 device->addr[0].info.ip.port = (uint16_t)authPort; in DiscCoapParseServiceData()
|
/foundation/communication/dsoftbus/tests/core/bus_center/lnn/unittest/ |
H A D | net_buscenter_test.cpp | 112 static int32_t SetIpaddr(const std::string &ip) in SetIpaddr() argument 138 if (inet_pton(AF_INET, ip.c_str(), &(addr.sin_addr)) <= 0) { in SetIpaddr() 139 printf("inet_pton fail for ip\n"); in SetIpaddr() 205 char ip[IP_LEN] = "192.168.50.10"; in HWTEST_F() local 207 EXPECT_TRUE(SetIpaddr(ip) == SOFTBUS_OK); in HWTEST_F() 210 EXPECT_TRUE(strncmp(ipAddr, ip, IP_LEN) == 0); in HWTEST_F() 222 char ip[IP_LEN] = "0.0.0.0"; in HWTEST_F() local 223 EXPECT_TRUE(SetIpaddr(ip) == SOFTBUS_OK); in HWTEST_F()
|
/foundation/communication/netstack/test/unittest/tls_test/client/ |
H A D | tls_utils_test.cpp | 32 std::string TlsUtilsTest::GetIp(std::string ip)
in GetIp() argument 34 return ip.substr(0, ip.length() - 1);
in GetIp()
|
/foundation/communication/netstack/test/unittest/tlssocket/client/ |
H A D | tls_utils_test.cpp | 32 std::string TlsUtilsTest::GetIp(std::string ip) in GetIp() argument 34 return ip.substr(0, ip.length() - 1); in GetIp()
|
/foundation/communication/netmanager_base/test/netmanagerutils/unittest/netmanager_base_common_test/ |
H A D | ut_netmanager_base_common.cpp | 542 std::string ip = {}; in HWTEST_F() local 543 auto result = CommonUtils::Ipv4PrefixLen(ip); in HWTEST_F() 545 ip = "192.168.0"; in HWTEST_F() 546 result = CommonUtils::Ipv4PrefixLen(ip); in HWTEST_F() 548 ip = "255.255.255.255"; in HWTEST_F() 549 result = CommonUtils::Ipv4PrefixLen(ip); in HWTEST_F() 551 ip = "255.255.255.0"; in HWTEST_F() 552 result = CommonUtils::Ipv4PrefixLen(ip); in HWTEST_F() 554 ip = "255.255.0.0"; in HWTEST_F() 555 result = CommonUtils::Ipv4PrefixLen(ip); in HWTEST_F() 639 std::string ip = ""; HWTEST_F() local [all...] |
/foundation/communication/dsoftbus/tests/sdk/bus_center/demo/bus_center/ |
H A D | join_lnn_demo.c | 66 .info.ip.ip = "192.168.0.1", // ip info of device B in main() 67 .info.ip.port = 1000 // auth port of device B in main()
|
/foundation/communication/netmanager_ext/services/networksharemanager/src/ |
H A D | router_advertisement_params.cpp | 35 for (auto &ip : prefixes_) { in ContainsPrefix() 36 if ((std::memcmp(ip.prefix.s6_addr, prefix.prefix.s6_addr, sizeof(in6_addr)) == 0) && in ContainsPrefix() 37 ip.prefixesLength == prefix.prefixesLength) { in ContainsPrefix()
|