Ignore:
Timestamp:
Nov 6, 2007, 4:02:50 PM (14 years ago)
Author:
charles
Message:

use Thomas Bernard's miniupnp library instead of rolling our own.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/natpmp.c

    r3707 r3731  
    8484} tr_natpmp_req_t;
    8585
    86 struct tr_natpmp_s
     86struct tr_natpmp
    8787{
    8888#define PMP_STATE_IDLE          1
     
    115115
    116116static void
    117 unmap( tr_natpmp_t * pmp );
     117unmap( tr_natpmp * pmp );
    118118static int
    119119checktime( tr_natpmp_uptime_t * uptime, uint32_t seen );
     
    127127resetreq( tr_natpmp_req_t * req );
    128128static tr_tristate_t
    129 pulsereq( tr_natpmp_t * req );
     129pulsereq( tr_natpmp * req );
    130130static int
    131131sendreq( tr_natpmp_req_t * req );
     
    133133mcastsetup();
    134134static void
    135 mcastpulse( tr_natpmp_t * pmp );
     135mcastpulse( tr_natpmp * pmp );
    136136static tr_tristate_t
    137137parseresponse( uint8_t * buf, int len, int port, tr_natpmp_parse_t * parse );
    138138
    139 tr_natpmp_t *
     139tr_natpmp *
    140140tr_natpmpInit()
    141141{
    142     tr_natpmp_t * pmp;
     142    tr_natpmp * pmp;
    143143
    144144    pmp = calloc( 1, sizeof( *pmp ) );
     
    171171
    172172void
    173 tr_natpmpStart( tr_natpmp_t * pmp )
     173tr_natpmpStart( tr_natpmp * pmp )
    174174{
    175175    if( !pmp->active )
     
    185185
    186186void
    187 tr_natpmpStop( tr_natpmp_t * pmp )
     187tr_natpmpStop( tr_natpmp * pmp )
    188188{
    189189    if( pmp->active )
     
    197197
    198198int
    199 tr_natpmpStatus( tr_natpmp_t * pmp )
     199tr_natpmpStatus( tr_natpmp * pmp )
    200200{
    201201    int ret;
     
    240240
    241241void
    242 tr_natpmpForwardPort( tr_natpmp_t * pmp, int port )
     242tr_natpmpForwardPort( tr_natpmp * pmp, int port )
    243243{
    244244    tr_inf( "nat-pmp set port %i", port );
     
    247247
    248248void
    249 tr_natpmpRemoveForwarding( tr_natpmp_t * pmp )
     249tr_natpmpRemoveForwarding( tr_natpmp * pmp )
    250250{
    251251    tr_inf( "nat-pmp unset port" );
     
    255255
    256256void
    257 tr_natpmpClose( tr_natpmp_t * pmp )
     257tr_natpmpClose( tr_natpmp * pmp )
    258258{
    259259    /* try to send at least one delete request if we have a port mapping */
     
    266266
    267267void
    268 tr_natpmpPulse( tr_natpmp_t * pmp, int * publicPort )
     268tr_natpmpPulse( tr_natpmp * pmp, int * publicPort )
    269269{
    270270    if( 0 <= pmp->mcastfd )
     
    444444
    445445void
    446 unmap( tr_natpmp_t * pmp )
     446unmap( tr_natpmp * pmp )
    447447{
    448448    switch( pmp->state )
     
    568568
    569569static tr_tristate_t
    570 pulsereq( tr_natpmp_t * pmp )
     570pulsereq( tr_natpmp * pmp )
    571571{
    572572    tr_natpmp_req_t  * req = pmp->req;
     
    693693
    694694static void
    695 mcastpulse( tr_natpmp_t * pmp )
     695mcastpulse( tr_natpmp * pmp )
    696696{
    697697    struct sockaddr_in sin;
Note: See TracChangeset for help on using the changeset viewer.