#include <unistd.h>
#include "gwlib/gwlib.h"
 
Go to the source code of this file.
◆ UDP_MAXIMUM
      
        
          | #define UDP_MAXIMUM   (65535 - 40) | 
        
      
 
 
◆ help()
  
  
      
        
          | static void help  | 
          ( | 
          void  | 
           | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Definition at line 89 of file udpfeed.c.
References info(), and usage.
Referenced by main().
void info(int err, const char *fmt,...)
 
static unsigned char usage[]
 
 
 
 
◆ main()
      
        
          | int main  | 
          ( | 
          int  | 
          argc,  | 
        
        
           | 
           | 
          char **  | 
          argv  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Definition at line 114 of file udpfeed.c.
References error(), getopt(), gwlib_init(), gwlib_shutdown(), gwthread_sleep(), help(), hostname, interval, maxsize, octstr_create, octstr_destroy(), optarg, optind, send_file(), udp_client_socket(), udp_create_address(), UDP_MAXIMUM, and warning().
  124     while ((opt = 
getopt(argc, argv, 
"hg:p:i:m:")) != EOF) {
   143                 warning(0, 
"-m: truncated to UDP maximum of"   155             error(0, 
"Unknown option '%c'", opt);
 void error(int err, const char *fmt,...)
 
int getopt(int argc, char **argv, char *opts)
 
int udp_client_socket(void)
 
void warning(int err, const char *fmt,...)
 
void octstr_destroy(Octstr *ostr)
 
#define octstr_create(cstr)
 
void gwthread_sleep(double seconds)
 
void gwlib_shutdown(void)
 
static void send_file(int udpsock, char *filename, Octstr *address)
 
Octstr * udp_create_address(Octstr *host_or_ip, int port)
 
 
 
 
◆ send_file()
  
  
      
        
          | static void send_file  | 
          ( | 
          int  | 
          udpsock,  | 
         
        
           | 
           | 
          char *  | 
          filename,  | 
         
        
           | 
           | 
          Octstr *  | 
          address  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
Definition at line 93 of file udpfeed.c.
References filename, info(), maxsize, octstr_destroy(), octstr_len(), octstr_read_file(), octstr_truncate(), udp_sendto(), and warning().
Referenced by main().
   97     if (contents == NULL) {
 void info(int err, const char *fmt,...)
 
void warning(int err, const char *fmt,...)
 
void octstr_destroy(Octstr *ostr)
 
char filename[FILENAME_MAX+1]
 
Octstr * octstr_read_file(const char *filename)
 
long octstr_len(const Octstr *ostr)
 
void octstr_truncate(Octstr *ostr, int new_len)
 
int udp_sendto(int s, Octstr *datagram, Octstr *addr)
 
 
 
 
◆ hostname
◆ interval
◆ maxsize
◆ port
◆ usage
Initial value:= "\
Usage: udpfeed [options] files...\n\
\n\
where options are:\n\
\n\
-h      help\n\
-g hostname name of IP number of host to send to (default: localhost)\n\
-p port     port number to send to (default: 9200)\n\
-i interval delay between packers (default: 1.0 seconds)\n\
\n\
Each file will be sent as a single packet.\n\
"
 
Definition at line 71 of file udpfeed.c.
Referenced by help().