NetTest.c File Reference

Network test program. More...

#include <BoardSupport/inc/stdtypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>
#include <inttypes.h>
#include <time.h>
#include <string.h>
#include <Libs/NETlib/net.h>
#include <BoardSupport/inc/BoardSpecific.h>
#include <Common/Common.h>
#include <Common/uartio.h>
#include <Common/timer.h>
#include <Common/CPrintf.h>
#include <BoardSupport/config/netconfig.c>
#include "..\..\..\Common\nbuffer.h"

Macros

#define MAX_NBUFFER_SIZE   (1500) /* must be defined before #include nbuffer.h */
 
#define USE_TCP_CALLBACK   1
 
#define MAX_UDP_BUFFERS   4
 
#define TX_SIZE   (uint32_t)sizeof(tcp_tx)
 

Functions

int32_t udp_call_back (SOCKET *so, void *data, uint32_t len, uint32_t ec)
 
int32_t tcp_call_back (SOCKET *so, void *data, uint32_t len, uint32_t ec)
 
void process_data (SOCKET *so)
 
int main (void)
 

Variables

char * program_name = "Nettest"
 
far char * domain_name
 
NBuffer_t udp_buffer [MAX_UDP_BUFFERS]
 
SOCKET * udp_echo_so = INVALID_SOCKET
 
NBCtl_t bcontrol
 
SOCKET * tcp_server = INVALID_SOCKET
 
static char tcp_rx [16]
 
static char tcp_tx [27] = "this is the DSP response\r\n"
 
uint16_t tcp_received = 0
 

