• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 #ifndef TLS_TLSSOCKET_EXEC_H
17 #define TLS_TLSSOCKET_EXEC_H
18 
19 #include <napi/native_api.h>
20 
21 #include "common_context.h"
22 #include "tls_send_context.h"
23 #include "tls_bind_context.h"
24 #include "tls_extra_context.h"
25 #include "tls_napi_context.h"
26 #include "tls_connect_context.h"
27 
28 namespace OHOS {
29 namespace NetStack {
30 namespace TlsSocket {
31 class TLSSocketExec final {
32 public:
33     TLSSocketExec() = delete;
34     ~TLSSocketExec() = delete;
35 
36     static bool ExecGetCertificate(GetCertificateContext *context);
37     static bool ExecConnect(TLSConnectContext *context);
38     static bool ExecGetCipherSuites(GetCipherSuitesContext *context);
39     static bool ExecGetRemoteCertificate(GetRemoteCertificateContext *context);
40     static bool ExecGetProtocol(GetProtocolContext *context);
41     static bool ExecGetSignatureAlgorithms(GetSignatureAlgorithmsContext *context);
42     static bool ExecSend(TLSSendContext *context);
43     static bool ExecClose(TLSNapiContext *context);
44     static bool ExecBind(TLSBindContext *context);
45     static bool ExecGetState(TLSGetStateContext *context);
46     static bool ExecGetRemoteAddress(TLSGetRemoteAddressContext *context);
47     static bool ExecSetExtraOptions(TLSSetExtraOptionsContext *context);
48 
49     static napi_value GetCertificateCallback(GetCertificateContext *context);
50     static napi_value ConnectCallback(TLSConnectContext *context);
51     static napi_value GetCipherSuitesCallback(GetCipherSuitesContext *context);
52     static napi_value GetRemoteCertificateCallback(GetRemoteCertificateContext *context);
53     static napi_value GetProtocolCallback(GetProtocolContext *context);
54     static napi_value GetSignatureAlgorithmsCallback(GetSignatureAlgorithmsContext *context);
55     static napi_value SendCallback(TLSSendContext *context);
56     static napi_value CloseCallback(TLSNapiContext *context);
57     static napi_value BindCallback(TLSBindContext *context);
58     static napi_value GetStateCallback(TLSGetStateContext *context);
59     static napi_value GetRemoteAddressCallback(TLSGetRemoteAddressContext *context);
60     static napi_value SetExtraOptionsCallback(TLSSetExtraOptionsContext *context);
61 };
62 } // namespace TlsSocket
63 } // namespace NetStack
64 } // namespace OHOS
65 #endif // TLS_TLSSOCKET_EXEC_H
66