Changeset 1854


Ignore:
Timestamp:
Mar 9, 2008 11:52:48 PM (16 years ago)
Author:
bennylp
Message:

More ticket #485: initial (incomplete) work on TURN client session library

Location:
pjproject/trunk/pjnath
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjnath/include/pjnath.h

    r1495 r1854  
    2828#include <pjnath/stun_session.h> 
    2929#include <pjnath/stun_transaction.h> 
     30#include <pjnath/turn_session.h> 
    3031#include <pjnath/types.h> 
    3132 
  • pjproject/trunk/pjnath/src/pjturn-srv/allocation.c

    r1852 r1854  
    3939#define MAX_LIFETIME            600 
    4040#define DEF_LIFETIME            300 
    41  
    42  
    43  
    44 /* ChannelData header */ 
    45 typedef struct channel_data_hdr 
    46 { 
    47     pj_uint16_t ch_number; 
    48     pj_uint16_t length; 
    49 } channel_data_hdr; 
    5041 
    5142 
     
    913904         * This is not a STUN packet, must be ChannelData packet. 
    914905         */ 
    915         channel_data_hdr *cd = (channel_data_hdr*)pkt->pkt; 
     906        pj_turn_channel_data *cd = (pj_turn_channel_data*)pkt->pkt; 
    916907        pj_turn_permission *perm; 
    917908        pj_ssize_t len; 
     909 
     910        pj_assert(sizeof(*cd)==4); 
    918911 
    919912        /* For UDP check the packet length */ 
     
    979972    if (perm->channel != PJ_TURN_INVALID_CHANNEL) { 
    980973        /* Send ChannelData */ 
    981         channel_data_hdr *cd = (channel_data_hdr*)rel->tp.tx_pkt; 
     974        pj_turn_channel_data *cd = (pj_turn_channel_data*)rel->tp.tx_pkt; 
    982975 
    983976        if (len > PJ_TURN_MAX_PKT_LEN) { 
     
    995988 
    996989        /* Copy data */ 
    997         pj_memcpy(rel->tp.rx_pkt+sizeof(channel_data_hdr), pkt, len); 
     990        pj_memcpy(rel->tp.rx_pkt+sizeof(pj_turn_channel_data), pkt, len); 
    998991 
    999992        /* Send to client */ 
    1000993        pj_turn_listener_sendto(alloc->listener, rel->tp.tx_pkt, 
    1001                                len+sizeof(channel_data_hdr), 0, 
     994                               len+sizeof(pj_turn_channel_data), 0, 
    1002995                               &alloc->hkey.clt_addr, 
    1003996                               pj_sockaddr_get_len(&alloc->hkey.clt_addr)); 
  • pjproject/trunk/pjnath/src/pjturn-srv/main.c

    r1852 r1854  
     1/* $Id$ */ 
     2/*  
     3 * Copyright (C) 2003-2007 Benny Prijono <benny@prijono.org> 
     4 * 
     5 * This program is free software; you can redistribute it and/or modify 
     6 * it under the terms of the GNU General Public License as published by 
     7 * the Free Software Foundation; either version 2 of the License, or 
     8 * (at your option) any later version. 
     9 * 
     10 * This program is distributed in the hope that it will be useful, 
     11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
     12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     13 * GNU General Public License for more details. 
     14 * 
     15 * You should have received a copy of the GNU General Public License 
     16 * along with this program; if not, write to the Free Software 
     17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
     18 */ 
    119#include "turn.h" 
    220 
  • pjproject/trunk/pjnath/src/pjturn-srv/turn.h

    r1852 r1854  
    3131 
    3232 
    33 #define PJ_TURN_INVALID_CHANNEL     0xFFFF 
    3433#define PJ_TURN_INVALID_LIS_ID      ((unsigned)-1) 
    35 #define PJ_TURN_NO_TIMEOUT          ((long)0x7FFFFFFF) 
    36 #define PJ_TURN_MAX_PKT_LEN         3000 
    37 #define PJ_TURN_PERM_TIMEOUT        300 
    38 #define PJ_TURN_CHANNEL_TIMEOUT     600 
    39  
    40 /** Transport types */ 
    41 enum { 
    42     PJ_TURN_TP_UDP = 16,            /**< UDP.   */ 
    43     PJ_TURN_TP_TCP = 6      /**< TCP.   */ 
    44 }; 
    4534 
    4635/**  
Note: See TracChangeset for help on using the changeset viewer.