Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

peer.c File Reference

a stub program to test the natblaster peer functionality More...

#include <stdio.h>
#include <getopt.h>
#include <stdlib.h>
#include "natblaster_peer.h"
#include "errorcodes.h"
#include "def.h"
#include "berkeleyapi.h"
#include "nethelp.h"

Go to the source code of this file.

Defines

#define BUFSIZE   64
 size of buffer to receive a message from the buddy in

Functions

int getArgs (int argc, char *argv[], char **helper_ip, port_t *helper_port, char **peer_ip, port_t *peer_port, char **buddy_ext_ip, char **buddy_int_ip, port_t *buddy_int_port, char **dev, char **msg, flag_t *random)
 gets arguments from the command line
void printUse ()
 prints the program use
int main (int argc, char *argv[])
 entry point for peer stub application


Detailed Description

a stub program to test the natblaster peer functionality

Author:
Daniel Ferullo (ferullo@cmu.edu)

Definition in file peer.c.


Function Documentation

int getArgs int  argc,
char *  argv[],
char **  helper_ip,
port_t helper_port,
char **  peer_ip,
port_t peer_port,
char **  buddy_ext_ip,
char **  buddy_int_ip,
port_t buddy_int_port,
char **  dev,
char **  msg,
flag_t random
 

gets arguments from the command line

uses errorcodes.h for error codes

Parameters:
argc the number of arguments passed in
argv the vector of arguments
helper_ip a pointer to a pointer. When finished, will point to a string with the helper's dotted-decimal IP address
helper_port pointer to the helper's port (will be filled in)
peer_ip a pointer to a pointer. When finished, will point to a string with the peer's dotted-decimal IP address
peer_port pointer to the peer's starting port (will be filled in)
buddy_ext_ip a pointer to a pointer. When finished, will point to a string with the buddy's dotted-decimal external IP address
buddy_int_ip a pointer to a pointer. When finished, will point to a string with the buddy's dotted-decimal internal IP address
buddy_int_port pointer to the buddy's starting port (will be filled in)
dev a pointer to a pointer. When finished, will point to a string with the network device to use. If none is specified, will be NULL on function return
msg a pointer to a pointer. When finished, will point to a string with the message to send to the buddy.
random a pointer to an flag_t to set to 1 if the peer wants to be random.
Returns:
SUCCESS, neg value on failure

Definition at line 160 of file peer.c.

References CHECK_NOT_NEG, CHECK_NOT_NULL, ERROR_NULL_ARG_1, ERROR_NULL_ARG_10, ERROR_NULL_ARG_11, ERROR_NULL_ARG_12, ERROR_NULL_ARG_2, ERROR_NULL_ARG_3, ERROR_NULL_ARG_4, ERROR_NULL_ARG_5, ERROR_NULL_ARG_6, ERROR_NULL_ARG_7, ERROR_NULL_ARG_8, and ERROR_NULL_ARG_9.

Referenced by main().

int main int  argc,
char *  argv[]
 

entry point for peer stub application

Parameters:
argc the number of elements in the argument vector
argv the argument vector
return 0 on success, neagive on failure

Definition at line 87 of file peer.c.

References CHECK_FAILED, ERROR_1, ERROR_2, ERROR_3, ERROR_4, FAILED, flag_t, getArgs(), ip_t, natblaster_connect(), port_t, printUse(), resolveIP(), and sock_t.

void printUse  ) 
 

prints the program use

Returns:
void


Generated on Wed Mar 30 23:20:48 2005 for NATBLASTER by  doxygen 1.3.9.1