mirror of
https://gitee.com/openharmony/communication_dsoftbus
synced 2025-02-17 09:37:45 +00:00
optimize: trigger response with challenge code
Signed-off-by: songzhengteng <songzhengteng@huawei.com> Change-Id: I94cdbcaea80a4fedd05d896918bd171726984603
This commit is contained in:
parent
3e8fe8e60d
commit
c870148113
@ -64,7 +64,7 @@ ohos_static_library("wifi_direct") {
|
||||
"$wifi_direct_path/adapter/p2p_adapter.cpp",
|
||||
"$wifi_direct_path/channel/auth_negotiate_channel.cpp",
|
||||
"$wifi_direct_path/channel/proxy_negotiate_channel.cpp",
|
||||
"$wifi_direct_path/channel/null_negotiate_channel.cpp",
|
||||
"$wifi_direct_path/channel/dummy_negotiate_channel.cpp",
|
||||
"$wifi_direct_path/command/connect_command.cpp",
|
||||
"$wifi_direct_path/command/command_factory.cpp",
|
||||
"$wifi_direct_path/command/disconnect_command.cpp",
|
||||
|
@ -12,20 +12,20 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "null_negotiate_channel.h"
|
||||
#include "softbus_errcode.h"
|
||||
#include "dummy_negotiate_channel.h"
|
||||
#include "conn_log.h"
|
||||
#include "softbus_errcode.h"
|
||||
|
||||
namespace OHOS::SoftBus {
|
||||
NullNeotiateChannel::~NullNeotiateChannel() { }
|
||||
DummyNegotiateChannel::~DummyNegotiateChannel() { }
|
||||
|
||||
int NullNeotiateChannel::SendMessage(const NegotiateMessage &msg) const
|
||||
int DummyNegotiateChannel::SendMessage(const NegotiateMessage &msg) const
|
||||
{
|
||||
CONN_LOGI(CONN_WIFI_DIRECT, "Empty implementation");
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
std::string NullNeotiateChannel::GetRemoteDeviceId() const
|
||||
std::string DummyNegotiateChannel::GetRemoteDeviceId() const
|
||||
{
|
||||
CONN_LOGI(CONN_WIFI_DIRECT, "Empty implementation");
|
||||
return "";
|
@ -12,15 +12,15 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef NULL_NEGOTIATE_CHANNEL_H
|
||||
#define NULL_NEGOTIATE_CHANNEL_H
|
||||
#ifndef DUMMY_NEGOTIATE_CHANNEL_H
|
||||
#define DUMMY_NEGOTIATE_CHANNEL_H
|
||||
|
||||
#include "channel/negotiate_channel.h"
|
||||
|
||||
namespace OHOS::SoftBus {
|
||||
class NullNeotiateChannel : public NegotiateChannel {
|
||||
class DummyNegotiateChannel : public NegotiateChannel {
|
||||
public:
|
||||
~NullNeotiateChannel() override;
|
||||
~DummyNegotiateChannel() override;
|
||||
int SendMessage(const NegotiateMessage &msg) const override;
|
||||
std::string GetRemoteDeviceId() const override;
|
||||
};
|
@ -19,8 +19,8 @@
|
||||
#include "conn_log.h"
|
||||
|
||||
#include "channel/auth_negotiate_channel.h"
|
||||
#include "channel/dummy_negotiate_channel.h"
|
||||
#include "channel/proxy_negotiate_channel.h"
|
||||
#include "channel/null_negotiate_channel.h"
|
||||
#include "data/link_manager.h"
|
||||
#include "processor_selector_factory.h"
|
||||
#include "utils/duration_statistic.h"
|
||||
@ -99,7 +99,7 @@ void ConnectCommand::PreferNegotiateChannel()
|
||||
info_.channel_ = std::make_shared<CoCProxyNegotiateChannel>(info_.info_.negoChannel.handle.channelId);
|
||||
} else {
|
||||
CONN_LOGI(CONN_WIFI_DIRECT, "prefer input null channel");
|
||||
info_.channel_ = std::make_shared<NullNeotiateChannel>();
|
||||
info_.channel_ = std::make_shared<DummyNegotiateChannel>();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -13,9 +13,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "disconnect_command.h"
|
||||
#include "conn_log.h"
|
||||
#include "channel/dummy_negotiate_channel.h"
|
||||
#include "channel/proxy_negotiate_channel.h"
|
||||
#include "channel/null_negotiate_channel.h"
|
||||
#include "conn_log.h"
|
||||
#include "data/link_manager.h"
|
||||
#include "processor_selector_factory.h"
|
||||
|
||||
@ -27,7 +27,7 @@ DisconnectCommand::DisconnectCommand(const WifiDirectDisconnectInfo &info, const
|
||||
auto innerLink = LinkManager::GetInstance().GetLinkById(info_.info_.linkId);
|
||||
if (innerLink == nullptr) {
|
||||
CONN_LOGE(CONN_WIFI_DIRECT, "not find inner link, prefer input null channel");
|
||||
info_.channel_ = std::make_shared<NullNeotiateChannel>();
|
||||
info_.channel_ = std::make_shared<DummyNegotiateChannel>();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ DisconnectCommand::DisconnectCommand(const WifiDirectDisconnectInfo &info, const
|
||||
info_.channel_ = std::make_shared<CoCProxyNegotiateChannel>(info.negoChannel.handle.channelId);
|
||||
} else {
|
||||
CONN_LOGI(CONN_WIFI_DIRECT, "prefer input null channel");
|
||||
info_.channel_ = std::make_shared<NullNeotiateChannel>();
|
||||
info_.channel_ = std::make_shared<DummyNegotiateChannel>();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -70,6 +70,7 @@ InfoContainer<NegotiateMessageKey>::KeyTypeTable InfoContainer<NegotiateMessageK
|
||||
{ NegotiateMessageKey::IS_PROXY_ENABLE, Serializable::ValueType::BOOL },
|
||||
{ NegotiateMessageKey::CHANNEL_5G_LIST, Serializable::ValueType::STRING },
|
||||
{ NegotiateMessageKey::CHANNEL_5G_SCORE, Serializable::ValueType::STRING },
|
||||
{ NegotiateMessageKey::CHALLENGE_CODE, Serializable::ValueType::UINT },
|
||||
|
||||
/* old p2p */
|
||||
{ NegotiateMessageKey::GC_CHANNEL_LIST, Serializable::ValueType::STRING },
|
||||
@ -512,6 +513,16 @@ std::string NegotiateMessage::Get5GChannelScore() const
|
||||
return Get(NegotiateMessageKey::CHANNEL_5G_SCORE, std::string());
|
||||
}
|
||||
|
||||
void NegotiateMessage::SetChallengeCode(uint32_t value)
|
||||
{
|
||||
Set(NegotiateMessageKey::CHALLENGE_CODE, value);
|
||||
}
|
||||
|
||||
uint32_t NegotiateMessage::GetChallengeCode() const
|
||||
{
|
||||
return Get(NegotiateMessageKey::CHALLENGE_CODE, static_cast<uint32_t>(0));
|
||||
}
|
||||
|
||||
void NegotiateMessage::SetLegacyP2pGcChannelList(const std::string &value)
|
||||
{
|
||||
Set(NegotiateMessageKey::GC_CHANNEL_LIST, value);
|
||||
|
@ -99,6 +99,7 @@ enum class NegotiateMessageKey {
|
||||
IS_PROXY_ENABLE = 16,
|
||||
CHANNEL_5G_LIST = 17,
|
||||
CHANNEL_5G_SCORE = 18,
|
||||
CHALLENGE_CODE = 19,
|
||||
|
||||
/* old p2p */
|
||||
GC_CHANNEL_LIST = 200,
|
||||
@ -186,6 +187,9 @@ public:
|
||||
void Set5GChannelScore(const std::string &value);
|
||||
std::string Get5GChannelScore() const;
|
||||
|
||||
void SetChallengeCode(uint32_t value);
|
||||
uint32_t GetChallengeCode() const;
|
||||
|
||||
void SetLegacyP2pGcChannelList(const std::string &value);
|
||||
std::string GetLegacyP2pGcChannelList() const;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user