1 /* This case tests HTTP Proxy error response. */
2 #include    "tx_api.h"
3 #include    "nx_api.h"
4 
5 extern void test_control_return(UINT);
6 
7 #if !defined(NX_DISABLE_IPV4) && defined(NX_ENABLE_HTTP_PROXY) && !defined(NX_DISABLE_EXTENDED_NOTIFY_SUPPORT) && defined(__PRODUCT_NETXDUO__)
8 #include    "nx_http_proxy_client.h"
9 
10 #define     DEMO_STACK_SIZE         4096
11 #define     PACKET_SIZE             1536
12 #define     TOTAL_SIZE              DEMO_STACK_SIZE + (PACKET_SIZE * 8) + 2048 + 1024
13 
14 /* Define device drivers.  */
15 extern void _nx_ram_network_driver_1024(NX_IP_DRIVER *driver_req_ptr);
16 
17 static TX_THREAD           client_thread;
18 static NX_PACKET_POOL      client_pool;
19 static NX_TCP_SOCKET       test_client;
20 static NX_IP               client_ip;
21 static UINT                error_counter;
22 
23 static NX_TCP_SOCKET       test_server;
24 static NX_PACKET_POOL      server_pool;
25 static TX_THREAD           server_thread;
26 static NX_IP               server_ip;
27 static UINT                test_server_start = 0;
28 static UINT                test_client_stop = 0;
29 
30 /* Set up the HTTP proxy server global variables */
31 static TX_THREAD           proxy_thread;
32 static NX_PACKET_POOL      proxy_pool;
33 static NX_IP               proxy_ip;
34 static NX_TCP_SOCKET       agent_server, agent_client;
35 
36 static void thread_client_entry(ULONG thread_input);
37 static void thread_server_entry(ULONG thread_input);
38 static void thread_proxy_entry(ULONG thread_input);
39 
40 #define TEST_SERVER_ADDRESS  IP_ADDRESS(1,2,3,4)
41 #define TEST_CLIENT_ADDRESS  IP_ADDRESS(1,2,3,5)
42 #define HTTP_PROXY_ADDRESS   IP_ADDRESS(1,2,3,6)
43 #define HTTP_PROXY_PORT      8888
44 #define TEST_SERVER_PORT     8080
45 
46 static UCHAR connect_200[] =
47 {
48 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x32, 0x30, 0x30, 0x20, 0x43, 0x6f, 0x6e,  /* HTTP/1.0 200 Con */
49 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x65, 0x73, 0x74, 0x61, 0x62, 0x6c, 0x69, 0x73,  /* nection establis */
50 0x68, 0x65, 0x64, 0x0d, 0x0a, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x2d, 0x61, 0x67, 0x65, 0x6e, 0x74,  /* hed..Proxy-agent */
51 0x3a, 0x20, 0x74, 0x69, 0x6e, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x31, 0x2e, 0x38, 0x2e,  /* : tinyproxy/1.8. */
52 0x34, 0x0d, 0x0a, 0x0d, 0x0a,                                                                    /* 4.... */
53 };
54 
55 static UCHAR connect_req[] =
56 {
57 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x20, 0x31, 0x2e, 0x32, 0x2e, 0x33, 0x2e, 0x34, 0x3a,  /* CONNECT 1.2.3.4: */
58 0x38, 0x30, 0x38, 0x30, 0x20, 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x31, 0x0d, 0x0a, 0x48,  /* 8080 HTTP/1.1..H */
59 0x6f, 0x73, 0x74, 0x3a, 0x20, 0x31, 0x2e, 0x32, 0x2e, 0x33, 0x2e, 0x34, 0x0d, 0x0a, 0x50, 0x72,  /* ost: 1.2.3.4..Pr */
60 0x6f, 0x78, 0x79, 0x2d, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f,  /* oxy-authorizatio */
61 0x6e, 0x3a, 0x20, 0x42, 0x61, 0x73, 0x69, 0x63, 0x20, 0x64, 0x58, 0x4e, 0x6c, 0x63, 0x6a, 0x70,  /* n: Basic dXNlcjp */
62 0x77, 0x59, 0x58, 0x4e, 0x7a, 0x64, 0x32, 0x39, 0x79, 0x5a, 0x41, 0x3d, 0x3d, 0x0d, 0x0a, 0x0d,  /* wYXNzd29yZA==... */
63 0x0a
64 };
65 
66 static UCHAR connect_403[] =
67 {
68 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x34, 0x30, 0x33, 0x20, 0x41, 0x63, 0x63,  /* HTTP/1.0 403 Acc */
69 0x65, 0x73, 0x73, 0x20, 0x76, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x0d, 0x0a, 0x53,  /* ess violation..S */
70 0x65, 0x72, 0x76, 0x65, 0x72, 0x3a, 0x20, 0x74, 0x69, 0x6e, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79,  /* erver: tinyproxy */
71 0x2f, 0x31, 0x2e, 0x38, 0x2e, 0x34, 0x0d, 0x0a, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d,  /* /1.8.4..Content- */
72 0x54, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 0x0d,  /* Type: text/html. */
73 0x0a, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x63, 0x6c, 0x6f,  /* .Connection: clo */
74 0x73, 0x65, 0x0d, 0x0a, 0x0d, 0x0a,                                                              /* se.... */
75 };
76 
77 static UCHAR test_data[] = "HTTP Proxy Basic Test!";
78 
79 #define TEST_LOOP 2
80 
81 #ifdef CTEST
test_application_define(void * first_unused_memory)82 VOID test_application_define(void *first_unused_memory)
83 #else
84 void    netx_http_proxy_error_response_test_application_define(void *first_unused_memory)
85 #endif
86 {
87 CHAR    *pointer;
88 UINT    status;
89 
90 
91     error_counter = 0;
92 
93     /* Setup the working pointer.  */
94     pointer =  (CHAR *) first_unused_memory;
95 
96     /* Create a helper thread for the server. */
97     tx_thread_create(&server_thread, "Test Server thread", thread_server_entry, 0,
98                      pointer, DEMO_STACK_SIZE,
99                      4, 4, TX_NO_TIME_SLICE, TX_AUTO_START);
100 
101     pointer =  pointer + DEMO_STACK_SIZE;
102 
103     /* Initialize the NetX system.  */
104     nx_system_initialize();
105 
106     /* Create the server packet pool.  */
107     status =  nx_packet_pool_create(&server_pool, "Test Server Packet Pool", PACKET_SIZE,
108                                     pointer, PACKET_SIZE * 8);
109     pointer = pointer + PACKET_SIZE * 8;
110     if (status)
111         error_counter++;
112 
113     /* Create an IP instance.  */
114     status = nx_ip_create(&server_ip, "Test Server IP", TEST_SERVER_ADDRESS,
115                           0xFFFFFF00UL, &server_pool, _nx_ram_network_driver_1024,
116                           pointer, 2048, 1);
117     pointer =  pointer + 2048;
118     if (status)
119         error_counter++;
120 
121     /* Enable ARP and supply ARP cache memory for the server IP instance.  */
122     status = nx_arp_enable(&server_ip, (void *) pointer, 1024);
123     pointer = pointer + 1024;
124     if (status)
125         error_counter++;
126 
127 
128      /* Enable TCP traffic.  */
129     status = nx_tcp_enable(&server_ip);
130     if (status)
131         error_counter++;
132 
133     /* Create the Test Client thread. */
134     status = tx_thread_create(&client_thread, "Test Client", thread_client_entry, 0,
135                               pointer, DEMO_STACK_SIZE,
136                               6, 6, TX_NO_TIME_SLICE, TX_AUTO_START);
137     pointer =  pointer + DEMO_STACK_SIZE;
138     if (status)
139         error_counter++;
140 
141     /* Create the Client packet pool.  */
142     status =  nx_packet_pool_create(&client_pool, "Test Client Packet Pool", PACKET_SIZE,
143                                     pointer, PACKET_SIZE * 8);
144     pointer = pointer + PACKET_SIZE * 8;
145     if (status)
146         error_counter++;
147 
148     /* Create an IP instance.  */
149     status = nx_ip_create(&client_ip, "Test Client IP", TEST_CLIENT_ADDRESS,
150                           0xFFFFFF00UL, &client_pool, _nx_ram_network_driver_1024,
151                           pointer, 2048, 1);
152     pointer =  pointer + 2048;
153     if (status)
154         error_counter++;
155 
156     status  = nx_arp_enable(&client_ip, (void *) pointer, 1024);
157     pointer =  pointer + 1024;
158     if (status)
159         error_counter++;
160 
161      /* Enable TCP traffic.  */
162     status = nx_tcp_enable(&client_ip);
163     if (status)
164         error_counter++;
165 
166     /* Create the HTTP Proxy thread. */
167     status = tx_thread_create(&proxy_thread, "HTTP Proxy", thread_proxy_entry, 0,
168                               pointer, DEMO_STACK_SIZE,
169                               5, 5, TX_NO_TIME_SLICE, TX_AUTO_START);
170     pointer =  pointer + DEMO_STACK_SIZE;
171     if (status)
172         error_counter++;
173 
174     /* Create the Client packet pool.  */
175     status =  nx_packet_pool_create(&proxy_pool, "HTTP Proxy Packet Pool", PACKET_SIZE,
176                                     pointer, PACKET_SIZE * 8);
177     pointer = pointer + PACKET_SIZE * 8;
178     if (status)
179         error_counter++;
180 
181     /* Create an IP instance.  */
182     status = nx_ip_create(&proxy_ip, "HTTP Proxy IP", HTTP_PROXY_ADDRESS,
183                           0xFFFFFF00UL, &proxy_pool, _nx_ram_network_driver_1024,
184                           pointer, 2048, 1);
185     pointer =  pointer + 2048;
186     if (status)
187         error_counter++;
188 
189     status  = nx_arp_enable(&proxy_ip, (void *) pointer, 1024);
190     pointer =  pointer + 1024;
191     if (status)
192         error_counter++;
193 
194      /* Enable TCP traffic.  */
195     status = nx_tcp_enable(&proxy_ip);
196     if (status)
197         error_counter++;
198 }
199 
200 static UINT connected = NX_FALSE;
test_establish_notify(NX_TCP_SOCKET * socekt_ptr)201 static void test_establish_notify(NX_TCP_SOCKET *socekt_ptr)
202 {
203     connected = NX_TRUE;
204 }
205 
thread_client_entry(ULONG thread_input)206 void thread_client_entry(ULONG thread_input)
207 {
208 UINT            i, status;
209 NX_PACKET       *packet_ptr;
210 NXD_ADDRESS     proxy_server_address;
211 NXD_ADDRESS     server_ip_address;
212 
213 
214     /* Give IP task and driver a chance to initialize the system.  */
215     tx_thread_sleep(NX_IP_PERIODIC_RATE);
216 
217     /* Set server IP address.  */
218     server_ip_address.nxd_ip_address.v4 = TEST_SERVER_ADDRESS;
219     server_ip_address.nxd_ip_version = NX_IP_VERSION_V4;
220 
221     proxy_server_address.nxd_ip_version = NX_IP_VERSION_V4;
222     proxy_server_address.nxd_ip_address.v4 = HTTP_PROXY_ADDRESS;
223     nx_http_proxy_client_enable(&client_ip, &proxy_server_address, HTTP_PROXY_PORT, "user", sizeof("user") - 1, "password", sizeof("password") - 1);
224 
225     status = nx_tcp_socket_create(&client_ip, &test_client, "Test Client Socket",
226                                   NX_IP_NORMAL, NX_FRAGMENT_OKAY, NX_IP_TIME_TO_LIVE, 1000,
227                                   NX_NULL, NX_NULL);
228     if(status)
229         error_counter++;
230 
231     nx_tcp_socket_establish_notify(&test_client, test_establish_notify);
232 
233     /* Bind and connect to server.  */
234     status = nx_tcp_client_socket_bind(&test_client, NX_ANY_PORT, NX_IP_PERIODIC_RATE);
235     if(status)
236         error_counter++;
237 
238     for ( i = 0; i < TEST_LOOP; i++)
239     {
240 
241         /* Wait test server started.  */
242         while(!test_server_start)
243         {
244             tx_thread_sleep(NX_IP_PERIODIC_RATE);
245         }
246 
247         connected = NX_FALSE;
248 
249         if (i % 2 == 0)
250         {
251 
252             status = nxd_tcp_client_socket_connect(&test_client, &server_ip_address, TEST_SERVER_PORT, NX_NO_WAIT);
253             if(status != NX_IN_PROGRESS)
254                 error_counter++;
255 
256             status = nx_tcp_socket_state_wait(&test_client, NX_TCP_ESTABLISHED, NX_IP_PERIODIC_RATE);
257         }
258         else
259         {
260             status = nxd_tcp_client_socket_connect(&test_client, &server_ip_address, TEST_SERVER_PORT, NX_IP_PERIODIC_RATE);
261         }
262 
263         /* Received error response.  */
264         if (!status || (connected == NX_TRUE))
265         {
266             error_counter++;
267             test_client_stop = 1;
268             return;
269         }
270 
271         if (i % 2 == 0)
272         {
273 
274             status = nxd_tcp_client_socket_connect(&test_client, &server_ip_address, TEST_SERVER_PORT, NX_NO_WAIT);
275             if(status != NX_IN_PROGRESS)
276                 error_counter++;
277 
278             status = nx_tcp_socket_state_wait(&test_client, NX_TCP_ESTABLISHED, NX_IP_PERIODIC_RATE);
279         }
280         else
281         {
282             status = nxd_tcp_client_socket_connect(&test_client, &server_ip_address, TEST_SERVER_PORT, NX_IP_PERIODIC_RATE);
283         }
284 
285         if (status || (connected != NX_TRUE))
286         {
287             error_counter++;
288             test_client_stop = 1;
289             return;
290         }
291 
292         /* Send data.  */
293         status = nx_packet_allocate(&client_pool, &packet_ptr, NX_TCP_PACKET, NX_IP_PERIODIC_RATE);
294         if(status)
295             error_counter++;
296 
297         status = nx_packet_data_append(packet_ptr, test_data, sizeof(test_data) - 1, &client_pool, NX_IP_PERIODIC_RATE);
298         if(status)
299             error_counter++;
300 
301         status = nx_tcp_socket_send(&test_client, packet_ptr, NX_IP_PERIODIC_RATE);
302         if(status)
303             error_counter++;
304 
305         /* Receive the echo data from server.  */
306         status = nx_tcp_socket_receive(&test_client, &packet_ptr, 5 * NX_IP_PERIODIC_RATE);
307         if(status)
308             error_counter++;
309         else
310         {
311 
312             /* Check the received data.  */
313             if ((packet_ptr -> nx_packet_length != (sizeof(test_data) - 1)) ||
314                 (memcmp(packet_ptr -> nx_packet_prepend_ptr, test_data, packet_ptr -> nx_packet_length) != 0))
315                 error_counter++;
316 
317             nx_packet_release(packet_ptr);
318         }
319 
320         /* Set the flag.  */
321         test_client_stop = 1;
322         nx_tcp_socket_disconnect(&test_client, NX_IP_PERIODIC_RATE);
323     }
324 
325     nx_tcp_client_socket_unbind(&test_client);
326     nx_tcp_socket_delete(&test_client);
327 }
328 
thread_proxy_entry(ULONG thread_input)329 void thread_proxy_entry(ULONG thread_input)
330 {
331 UINT       i, status;
332 ULONG      actual_status;
333 NX_PACKET  *packet_ptr;
334 NXD_ADDRESS server_ip_address;
335 
336     /* Set server IP address.  */
337     server_ip_address.nxd_ip_address.v4 = TEST_SERVER_ADDRESS;
338     server_ip_address.nxd_ip_version = NX_IP_VERSION_V4;
339 
340     /* Ensure the IP instance has been initialized.  */
341     status = nx_ip_status_check(&proxy_ip, NX_IP_INITIALIZE_DONE, &actual_status, NX_IP_PERIODIC_RATE);
342     if(status)
343         error_counter++;
344 
345     /* Create a socket.  */
346     status = nx_tcp_socket_create(&proxy_ip, &agent_server, "Agent Server Socket",
347                                   NX_IP_NORMAL, NX_FRAGMENT_OKAY, NX_IP_TIME_TO_LIVE, 1000,
348                                   NX_NULL, NX_NULL);
349     status += nx_tcp_socket_create(&proxy_ip, &agent_client, "Agent Client Socket",
350                                    NX_IP_NORMAL, NX_FRAGMENT_OKAY, NX_IP_TIME_TO_LIVE, 1000,
351                                    NX_NULL, NX_NULL);
352     if(status)
353         error_counter++;
354 
355     /* Setup this thread to listen.  */
356     status = nx_tcp_server_socket_listen(&proxy_ip, HTTP_PROXY_PORT, &agent_server, 5, NX_NULL);
357     if(status)
358         error_counter++;
359 
360     for (i = 0; i < TEST_LOOP; i++)
361     {
362 
363         /* Accept a connection from test client.  */
364         status = nx_tcp_server_socket_accept(&agent_server, 5 * NX_IP_PERIODIC_RATE);
365         if(status)
366             error_counter++;
367 
368         /* Receive CONNECT request.  */
369         status = nx_tcp_socket_receive(&agent_server, &packet_ptr, 5 * NX_IP_PERIODIC_RATE);
370         if(status)
371             error_counter++;
372 
373         /* Send error response to test client.  */
374         packet_ptr -> nx_packet_append_ptr = packet_ptr -> nx_packet_prepend_ptr;
375         packet_ptr -> nx_packet_length = 0;
376         nx_packet_data_append(packet_ptr, connect_403, sizeof(connect_403), &proxy_pool, NX_IP_PERIODIC_RATE);
377         status = nx_tcp_socket_send(&agent_server, packet_ptr, NX_IP_PERIODIC_RATE);
378         if(status)
379             error_counter++;
380 
381         /* Disconnet.  */
382         nx_tcp_socket_disconnect(&agent_server, NX_IP_PERIODIC_RATE);
383         nx_tcp_server_socket_unaccept(&agent_server);
384         nx_tcp_server_socket_relisten(&proxy_ip, HTTP_PROXY_PORT, &agent_server);
385 
386         /* Accept a connection from test client.  */
387         status = nx_tcp_server_socket_accept(&agent_server, 5 * NX_IP_PERIODIC_RATE);
388         if(status)
389             error_counter++;
390 
391         /* Receive CONNECT request.  */
392         status = nx_tcp_socket_receive(&agent_server, &packet_ptr, 5 * NX_IP_PERIODIC_RATE);
393         if(status)
394             error_counter++;
395 
396         /* Check the received CONNECT request.  */
397         if (memcmp(packet_ptr -> nx_packet_prepend_ptr, connect_req, sizeof(connect_req)) != 0)
398             error_counter++;
399 
400         /* Connect to the test server.  */
401         status = nx_tcp_client_socket_bind(&agent_client, NX_ANY_PORT, NX_IP_PERIODIC_RATE);
402         status += nxd_tcp_client_socket_connect(&agent_client, &server_ip_address, TEST_SERVER_PORT, NX_IP_PERIODIC_RATE);
403         if(status)
404             error_counter++;
405 
406         /* Send response to test client.  */
407         packet_ptr -> nx_packet_append_ptr = packet_ptr -> nx_packet_prepend_ptr;
408         packet_ptr -> nx_packet_length = 0;
409         nx_packet_data_append(packet_ptr, connect_200, sizeof(connect_200), &proxy_pool, NX_IP_PERIODIC_RATE);
410         status = nx_tcp_socket_send(&agent_server, packet_ptr, NX_IP_PERIODIC_RATE);
411         if(status)
412             error_counter++;
413 
414         /* Tunneling...  */
415         status = nx_tcp_socket_receive(&agent_server, &packet_ptr, 5 * NX_IP_PERIODIC_RATE);
416         if(status)
417             error_counter++;
418         status = nx_tcp_socket_send(&agent_client, packet_ptr, NX_IP_PERIODIC_RATE);
419         if(status)
420             error_counter++;
421         status = nx_tcp_socket_receive(&agent_client, &packet_ptr, 5 * NX_IP_PERIODIC_RATE);
422         if(status)
423             error_counter++;
424         status = nx_tcp_socket_send(&agent_server, packet_ptr, NX_IP_PERIODIC_RATE);
425         if(status)
426             error_counter++;
427 
428         /* Wait client test finished.  */
429         tx_thread_sleep(NX_IP_PERIODIC_RATE);
430 
431         /* Disconnet.  */
432         nx_tcp_socket_disconnect(&agent_server, NX_IP_PERIODIC_RATE);
433         nx_tcp_server_socket_unaccept(&agent_server);
434         nx_tcp_server_socket_relisten(&proxy_ip, HTTP_PROXY_PORT, &agent_server);
435         nx_tcp_socket_disconnect(&agent_client, NX_IP_PERIODIC_RATE);
436         nx_tcp_client_socket_unbind(&agent_client);
437     }
438 
439     nx_tcp_socket_delete(&agent_server);
440     nx_tcp_socket_delete(&agent_client);
441 }
442 
443 /* Define the helper Test server thread.  */
thread_server_entry(ULONG thread_input)444 void    thread_server_entry(ULONG thread_input)
445 {
446 UINT            i, status;
447 NX_PACKET       *packet_ptr;
448 
449 
450     /* Print out test information banner.  */
451     printf("NetX Test:   HTTP Proxy Error Response Test............................");
452 
453     /* Check for earlier error.  */
454     if(error_counter)
455     {
456         printf("ERROR!\n");
457         test_control_return(1);
458     }
459 
460     /* Give NetX a chance to initialize the system.  */
461     tx_thread_sleep(NX_IP_PERIODIC_RATE);
462 
463     status = nx_tcp_socket_create(&server_ip, &test_server, "Test Server Socket",
464                                   NX_IP_NORMAL, NX_FRAGMENT_OKAY, NX_IP_TIME_TO_LIVE, 1000,
465                                   NX_NULL, NX_NULL);
466 
467     status = nx_tcp_server_socket_listen(&server_ip, TEST_SERVER_PORT, &test_server, 5, NX_NULL);
468     if(status)
469         error_counter++;
470 
471     for (i = 0; i < TEST_LOOP; i++)
472     {
473 
474         /* Set the flag.  */
475         test_server_start = 1;
476 
477         /* Accept a connection from test client.  */
478         status = nx_tcp_server_socket_accept(&test_server, 5 * NX_IP_PERIODIC_RATE);
479         if(status)
480             error_counter++;
481 
482         /* Receive client data.  */
483         status = nx_tcp_socket_receive(&test_server, &packet_ptr, 5 * NX_IP_PERIODIC_RATE);
484         if(status)
485             error_counter++;
486 
487         /* Echo data.  */
488         status = nx_tcp_socket_send(&test_server, packet_ptr, NX_IP_PERIODIC_RATE);
489         if(status)
490             error_counter++;
491 
492         /* Wait client test finished.  */
493         while(!test_client_stop)
494         {
495             tx_thread_sleep(NX_IP_PERIODIC_RATE);
496         }
497         test_server_start = 0;
498         test_client_stop = 0;
499 
500         nx_tcp_socket_disconnect(&test_server, NX_IP_PERIODIC_RATE);
501         nx_tcp_server_socket_unaccept(&test_server);
502         nx_tcp_server_socket_relisten(&server_ip, TEST_SERVER_PORT, &test_server);
503     }
504     nx_tcp_server_socket_unlisten(&server_ip, TEST_SERVER_PORT);
505     nx_tcp_socket_delete(&test_server);
506 
507     /* Check packet pool.  */
508     if (server_pool.nx_packet_pool_available != server_pool.nx_packet_pool_total)
509     {
510         error_counter++;
511     }
512 
513     if (client_pool.nx_packet_pool_available != client_pool.nx_packet_pool_total)
514     {
515         error_counter++;
516     }
517 
518     if(error_counter)
519     {
520         printf("ERROR!\n");
521         test_control_return(1);
522     }
523     else
524     {
525         printf("SUCCESS!\n");
526         test_control_return(0);
527     }
528 }
529 
530 #else
531 
532 #ifdef CTEST
test_application_define(void * first_unused_memory)533 VOID test_application_define(void *first_unused_memory)
534 #else
535 void    netx_http_proxy_error_response_test_application_define(void *first_unused_memory)
536 #endif
537 {
538 
539     /* Print out test information banner.  */
540     printf("NetX Test:   HTTP Proxy Error Response Test............................N/A\n");
541 
542     test_control_return(3);
543 }
544 #endif
545 
546