1 /*
2 This is a small demo of POP3 Client on the high-performance NetX TCP/IP stack.
3 This demo relies on Thread, NetX and POP3 Client API to conduct
4 a POP3 mail session.
5
6 The POP3 'server' is a TCP socket that sends responses and downloads a mail item
7 of three packets.
8 */
9
10 #include "tx_api.h"
11 #include "nx_api.h"
12 #include "nx_ram_network_driver_test_1500.h"
13 #include "nxd_pop3_client.h"
14 extern void test_control_return(UINT);
15 #if !defined(NX_DISABLE_IPV4)
16
17 #define DEMO_STACK_SIZE 2048
18 #define SERVER_PORT 110
19
20 static UINT error_counter = 0;
21 static UINT client_running = NX_TRUE;
22
23 extern void _nx_ram_network_driver_1024(NX_IP_DRIVER *driver_req_ptr);
24 static UINT nx_pop3_response_packet_send(NX_TCP_SOCKET *server_socket_ptr, INT packet_number);
25 static UINT pop3_initialize_responses();
26
27 /* Set up Client thread entry point. */
28 static void client_thread_entry(ULONG info);
29 /* Set up Server thread entry point. */
30 static void server_thread_entry(ULONG info);
31
32
33 /* Set up the POP3 Client and POP3 server socket. */
34
35 static TX_THREAD client_thread;
36 static NX_POP3_CLIENT pop3_client;
37 static NX_PACKET_POOL client_packet_pool;
38 static NX_IP client_ip;
39 static TX_THREAD server_thread;
40 static NX_TCP_SOCKET server_socket;
41 static NX_PACKET_POOL server_packet_pool;
42 static NX_IP server_ip;
43
44 /* Use the maximum size payload to insure no packets are dropped. */
45 #define PAYLOAD_SIZE 1514
46
47 /* Shared secret is the same as password. */
48
49 #define LOCALHOST "recipient@domain.com"
50 #define LOCALHOST_PASSWORD "testpwd"
51
52 typedef struct POP3_RESPONSE_STRUCT
53 {
54 char *pop3_response_pkt_data;
55 int pop3_response_pkt_size;
56 } POP3_RESPONSE;
57
58 #define NUM_RESPONSES 10
59 static POP3_RESPONSE pop3_response[NUM_RESPONSES];
60
61
62 static char greeting[115] = {
63 0x2b, 0x4f, /* ..\...+O */
64 0x4b, 0x20, 0x6d, 0x61, 0x69, 0x6c, 0x2e, 0x65, /* K mail.e */
65 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x6c, 0x6f, /* xpresslo */
66 0x67, 0x69, 0x63, 0x2e, 0x63, 0x6f, 0x6d, 0x20, /* gic.com */
67 0x50, 0x4f, 0x50, 0x33, 0x20, 0x4d, 0x44, 0x61, /* POP3 MDa */
68 0x65, 0x6d, 0x6f, 0x6e, 0x20, 0x31, 0x35, 0x2e, /* emon 15. */
69 0x35, 0x2e, 0x33, 0x20, 0x72, 0x65, 0x61, 0x64, /* 5.3 read */
70 0x79, 0x20, 0x3c, 0x4d, 0x44, 0x41, 0x45, 0x4d, /* y <MDAEM */
71 0x4f, 0x4e, 0x2d, 0x46, 0x32, 0x30, 0x31, 0x36, /* ON-F2016 */
72 0x31, 0x30, 0x30, 0x34, 0x31, 0x31, 0x35, 0x32, /* 10041152 */
73 0x2e, 0x41, 0x41, 0x35, 0x32, 0x35, 0x36, 0x38, /* .AA52568 */
74 0x39, 0x30, 0x4d, 0x44, 0x31, 0x32, 0x30, 0x33, /* 90MD1203 */
75 0x40, 0x6d, 0x61, 0x69, 0x6c, 0x2e, 0x65, 0x78, /* @mail.ex */
76 0x70, 0x72, 0x65, 0x73, 0x73, 0x6c, 0x6f, 0x67, /* presslog */
77 0x69, 0x63, 0x2e, 0x63, 0x6f, 0x6d, 0x3e, 0x0d, /* ic.com>. */
78 0x0a /* . */
79 };
80
81 static int greeting_size = 115;
82
83 static char user_ok[47] = {
84 0x2b, 0x4f, /* ...c..+O */
85 0x4b, 0x20, 0x74, 0x65, 0x73, 0x74, 0x72, 0x65, /* K testre */
86 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x40, /* cipient@ */
87 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x6c, /* expressl */
88 0x6f, 0x67, 0x69, 0x63, 0x2e, 0x63, 0x6f, 0x6d, /* ogic.com */
89 0x2e, 0x2e, 0x2e, 0x20, 0x55, 0x73, 0x65, 0x72, /* ... User */
90 0x20, 0x6f, 0x6b, 0x0d, 0x0a /* ok.. */
91 };
92
93 static int user_ok_size = 47;
94
95 static char password_ok[83] = {
96 0x2b, 0x4f, /* ...p..+O */
97 0x4b, 0x20, 0x74, 0x65, 0x73, 0x74, 0x72, 0x65, /* K testre */
98 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x40, /* cipient@ */
99 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x6c, /* expressl */
100 0x6f, 0x67, 0x69, 0x63, 0x2e, 0x63, 0x6f, 0x6d, /* ogic.com */
101 0x27, 0x73, 0x20, 0x6d, 0x61, 0x69, 0x6c, 0x62, /* 's mailb */
102 0x6f, 0x78, 0x20, 0x68, 0x61, 0x73, 0x20, 0x31, /* ox has 1 */
103 0x20, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x20, 0x6d, /* total m */
104 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x20, /* essages */
105 0x28, 0x31, 0x38, 0x37, 0x34, 0x30, 0x32, 0x20, /* (187402 */
106 0x6f, 0x63, 0x74, 0x65, 0x74, 0x73, 0x29, 0x0d, /* octets). */
107 0x0a /* . */
108 };
109
110 static int password_ok_size = 83;
111
112 static char stat_ok[14] = {
113 0x2b, 0x4f, /* ..}...+O */
114 0x4b, 0x20, 0x31, 0x20, 0x31, 0x38, 0x37, 0x34, /* K 1 1874 */
115 0x30, 0x32, 0x0d, 0x0a /* 02.. */
116 };
117
118 static int stat_ok_size = 14;
119
120 static char retr_ok[19] = {
121 0x2b, 0x4f, /* ..Tv..+O */
122 0x4b, 0x20, 0x31, 0x38, 0x37, 0x34, 0x30, 0x32, /* K 187402 */
123 0x20, 0x6f, 0x63, 0x74, 0x65, 0x74, 0x73, 0x0d, /* octets. */
124 0x0a /* . */
125 };
126
127 static int retr_ok_size = 19;
128
129
130 static char first_data_packet[82] = {
131 0x52, 0x65, /* ..G...Re */
132 0x74, 0x75, 0x72, 0x6e, 0x2d, 0x70, 0x61, 0x74, /* turn-pat */
133 0x68, 0x3a, 0x20, 0x3c, 0x74, 0x65, 0x73, 0x74, /* h: <test */
134 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, /* recipien */
135 0x74, 0x74, 0x65, 0x73, 0x74, 0x32, 0x40, 0x67, /* ttest2@g */
136 0x6d, 0x61, 0x69, 0x6c, 0x2e, 0x63, 0x6f, 0x6d, /* mail.com */
137 0x3e, 0x0d, 0x0a, 0x41, 0x75, 0x74, 0x68, 0x65, /* >..Authe */
138 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, /* nticatio */
139 0x6e, 0x2d, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, /* n-Result */
140 0x73, 0x3a, 0x20, 0x65, 0x78, 0x70, 0x72, 0x65, /* s: expre */
141 0x73, 0x73, 0x6c, 0x6f, 0x67, 0x69, 0x63, 0x2e
142 };
143
144 static int first_data_packet_size = 82;
145
146 static char second_data_packet[82] = {
147 0x65, 0x64, /* ......ed */
148 0x3b, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, /* ;.. */
149 0x20, 0x20, 0x20, 0x64, 0x3d, 0x67, 0x6d, 0x61, /* d=gma */
150 0x69, 0x6c, 0x2e, 0x63, 0x6f, 0x6d, 0x3b, 0x20, /* il.com; */
151 0x73, 0x3d, 0x32, 0x30, 0x31, 0x32, 0x30, 0x31, /* s=201201 */
152 0x31, 0x33, 0x3b, 0x0d, 0x0a, 0x20, 0x20, 0x20, /* 13;.. */
153 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x3d, 0x63, /* h=c */
154 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, /* ontent-t */
155 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x2d, /* ransfer- */
156 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, /* encoding */
157 0x3a, 0x66, 0x72, 0x6f, 0x6d, 0x3a, 0x6d, 0x69
158 };
159
160 static int second_data_packet_size = 82;
161
162 static char last_data_packet[82] = {
163 0x65, 0x64, /* ......ed */
164 0x3b, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, /* ;.. */
165 0x20, 0x20, 0x20, 0x64, 0x3d, 0x67, 0x6d, 0x61, /* d=gma */
166 0x69, 0x6c, 0x2e, 0x63, 0x6f, 0x6d, 0x3b, 0x20, /* il.com; */
167 0x73, 0x3d, 0x32, 0x30, 0x31, 0x32, 0x30, 0x31, /* s=201201 */
168 0x31, 0x33, 0x3b, 0x0d, 0x0a, 0x20, 0x20, 0x20, /* 13;.. */
169 0x20, 0x20, 0x20, 0x20, 0x20, 0x68, 0x3d, 0x63, /* h=c */
170 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, /* ontent-t */
171 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x2d, /* ransfer- */
172 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, /* encoding */
173 0x3a, 0x66, 0x72, 0x0d, 0x0a, 0x2e, 0x0d, 0x0a
174 };
175
176 static int last_data_packet_size = 82;
177
178 static char dele_ok[23] = {
179 0x2b, 0x4f, /* ......+O */
180 0x4b, 0x20, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, /* K messag */
181 0x65, 0x20, 0x31, 0x20, 0x64, 0x65, 0x6c, 0x65, /* e 1 dele */
182 0x74, 0x65, 0x64, 0x0d, 0x0a /* ted.. */
183 };
184
185
186 static int dele_ok_size = 23;
187
188 static char quit_ok[93] = {
189 0x2b, 0x4f, /* ......+O */
190 0x4b, 0x20, 0x74, 0x65, 0x73, 0x74, 0x72, 0x65, /* K testre */
191 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x40, /* cipient@ */
192 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x6c, /* expressl */
193 0x6f, 0x67, 0x69, 0x63, 0x2e, 0x63, 0x6f, 0x6d, /* ogic.com */
194 0x20, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, /* express */
195 0x6c, 0x6f, 0x67, 0x69, 0x63, 0x2e, 0x63, 0x6f, /* logic.co */
196 0x6d, 0x20, 0x50, 0x4f, 0x50, 0x33, 0x20, 0x53, /* m POP3 S */
197 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x73, 0x69, /* erver si */
198 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x6f, 0x66, /* gning of */
199 0x66, 0x20, 0x28, 0x6d, 0x61, 0x69, 0x6c, 0x62, /* f (mailb */
200 0x6f, 0x78, 0x20, 0x65, 0x6d, 0x70, 0x74, 0x79, /* ox empty */
201 0x29, 0x0d, 0x0a /* ).. */
202 };
203
204 static int quit_ok_size = 93;
205
206
207 /* Define what the initial system looks like. */
208 #ifdef CTEST
test_application_define(void * first_unused_memory)209 VOID test_application_define(void *first_unused_memory)
210 #else
211 void netx_pop3_mail_receive_test_application_define(void *first_unused_memory)
212 #endif
213 {
214
215 UINT status;
216 UCHAR *free_memory_pointer;
217
218
219 /* Setup the working pointer. */
220 free_memory_pointer = (UCHAR *) first_unused_memory;
221
222 /* Initialize NetX. */
223 nx_system_initialize();
224
225 /* Create the Server thread. */
226 status = tx_thread_create(&server_thread, "Server thread ", server_thread_entry, 0,
227 free_memory_pointer, DEMO_STACK_SIZE,
228 6, 6, TX_NO_TIME_SLICE, TX_AUTO_START);
229
230 free_memory_pointer = free_memory_pointer + DEMO_STACK_SIZE ;
231
232 /* Check status. */
233 if (status != NX_SUCCESS)
234 {
235 error_counter++;
236 }
237
238 /* Create the server packet pool. */
239 status = nx_packet_pool_create(&server_packet_pool, "Server Packet Pool", PAYLOAD_SIZE, free_memory_pointer , PAYLOAD_SIZE*10);
240
241 free_memory_pointer = free_memory_pointer + PAYLOAD_SIZE*10;
242 if (status)
243 error_counter++;
244
245 /* Create an IP instance. */
246 status = nx_ip_create(&server_ip,
247 "Server IP",
248 IP_ADDRESS(1,2,3,4),
249 0xFFFFFF00UL,
250 &server_packet_pool, _nx_ram_network_driver_1024,
251 free_memory_pointer, DEMO_STACK_SIZE, 1);
252
253 free_memory_pointer = free_memory_pointer + DEMO_STACK_SIZE;
254
255 /* Check status. */
256 if (status != NX_SUCCESS)
257 {
258 error_counter++;
259 }
260
261 /* Enable ARP and supply ARP cache memory. */
262 nx_arp_enable(&server_ip, (void *) free_memory_pointer, 1024);
263
264 /* Update pointer to unallocated (free) memory. */
265 free_memory_pointer = free_memory_pointer + 1024;
266
267 /* Enable TCP and ICMP for Server IP. */
268 nx_tcp_enable(&server_ip);
269 nx_icmp_enable(&server_ip);
270
271 /* Create a client thread. */
272 tx_thread_create(&client_thread, "Client", client_thread_entry, 0,
273 free_memory_pointer, DEMO_STACK_SIZE, 1, 1,
274 TX_NO_TIME_SLICE, TX_AUTO_START);
275
276 free_memory_pointer = free_memory_pointer + DEMO_STACK_SIZE;
277
278 /* The demo client username and password is the authentication
279 data used when the server attempts to authentication the client. */
280
281 /* Create Client packet pool. */
282 status = nx_packet_pool_create(&client_packet_pool, "POP3 Client Packet Pool",
283 PAYLOAD_SIZE, free_memory_pointer, (PAYLOAD_SIZE * 10));
284 if (status != NX_SUCCESS)
285 {
286 error_counter++;
287 }
288
289 /* Update pointer to unallocated (free) memory. */
290 free_memory_pointer = free_memory_pointer + (PAYLOAD_SIZE * 10);
291
292 /* Create IP instance for demo Client */
293 status = nx_ip_create(&client_ip, "POP3 Client IP Instance", IP_ADDRESS(1,2,3,5), 0xFFFFFF00UL,
294 &client_packet_pool, _nx_ram_network_driver_1024, free_memory_pointer,
295 2048, 1);
296
297 if (status != NX_SUCCESS)
298 {
299 error_counter++;
300 }
301
302 /* Update pointer to unallocated (free) memory. */
303 free_memory_pointer = free_memory_pointer + 2048;
304
305 /* Enable ARP and supply ARP cache memory. */
306 nx_arp_enable(&client_ip, (void *) free_memory_pointer, 1024);
307
308 /* Update pointer to unallocated (free) memory. */
309 free_memory_pointer = free_memory_pointer + 1024;
310
311 /* Enable TCP and ICMP for Client IP. */
312 nx_tcp_enable(&client_ip);
313 nx_icmp_enable(&client_ip);
314
315 return;
316 }
317
318 /* Define the server thread. */
server_thread_entry(ULONG thread_input)319 void server_thread_entry(ULONG thread_input)
320 {
321
322 UINT status;
323 NX_PACKET *my_packet;
324 UINT i =0;
325
326 /* Print out test information banner. */
327 printf("NetX Test: POP3 Mail Receive Test....................................");
328
329 /* Check for earlier error. */
330 if(error_counter)
331 {
332 printf("ERROR!\n");
333 error_counter++;
334 }
335
336 /* Create a socket as the server. */
337 status = nx_tcp_socket_create(&server_ip, &server_socket, "Socket Server", NX_IP_NORMAL, NX_FRAGMENT_OKAY, NX_IP_TIME_TO_LIVE, 2048, NX_NULL, NX_NULL);
338
339 /* Check status. */
340 if (status)
341 {
342 error_counter++;
343 }
344
345 /* Load up the server 'responses'. */
346 pop3_initialize_responses();
347
348 /* Bind the TCP socket to the POP3 port. */
349 status = nx_tcp_server_socket_listen(&server_ip, 110, &server_socket, 5, NX_NULL);
350
351 /* Check status. */
352 if (status)
353 {
354 error_counter++;
355 }
356
357 /* Wait for a connection request. */
358 status = nx_tcp_server_socket_accept(&server_socket, 10 * NX_IP_PERIODIC_RATE);
359
360 /* Check status. */
361 if (status)
362 {
363 error_counter++;
364 }
365
366 /* Wait for Client requests */
367 while ( i < NUM_RESPONSES )
368 {
369
370 status = nx_pop3_response_packet_send(&server_socket, i);
371
372 /* Check status. */
373 if (status)
374 {
375 error_counter++;
376 }
377
378 /* If this is the QUIT response, we're done */
379 if (i == 9)
380 break;
381
382 if ((i <4) || (i > 6))
383 {
384 status = nx_tcp_socket_receive(&server_socket, &my_packet, 10 * NX_IP_PERIODIC_RATE);
385
386 /* Check status. */
387 if (status)
388 {
389 error_counter++;
390 }
391 }
392
393 /* Advance the index for the next response. */
394 i++;
395 }
396
397 /* Wait for the client to terminate the connection. */
398 while(client_running == NX_TRUE)
399 tx_thread_sleep(20);
400
401 /* Delete the TCP socket. */
402 nx_tcp_socket_delete(&server_socket);
403
404 if(error_counter)
405 {
406
407 printf("ERROR!\n");
408 test_control_return(1);
409 }
410 else
411 {
412 printf("SUCCESS!\n");
413 test_control_return(0);
414 };
415 }
416
417
418 /* Define the application thread entry function. */
419
client_thread_entry(ULONG info)420 void client_thread_entry(ULONG info)
421 {
422
423 UINT status;
424 UINT mail_item, number_mail_items;
425 UINT bytes_downloaded = 0;
426 UINT final_packet = NX_FALSE;
427 ULONG total_size, mail_item_size, bytes_retrieved;
428 NX_PACKET *packet_ptr;
429
430 NX_PARAMETER_NOT_USED(info);
431
432 /* Let the IP instance get initialized with driver parameters. */
433 tx_thread_sleep(10);
434
435 /* Create a NetX POP3 Client instance with no byte or block memory pools.
436 Note that it uses its password for its APOP shared secret. */
437 status = nx_pop3_client_create(&pop3_client,
438 NX_FALSE /* if true, enables Client to send APOP command to authenticate */,
439 &client_ip, &client_packet_pool, IP_ADDRESS(1,2,3,4), 110,
440 LOCALHOST, LOCALHOST_PASSWORD);
441
442 /* Check for error. */
443 if (status != NX_SUCCESS)
444 {
445 error_counter++;
446 }
447
448 /* Find out how many items are in our mailbox. */
449 status = nx_pop3_client_mail_items_get(&pop3_client, &number_mail_items, &total_size);
450
451 /* If nothing in the mailbox, disconnect. */
452 if (number_mail_items == 0)
453 {
454 error_counter++;
455 }
456
457 /* Download all mail items. */
458 mail_item = 1;
459
460 while (mail_item <= number_mail_items)
461 {
462
463 /* This submits a RETR request and gets the mail message size. */
464 status = nx_pop3_client_mail_item_get(&pop3_client, mail_item, &mail_item_size);
465
466 /* Loop to get the next mail message packet until the last mail item
467 packet is downloaded. */
468 do
469 {
470
471 status = nx_pop3_client_mail_item_message_get(&pop3_client, &packet_ptr,
472 &bytes_retrieved,
473 &final_packet);
474
475 if (status != NX_SUCCESS)
476 {
477 break;
478 }
479
480 nx_packet_release(packet_ptr);
481
482 /* Determine if this is the last data packet. */
483 if (final_packet)
484 {
485 /* It is. Let the server know it can delete this mail item. */
486 status = nx_pop3_client_mail_item_delete(&pop3_client, mail_item);
487
488 if (status != NX_SUCCESS)
489 {
490 break;
491 }
492 }
493
494 /* Keep track of how much mail message data is left. */
495 bytes_downloaded += bytes_retrieved;
496
497 } while (final_packet == NX_FALSE);
498
499 /* Get the next mail item. */
500 mail_item++;
501
502 tx_thread_sleep(10);
503 }
504
505 /* Disconnect from the POP3 server. */
506 status = nx_pop3_client_quit(&pop3_client);
507
508 client_running = NX_FALSE;
509
510 if (status != NX_SUCCESS)
511 error_counter++;
512
513 /* Delete the POP3 Client. */
514 status = nx_pop3_client_delete(&pop3_client);
515
516 if (status != NX_SUCCESS)
517 error_counter++;
518
519 }
520
nx_pop3_response_packet_send(NX_TCP_SOCKET * server_socket_ptr,INT packet_number)521 static UINT nx_pop3_response_packet_send(NX_TCP_SOCKET *server_socket_ptr, INT packet_number)
522 {
523
524 UINT status;
525 NX_PACKET *response_packet;
526
527 /* Allocate a response packet. */
528 status = nx_packet_allocate(&server_packet_pool, &response_packet, NX_TCP_PACKET, TX_WAIT_FOREVER);
529
530 /* Check status. */
531 if (status)
532 {
533 error_counter++;
534 }
535
536 /* Write the response messages into the packet payload! */
537 memcpy(response_packet -> nx_packet_prepend_ptr, pop3_response[packet_number].pop3_response_pkt_data,
538 pop3_response[packet_number].pop3_response_pkt_size);
539
540 response_packet -> nx_packet_length = pop3_response[packet_number].pop3_response_pkt_size;
541
542 /* Adjust the write pointer. */
543 response_packet -> nx_packet_append_ptr = response_packet -> nx_packet_prepend_ptr + response_packet -> nx_packet_length;
544
545 /* Send the packet with the correct port. */
546 status = nx_tcp_socket_send(server_socket_ptr, response_packet, 100);
547
548 /* Check the status. */
549 if (status)
550 {
551
552 error_counter++;
553 nx_packet_release(response_packet);
554 }
555
556 return status;
557 }
558
pop3_initialize_responses()559 static UINT pop3_initialize_responses()
560 {
561
562 pop3_response[0].pop3_response_pkt_data = &greeting[0];
563 pop3_response[0].pop3_response_pkt_size = greeting_size ;
564
565 pop3_response[1].pop3_response_pkt_data = &user_ok[0];
566 pop3_response[1].pop3_response_pkt_size = user_ok_size ;
567
568 pop3_response[2].pop3_response_pkt_data = &password_ok[0];
569 pop3_response[2].pop3_response_pkt_size = password_ok_size ;
570
571 pop3_response[3].pop3_response_pkt_data = &stat_ok[0];
572 pop3_response[3].pop3_response_pkt_size = stat_ok_size ;
573
574 pop3_response[4].pop3_response_pkt_data = &retr_ok[0];
575 pop3_response[4].pop3_response_pkt_size = retr_ok_size ;
576
577 pop3_response[5].pop3_response_pkt_data = &first_data_packet[0];
578 pop3_response[5].pop3_response_pkt_size = first_data_packet_size ;
579
580 pop3_response[6].pop3_response_pkt_data = &second_data_packet[0];
581 pop3_response[6].pop3_response_pkt_size = second_data_packet_size ;
582
583 pop3_response[7].pop3_response_pkt_data = &last_data_packet[0];
584 pop3_response[7].pop3_response_pkt_size = last_data_packet_size ;
585
586 pop3_response[8].pop3_response_pkt_data = &dele_ok[0];
587 pop3_response[8].pop3_response_pkt_size = dele_ok_size ;
588
589 pop3_response[9].pop3_response_pkt_data = &quit_ok[0];
590 pop3_response[9].pop3_response_pkt_size = quit_ok_size ;
591
592 return NX_SUCCESS;
593 }
594 #else
595
596 #ifdef CTEST
test_application_define(void * first_unused_memory)597 VOID test_application_define(void *first_unused_memory)
598 #else
599 void netx_pop3_mail_receive_test_application_define(void *first_unused_memory)
600 #endif
601 {
602
603 /* Print out test information banner. */
604 printf("NetX Test: POP3 Mail Receive Test....................................N/A\n");
605
606 test_control_return(3);
607 }
608 #endif
609