1 /***************************************************************************
2  * Copyright (c) 2024 Microsoft Corporation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the MIT License which is available at
6  * https://opensource.org/licenses/MIT.
7  *
8  * SPDX-License-Identifier: MIT
9  **************************************************************************/
10 
11 
12 /**************************************************************************/
13 /**************************************************************************/
14 /**                                                                       */
15 /** NetX Component                                                        */
16 /**                                                                       */
17 /**   HTTP Proxy Protocol                                                 */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 /**************************************************************************/
23 /*                                                                        */
24 /*  APPLICATION INTERFACE DEFINITION                       RELEASE        */
25 /*                                                                        */
26 /*    nx_http_proxy_client.h                              PORTABLE C      */
27 /*                                                           6.2.0        */
28 /*  AUTHOR                                                                */
29 /*                                                                        */
30 /*    Wenhui Xie, Microsoft Corporation                                   */
31 /*                                                                        */
32 /*  DESCRIPTION                                                           */
33 /*                                                                        */
34 /*    This file defines the Hypertext Transfer Protocol(HTTP) Proxy       */
35 /*    component, including all data types and external references.        */
36 /*    It is assumed that nx_api.h and nx_port.h have already been         */
37 /*    included.                                                           */
38 /*                                                                        */
39 /*  RELEASE HISTORY                                                       */
40 /*                                                                        */
41 /*    DATE              NAME                      DESCRIPTION             */
42 /*                                                                        */
43 /*  10-31-2022     Wenhui Xie               Initial Version 6.2.0         */
44 /*                                                                        */
45 /**************************************************************************/
46 
47 #ifndef NX_HTTP_PROXY_CLIENT_H
48 #define NX_HTTP_PROXY_CLIENT_H
49 
50 /* Determine if a C++ compiler is being used.  If so, ensure that standard
51    C is used to process the API information.  */
52 
53 
54 #ifdef   __cplusplus
55 
56 /* Yes, C++ compiler is present.  Use standard C.  */
57 extern   "C" {
58 
59 #endif
60 
61 #include    "nx_api.h"
62 
63 /* Define the states for HTTP Proxy connection.  */
64 #define NX_HTTP_PROXY_STATE_INIT                0
65 #define NX_HTTP_PROXY_STATE_WAITING             1
66 #define NX_HTTP_PROXY_STATE_CONNECTING          2
67 #define NX_HTTP_PROXY_STATE_CONNECTED           3
68 
69 /* Define HTTP Proxy function prototypes.  */
70 UINT _nx_http_proxy_client_enable(NX_IP *ip_ptr, NXD_ADDRESS *proxy_server_ip, UINT proxy_server_port,
71                                   UCHAR *username, UINT username_length, UCHAR *password, UINT password_length);
72 VOID _nx_http_proxy_client_initialize(NX_TCP_SOCKET *socket_ptr, NXD_ADDRESS **server_ip, UINT *server_port);
73 UINT _nx_http_proxy_client_connect(NX_TCP_SOCKET *socket_ptr);
74 UINT _nx_http_proxy_client_connect_response_process(NX_TCP_SOCKET *socket_ptr);
75 VOID _nx_http_proxy_client_cleanup(NX_TCP_SOCKET *socket_ptr);
76 
77 /* Define error checking shells for API services.  These are only referenced by the
78    application.  */
79 UINT _nxe_http_proxy_client_enable(NX_IP *ip_ptr, NXD_ADDRESS *proxy_server_ip, UINT proxy_server_port,
80                                    UCHAR *username, UINT username_length, UCHAR *password, UINT password_length);
81 
82 /* Determine if a C++ compiler is being used.  If so, complete the standard
83    C conditional started above.  */
84 #ifdef   __cplusplus
85         }
86 #endif
87 
88 #endif  /* NX_HTTP_PROXY_CLIENT_H */