Detailed Description

                           _         _             _
                        __| |    ___(_) ____ _ __ | |_
                       / _` |   / __| |/ _` | '_ \| __|
                      | (_| | _ \__ \ | (_| | | | | |_
                       \__,_|(_) ___/_|\__, |_| |_|\__|
                      Signalprocessing |___/ Technology
Author
D.SignT GmbH & Co. KG, Claus Hermbusche
Date
2019-06-03

This program installs a UDP echo server (port 7) with quad buffering, and a TCP message server listening on port 1061.

When the program has started successfully, the terminal printout should

look like:

D.SignT GmbH & Co. KG Nettest
(c) 2019 D.SignT www.dsignt.de
netlib revision: 2.92.02

Setup system time ................................. success timer 1 mapped to CPU int 14 *** Enable interrupts ................................. success Start system timer ................................ success timer 1 running at 1000 Hz *** Initialize network ................................ success network startup time [sec]: 0.036

Entering main loop ... / Link status changed: Linked at 100 Mbit full duplex

  • network configuration: MAC address: 02.00.D2.02.00.01 IP address: 192.168.168.126 Host name: DM2C6747-0001 Domain name: fritz.box DNS Server: 192.168.168.100 Gateway: 192.168.168.100 Subnetmask: 255.255.255.0

    To verify this program, first 'ping' the DSP: >ping DM2C6747-0001.fritz.box >ping 192.168.168.126

    UDP test: >nc -u DM2C6747-0001.fritz.box 7 >nc -u 192.168.168.126 7

    TCP test >nc DM2C6747-0001.fritz.box 1061 >nc 192.168.168.126 1061

    The real network settings depend on your configuration.

    The UDP Echo server will re-send (echo) anything it receives. To verify this, start NetCat (nc) with the following command

    >nc -u 192.168.168.126 7
         |       |         |
         |       |         +-- port 7 = Echo Port
         |       +------------ the DSP's IP address
         +-------------------- use UDP transfers
    

    or, if configured for DHCP

    >nc -u DM2C6747-0001.fritz.box 7
         |   |                     |
         |   |                     +--- port 7 = Echo Port
         |   +------------------------- the DSP Fully-Qualified Host Name
         +----------------------------- use UDP transfers
    

    Any characters you type in the console window will be returned. NetCat doesn't send the characters immediately, it will send the entire string following a terminating CR. Please note that the maximum length of the character string is limited by the size of the buffer used for UDP echo (1472). You may also transmit a file by re-directing it to stdin:

    >nc -u 192.168.168.126 7 < hello.txt
    

    The TCP server will respond to any incoming request on port 1061 and return a short message. To verify this, start NetCat with the following command

    >nc 192.168.168.126 1061
              |         |
              |         +-- port 1061 = the port the DSP listens to
              +------------ the DSP's IP address
    

    Type a CR, the DSP will respond with its message.

Macro Definition Documentation

#define MAX_NBUFFER_SIZE   (1500) /* must be defined before #include nbuffer.h */
Examples:
NetTest.c.
#define USE_TCP_CALLBACK   1
#define MAX_UDP_BUFFERS   4
Examples:
NetTest.c.
#define TX_SIZE   (uint32_t)sizeof(tcp_tx)
Examples:
NetTest.c.

Function Documentation

int32_t udp_call_back ( SOCKET *  so,
void *  data,
uint32_t  len,
uint32_t  ec 
)
Examples:
Multicast.c, and NetTest.c.
320 {
321  /***************************************************************************
322  locals
323  ***************************************************************************/
324  NBCtl_t *bctl = (NBCtl_t *)so-> user_pointer; /* get buffer control */
325  int32_t data_length; // net_recv_event_handler() return parameter
326 
327  /***************************************************************************
328  suppress unused parameter warnings
329  ***************************************************************************/
330  UNREFERENCED_PARAMETER(data); // replaced by bctl-> Buf[].Data
331  UNREFERENCED_PARAMETER(ec); // handled in net_recv_event_handler()
332  UNREFERENCED_PARAMETER(len); // len is ignored, data_len is used instead
333 
334 
335  /***************************************************************************
336  Check events
337  If NULL is passed as pLog parameter, no message is printed to output.
338  Use net_recv_event_handler() to determine the data length waiting in the
339  receive buffer
340  ***************************************************************************/
341  data_length = net_recv_event_handler (so, CPrintf); /* with messages */
342  // data_length = net_recv_event_handler (so, NULL); /* without messages */
343 
344  /***************************************************************************
345  net_recv_event_handler() returns the amount of data waiting in the buffer
346  ***************************************************************************/
347  if (data_length)
348  {
349  // CPrintf ("received %"PRId32" bytes\r\n", data_length);
350 
351  if ( bctl == NULL )
352  {
353  /*******************************************************************
354  no control structure available, buffer processing not possible
355  *******************************************************************/
356  return (SOCKET_CB_OK);
357  } // if
358 
359  /***********************************************************************
360  if "OutOfBuffer" error occurred before, this is an overrun condition
361  and the previous packet is lost
362  ***********************************************************************/
363  if ( bctl-> OutOfBuffer )
364  {
365  /***************************************************************
366  reset flag and try to allocate new buffer later
367  ***************************************************************/
368  bctl-> OutOfBuffer = FALSE;
369 
370  /***************************************************************
371  signal this error to user or switch a LED on
372  ***************************************************************/
373  LED_on(1);
374  }
375 
376  /***********************************************************************
377  new data is available in buffer that has been previously assigned by
378  socket_define_callback() or set_recv_buffer() function.
379  The receive index bctl-> ri should always point to the active buffer
380  and is maintained in NBufferAcquireBuffer()
381  ***********************************************************************/
382  /***********************************************************************
383  save packet size, useful for later processing
384  ***********************************************************************/
385  bctl-> Buf[bctl-> ri].Size = data_length;
386 
387  /***********************************************************************
388  set process index to this buffer, if not already set.
389  this starts the processing task in main.
390  if bctl-> pi is not BUFFER_EMPTY, processing is already in progress
391  ***********************************************************************/
392  if ( bctl-> pi == BUFFER_EMPTY )
393  {
394  bctl-> pi = bctl-> ri;
395  } // if
396 
397  /***********************************************************************
398  malloc space for new data
399  ***********************************************************************/
400  if ( NBufferAcquireBuffer (so) == NULL)
401  {
402  /*******************************************************************
403  allocation failed due to all buffers in use.
404  this may happen when the receive task works faster than the signal
405  processing task. due to the lack of flow control (like TCP), this
406  is a possible overrun condition when the next packet has to be
407  received. set OutOfBuffer flag to handle this condition later
408  *******************************************************************/
409  bctl-> OutOfBuffer = TRUE;
410  } // if
411  }
412 
413  /***************************************************************************
414  return true, if message processed
415  ***************************************************************************/
416  return (SOCKET_CB_OK);
417 }
#define NULL
Definition: net.h:126
void LED_on(unsigned int ledNum)
Definition: BoardSpecific.c:1302
Network Buffer Control Structure.
Definition: nbuffer.h:108
int CPrintf(const char *_format,...)
Custom printf function.
Definition: cprintf.c:708
char * NBufferAcquireBuffer(SOCKET *so)
acquire new buffer
Definition: nbuffer.c:256
int int32_t
Definition: stdint.h:46
#define BUFFER_EMPTY
Definition: nbuffer.h:72
#define UNREFERENCED_PARAMETER(P)
Definition: Common.h:115
#define SOCKET_CB_OK
Definition: net.h:576
int32_t tcp_call_back ( SOCKET *  so,
void *  data,
uint32_t  len,
uint32_t  ec 
)
Examples:
NetTest.c.
442 {
443  /***************************************************************************
444  locals
445  ***************************************************************************/
446  int32_t data_length; // net_recv_event_handler() return parameter
447 
448  /***************************************************************************
449  suppress unused parameter warning
450  ***************************************************************************/
451  UNREFERENCED_PARAMETER(data); // not used here, data is discarded
452  UNREFERENCED_PARAMETER(ec); // handled in net_recv_event_handler()
453  UNREFERENCED_PARAMETER(len); // len is ignored, data_len is used instead
454 
455  /***************************************************************************
456  Check events
457  If NULL is passed as pLog parameter, no message is printed to output.
458  Use net_recv_event_handler() to determine the data length waiting in the
459  receive buffer
460  ***************************************************************************/
461  data_length = net_recv_event_handler (so, CPrintf); /* with messages */
462  // data_length = net_recv_event_handler (so, NULL); /* without messages */
463 
464  /***************************************************************************
465  net_recv_event_handler()returns the amount of data waiting in the buffer
466  ***************************************************************************/
467  if (data_length)
468  {
469  // CPrintf ("received %"PRId32" bytes\r\n", data_length);
470 
471  /***********************************************************************
472  TCP packet received
473  process data
474  here:discard data, count packets to send answer in main
475  ***********************************************************************/
476  tcp_received++;
477  }
478 
479  /***************************************************************************
480  return true, if message processed
481  ***************************************************************************/
482  return (SOCKET_CB_OK);
483 }
int CPrintf(const char *_format,...)
Custom printf function.
Definition: cprintf.c:708
uint16_t tcp_received
Definition: NetTest.c:278
int int32_t
Definition: stdint.h:46
#define UNREFERENCED_PARAMETER(P)
Definition: Common.h:115
#define SOCKET_CB_OK
Definition: net.h:576
void process_data ( SOCKET *  so)
Examples:
Echo.c, and NetTest.c.
500 {
501  /***************************************************************************
502  locals
503  ***************************************************************************/
504  NBCtl_t *bctl = (NBCtl_t *)so-> user_pointer; /* get buffer control */
505  char *buffer;
506  uint32_t size;
507 
508  if ( bctl == NULL )
509  {
510  /***********************************************************************
511  no control structure available
512  ***********************************************************************/
513  return;
514  } // if
515 
516  /***************************************************************************
517  if allocation failed due to all buffers in use, OutOfBuffer flag was
518  set in udp_call_back(); try to allocate a new buffer
519  ***************************************************************************/
520  if ( bctl-> OutOfBuffer )
521  {
522  if ( NBufferAcquireBuffer (so) != NULL )
523  {
524  /*******************************************************************
525  allocation successful,
526  reset OutOfBuffer flag,
527  *******************************************************************/
528  bctl-> OutOfBuffer = FALSE;
529  } // if
530  } // if
531 
532  /***************************************************************************
533  check received UDP messages
534  process index bctl-> pi is set by the first received packet in udp_call_back()
535  and signals data waiting for processing
536  ***************************************************************************/
537  if ( bctl-> pi != BUFFER_EMPTY )
538  {
539  /***********************************************************************
540  check "out of buffer" condition, set BUFFER_EMPTY flag when this buffer
541  was overwritten
542  ***********************************************************************/
543  if ( bctl-> OutOfBuffer )
544  {
545  if ( bctl-> pi == bctl-> ri )
546  {
547  bctl-> pi = BUFFER_EMPTY;
548  return;
549  } // if
550  }
551 
552  /***********************************************************************
553  process buffer if required
554  the next data to process is bctl-> Buf[bctl-> pi].Data
555  ***********************************************************************/
556  buffer = (char*)bctl-> Buf[bctl-> pi].Data;
557  size = (uint32_t)bctl-> Buf[bctl-> pi].Size;
558 
559  /***********************************************************************
560  send data back (UDP echo)
561  ***********************************************************************/
562  net_send_safe (so, buffer , size, 0);
563 
564  /***********************************************************************
565  it's safe to free this buffer here, UDP packets are not queued for
566  retransmission
567  ***********************************************************************/
568  if ( NBufferFreeBuffer (so) )
569  {
570  /*******************************************************************
571  error occurred, no buffer control structure available
572  assign buffer control structure to socket-> user_pointer
573  during initialization
574  *******************************************************************/
575  prg_exit ("out of memory error");
576  } // if
577  }
578 }
#define prg_exit(s)
Definition: Common.h:267
if(RecentEpoch.tv_usec >=1000000)
Definition: timer.c:124
#define NULL
Definition: net.h:126
Network Buffer Control Structure.
Definition: nbuffer.h:108
char * NBufferAcquireBuffer(SOCKET *so)
acquire new buffer
Definition: nbuffer.c:256
unsigned int uint32_t
Definition: stdint.h:47
static char buffer[100]
Definition: blocksend.c:158
int NBufferFreeBuffer(SOCKET *so)
free packet buffer
Definition: nbuffer.c:364
#define BUFFER_EMPTY
Definition: nbuffer.h:72
int main ( void  )
Examples:
NetTest.c.
589 {
590  /***************************************************************************
591  locals
592  ***************************************************************************/
593  int main_loop = 1; /* main loop switch, set to 0 to exit */
594  timeval stamp1, stamp2, delta; /* used to determine startup time */
595  char conversion_buffer[16];
596 #ifndef USE_TCP_CALLBACK
597  int32_t data_length=0;
598 #endif
599 
600  /***************************************************************************
601  initialize application (e.g. timer clocks, PLL settings, EMIF etc.)
602  (ref. \Common\Common.c)
603  ***************************************************************************/
604  AppInit (GET_CLOCK);
605 
606  /***************************************************************************
607  select output device for CPrintf (ref. \Common\cprintf.c)
608  possible settings:
609  CPRINTF_UART_OUTPUT -> output to UART
610  CPRINTF_CCS_OUTPUT -> output to CCS
611  CPRINTF_UART_OUTPUT | CPRINTF_CCS_OUTPUT -> output to UART and CCS
612  ***************************************************************************/
613  CPrintf_select_output (CPRINTF_DEFAULT_OUTPUT); /* default outputs */
614 
615  /***************************************************************************
616  print a start up message
617  ***************************************************************************/
618  START_UP_MESSAGE (BLANK_REV NETLIB_REV);
619 
620  /**************************************************************************/
621  // CPrintfProgress (" Heap check ");
622  // at least 0x2000 bytes required for this app
623  /**************************************************************************/
624  ASSERT_HEAP (initial_heap_size, 0x2000);
625  // CPrintfProgressSuccess();
626 
627  /**************************************************************************/
628  CPrintfProgress (" Setup system time ");
629  // 1 milli seconds resolution
630  /**************************************************************************/
633  CPrintf (" *** timer %d mapped to CPU int %d ***\r\n",
635 
636  /**************************************************************************/
637  CPrintfProgress (" Enable interrupts ");
638  /**************************************************************************/
641 
642  /**************************************************************************/
643  CPrintfProgress (" Start system timer ");
644  /**************************************************************************/
645  StartSystemTimer ();
647  CPrintf (" *** timer %d running at %"PRId32" Hz ***\r\n", SystemTimerDev, RES_SECONDS/GetSystemTimerRes());
648 
649  /***************************************************************************
650  measure network initialization time
651  ***************************************************************************/
652  stamp1 = GetTimeStamp();
653 
654  /**************************************************************************/
655  CPrintfProgress (" Initialize network ");
656  /**************************************************************************/
657  InitializeNetwork ( 64); // 64 bytes for ping
658 
659  /***************************************************************************
660  create UDP echo socket
661  ***************************************************************************/
663  ANY_PORT,
664  ECHO_PORT,
666  UDP_INIT_FUNC);
667 
668  if ( udp_echo_so == INVALID_SOCKET )
669  {
670  prg_exit ("socket_open() error"); /* possibly insufficient heap */
671  }
672 
673  /***************************************************************************
674  attach buffer control structure to socket
675  (required for NBufferAcquireBuffer() later)
676  ***************************************************************************/
677  udp_echo_so-> user_pointer = (void *)&bcontrol;
678 
679  /***************************************************************************
680  initially malloc space for data
681  NBufferAcquireBuffer() allocates new buffer space and modifies the
682  bcontrol structure data buffer pointer and receive index
683  ***************************************************************************/
685  {
686  prg_exit ("out of memory error");
687  } // if
688 
689  /***************************************************************************
690  install callback function
691  NBufferAcquireBuffer() has modified receive index ri to point to the next
692  buffer
693  ***************************************************************************/
698 
699  /***************************************************************************
700  create TCP data server socket on port 1061
701  ***************************************************************************/
703  ANY_PORT,
704  1061,
706  TCP_INIT_FUNC);
707  if ( tcp_server == INVALID_SOCKET )
708  {
709  prg_exit ("socket_open() error"); /* possibly insufficient heap */
710  }
711 
712 #ifdef USE_TCP_CALLBACK
713  /***************************************************************************
714  define callback function for received TCP packets
715  ***************************************************************************/
718  tcp_rx,
719  sizeof(tcp_rx));
720 #endif
722 
723  stamp2 = GetTimeStamp();
724 
725  tv_interval (&delta, &stamp1, &stamp2);
726  CPuts (" network startup time [sec]: ");
728  "%"PRId32".%03"PRId32"\r\n"
730  delta.tv_sec,
731  delta.tv_usec/1000);
732 
733  /***************************************************************************
734  main program loop: set main_loop to 0 to exit loop
735  ***************************************************************************/
736  CPuts ("\r\n Entering main loop ...\r\n");
737 
738  while ( main_loop )
739  {
740  /***********************************************************************
741  process net_isq()
742  ***********************************************************************/
743  net_isq (); // process ISQ
744 
745  /***********************************************************************
746  monitor link status
747  ***********************************************************************/
749 
750  /***********************************************************************
751  try to detect IP assignment
752  if DHCP is used, the assigned IP address may change
753  ***********************************************************************/
755  {
756  CPuts ("\r\n To verify this program, first 'ping' the DSP:\r\n");
757  if (domain_name) CPrintf (">ping %s.%s\r\n", eth.ip, domain_name);
758  CPrintf (">ping %s\r\n\n", inet_ntoa(get_ip_address(0), conversion_buffer));
759  CPuts (" UDP test:\r\n");
760  if (domain_name) CPrintf (">nc -u %s.%s %d\r\n", eth.ip, domain_name, udp_echo_so-> src_port);
761  CPrintf (">nc -u %s %d\r\n\n", inet_ntoa(get_ip_address(0), conversion_buffer), udp_echo_so-> src_port);
762  CPuts (" TCP test\r\n");
763  if (domain_name) CPrintf (">nc %s.%s %d\r\n", eth.ip, domain_name, tcp_server-> src_port);
764  CPrintf (">nc %s %d\r\n", inet_ntoa(get_ip_address(0), conversion_buffer), tcp_server-> src_port);
765  }
766 
767  /***********************************************************************
768  process UDP data
769  ***********************************************************************/
771 
772 #ifndef USE_TCP_CALLBACK
773  /***********************************************************************
774  two methods for buffer handling
775  1. always pass the buffer pointer to net_recv()
776  -> the buffer is reset with each call
777  2. passing a NULL pointer
778  -> the buffer is not changed; this requires a later call to
779  set_recv_buffer()(s.below) e.g. for ping-pong buffering
780  ***********************************************************************/
781  if (net_recv (tcp_server, tcp_rx, sizeof(tcp_rx))) // method 1
782  // if (net_recv (tcp_server, NULL, 0)) // method 2
783  {
784  /*******************************************************************
785  check events
786  if NULL is passed as pLog parameter, no message is printed to output
787  use net_recv_event_handler() to determine the data length waiting
788  in the receive buffer
789  *******************************************************************/
790  data_length = net_recv_event_handler (tcp_server, CPrintf); /* with messages */
791  // data_length = net_recv_event_handler (tcp_server, NULL); /* without messages */
792  }
793 
794  if (data_length)
795  {
796  // CPrintf ("received %"PRId32" data elements\r\n", data_length);
797 
798  /*******************************************************************
799  new data available, process TCP buffer
800  *******************************************************************/
801  // ...
802 
803  /*******************************************************************
804  reset receive buffer or choose different buffer for ping-pong
805  buffering (only for method 2, see above)
806  *******************************************************************/
807  // set_recv_buffer (tcp_server, tcp_rx, sizeof(tcp_rx));
808 
809  /*******************************************************************
810  TCP packet received
811  process data, here:count packets to send answer in main
812  *******************************************************************/
813  tcp_received++;
814 
815  data_length = 0;
816  }
817 #endif
818 
819  /***********************************************************************
820  check received TCP messages
821  ***********************************************************************/
822  if ( tcp_received )
823  {
824  tcp_received--;
825 
826  /*******************************************************************
827  send TCP message
828  *******************************************************************/
829  if (net_send_safe (tcp_server, tcp_tx, TX_SIZE, TCP_WAIT) == 0)
830  {
831  /***************************************************************
832  fatal error occurred, reset received counter, do other things
833  to stop transmission etc.
834  ***************************************************************/
835  tcp_received = 0;
836  }
837  } // if
838 
839  /***********************************************************************
840  show that the program is running, perform symbol animation
841  ***********************************************************************/
843  }
844 
845  /***************************************************************************
846  exit program, shut down peripherals
847  ***************************************************************************/
848  return (0);
849 }
#define prg_exit(s)
Definition: Common.h:267
void BoardEnableInterrupts(void)
global enable interrupts
Definition: BoardSpecific.c:365
NBuffer_t * Buf
Definition: nbuffer.h:113
void socket_define_callback(SOCKET *so, int32_t(*call_back_function)(SOCKET *, void *, uint32_t, uint32_t), void *data, uint16_t maxdata)
Install a user callback function for a specific socket.
#define ANIMATE_SYMBOLS_COUNT
Definition: BoardSpecific.h:268
void StartSystemTimer(void)
start system timer
Definition: timer.c:447
#define RES_MSECONDS
Definition: timer.h:67
char * inet_ntoa(uint32_t i_addr, char *s)
Convert IP-address from 0xbbaaddcc to "aaa.bbb.ccc.ddd".
uint16_t CPrintf_select_output(uint16_t device)
Definition: cprintf.c:206
#define ASSERT_HEAP(i, h)
Definition: Common.h:262
#define ANY_PORT
Definition: net.h:519
static char tcp_rx[16]
Definition: NetTest.c:274
void process_data(SOCKET *so)
Definition: NetTest.c:499
SOCKET * tcp_server
Definition: NetTest.c:273
#define TX_SIZE
Definition: NetTest.c:276
#define NULL
Definition: net.h:126
SOCKET * udp_echo_so
Definition: NetTest.c:247
int32_t net_recv(SOCKET *so, void *data, uint16_t maxdatasize)
Receive data via the specified socket.
#define MAX_NBUFFER_SIZE
Definition: NetTest.c:184
time_t GetSystemTimerRes(void)
Definition: timer.c:160
#define GET_CLOCK
Definition: BoardSpecific.h:258
#define UDP_INIT_FUNC
Definition: net.h:500
int CPrintf(const char *_format,...)
Custom printf function.
Definition: cprintf.c:708
#define VT100_DEFAULT
Definition: cprintf.h:150
static char tcp_tx[27]
Definition: NetTest.c:275
void SetupSystemTime(int32_t cpuint, int port, time_t resolution)
Setup System Time.
Definition: timer.c:392
void AppInit(uint32_t dsp_clock)
Initialize application.
Definition: Common.c:230
char * Data
Definition: nbuffer.h:92
uint32_t initial_heap_size
Definition: Common.c:140
#define TCP_INIT_FUNC
Definition: net.h:499
#define CPRINTF_DEFAULT_OUTPUT
Definition: BoardSpecific.h:129
uint16_t tcp_received
Definition: NetTest.c:278
NBCtl_t bcontrol
Definition: NetTest.c:253
#define VT100_RED
Definition: cprintf.h:143
char * NBufferAcquireBuffer(SOCKET *so)
acquire new buffer
Definition: nbuffer.c:256
uint16_t CPrintAnimatedSymbol(char *c, time_t period, size_t size)
Definition: cprintf.c:816
int InitializeNetwork(uint16_t icmp_size)
Initialize MAC, sockets and protocols.
Definition: BoardSpecific.c:597
char sym_animate[]
Definition: BoardSpecific.c:129
SOCKET * socket_open(char *dest_addr, uint16_t dest_port, uint16_t src_port, uint8_t data_type, int32_t(*init_func)(SOCKET *))
Create a new socket.
int32_t tcp_call_back(SOCKET *so, void *data, uint32_t len, uint32_t ec)
Definition: NetTest.c:441
Definition: timer.h:75
#define GetTimeStamp()
Definition: timer.h:81
void tv_interval(timeval *e, timeval *t1, timeval *t2)
compute elapsed time
Definition: timer.c:336
#define ANY_ADDRESS
Definition: net.h:511
#define SYSTEM_TIMER_INT
Definition: BoardSpecific.h:174
#define SYSTEM_TIMER
Definition: BoardSpecific.h:167
uint32_t get_ip_address(uint16_t dev_nr)
Get configured IP address.
#define DATATYPE_CHAR
Definition: net.h:489
void net_isq(void)
The main polling function for processing sockets, must be periodically called in the main application...
char ip[31]
Definition: net.h:170
#define BLANK_REV
Definition: BoardSpecific.h:191
far char * domain_name
Uint16 SystemTimerDev
int int32_t
Definition: stdint.h:46
adapter_t eth
Definition: netconfig.c:62
#define INVALID_SOCKET
Definition: net.h:540
uint16_t monitor_ip_address(tpOutputFunc pLog)
monitor IP assignment
Definition: BoardSpecific.c:545
#define ECHO_PORT
Definition: net.h:520
int32_t udp_call_back(SOCKET *so, void *data, uint32_t len, uint32_t ec)
Definition: NetTest.c:319
#define START_UP_MESSAGE(rev)
Definition: BoardSpecific.h:192
#define RES_SECONDS
Definition: timer.h:70
uint16_t monitor_link_status(tpOutputFunc pLog)
monitor link status change
Definition: BoardSpecific.c:497
int CPuts(const char *_ptr)
Definition: cprintf.c:399
time_t tv_sec
Definition: timer.h:77
#define CPrintfProgress(s)
Definition: cprintf.h:230
time_t tv_usec
Definition: timer.h:78
int16_t ri
Definition: nbuffer.h:133
#define CPrintfProgressSuccess()
Definition: cprintf.h:263

Variable Documentation

char* program_name = "Nettest"
Examples:
NetTest.c.
far char* domain_name
Examples:
NetTest.c.
Examples:
NetTest.c.
SOCKET* udp_echo_so = INVALID_SOCKET
Examples:
NetTest.c.
NBCtl_t bcontrol
Initial value:
=
{
sizeof(NBuffer_t),
0,
0,
1,
}
NBuffer_t udp_buffer[MAX_UDP_BUFFERS]
Definition: NetTest.c:242
Network Buffer.
Definition: nbuffer.h:84
#define MAX_NBUFFER_SIZE
Definition: NetTest.c:184
#define MAX_UDP_BUFFERS
Definition: NetTest.c:221
#define BUFFER_EMPTY
Definition: nbuffer.h:72
Examples:
Echo.c, and NetTest.c.
SOCKET* tcp_server = INVALID_SOCKET
Examples:
Blocksend.c, NetTest.c, and Telnet.c.
char tcp_rx[16]
static
Examples:
NetTest.c.
char tcp_tx[27] = "this is the DSP response\r\n"
static
Examples:
NetTest.c.
uint16_t tcp_received = 0
Examples:
NetTest.c.