Navigation



Ignore:
Timestamp:
Jul 28, 2010, 4:17:29 PM (14 years ago)
Author:
Alexandre Westfahl <awestfahl@freediameter.net>
Branch:
default
Phase:
public
Message:

Added dynamic port choice for app_sip

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/app_sip/tools/app_sip_ppr.c

    r435 r440  
    4848#include <stdlib.h>
    4949#include <string.h>
    50 #define PORT 667
     50
    5151#include <errno.h>
    5252
     
    6666    struct pprsipaor pprsip;
    6767    int numdatatype=0,i=0;
    68    
     68    int port=667;
     69       
    6970        sock = socket(AF_INET, SOCK_STREAM, 0);
    7071        sin.sin_addr.s_addr = inet_addr("127.0.0.1");
    7172    sin.sin_family = AF_INET;
    72     sin.sin_port = htons(PORT);
     73   
    7374   
    7475    //We initialize the structure
     
    158159                                pprsip.accounting=1;
    159160                               
     161                               
     162                        }
     163                        else if(strcmp(argv[i],"-p")==0)
     164                        {
     165                               
     166                                if(sscanf(argv[i+1],"%d", &port)!=1)
     167                                {
     168                                        fprintf(stderr,"Incorrect port number!\n");
     169                                        return 1;
     170                                }
     171                               
     172                               
    160173                                i++;
    161174                        }
     
    170183        }
    171184       
     185        //We set the port number
     186        sin.sin_port = htons(port);
    172187       
    173188       
     
    180195       
    181196   
    182    
     197    fprintf(stderr,"%d!\n",port);
    183198   
    184199    /*
Note: See TracChangeset for help on using the changeset viewer.