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