Changeset 1882
- Timestamp:
- Mar 20, 2008 7:21:27 PM (17 years ago)
- Location:
- pjproject/trunk/pjnath
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjnath/build/Makefile
r1877 r1882 32 32 export PJNATH_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \ 33 33 errno.o ice_session.o ice_strans.o nat_detect.o stun_auth.o \ 34 stun_msg.o stun_msg_dump.o stun_session.o stun_transaction.o 34 stun_msg.o stun_msg_dump.o stun_session.o stun_transaction.o \ 35 turn_session.o turn_udp.o 35 36 export PJNATH_CFLAGS += $(_CFLAGS) 36 37 … … 46 47 47 48 ############################################################################### 48 # Defines for building testclient application49 # Defines for building TURN client application 49 50 # 50 export PJ STUN_CLIENT_SRCDIR = ../src/pjstun-client51 export PJ STUN_CLIENT_OBJS += client_main.o52 export PJ STUN_CLIENT_CFLAGS += $(_CFLAGS)53 export PJ STUN_CLIENT_LDFLAGS += $(_LDFLAGS)54 export PJ STUN_CLIENT_EXE:=../bin/pjstun-client-$(TARGET_NAME)$(HOST_EXE)51 export PJTURN_CLIENT_SRCDIR = ../src/pjturn-client 52 export PJTURN_CLIENT_OBJS += client_main.o 53 export PJTURN_CLIENT_CFLAGS += $(_CFLAGS) 54 export PJTURN_CLIENT_LDFLAGS += $(_LDFLAGS) 55 export PJTURN_CLIENT_EXE:=../bin/pjturn-client-$(TARGET_NAME)$(HOST_EXE) 55 56 56 57 ############################################################################### 57 # Defines for building testserver application58 # Defines for building TURN server application 58 59 # 59 export PJ STUN_SRV_TEST_SRCDIR = ../src/pjstun-srv-test60 export PJ STUN_SRV_TEST_OBJS += bind_usage.o server.o turn_usage.o usage.o \60 export PJTURN_SRV_SRCDIR = ../src/pjturn-srv 61 export PJTURN_SRV_OBJS += allocation.o auth.o listener_udp.o server.o \ 61 62 main.o 62 export PJ STUN_SRV_TEST_CFLAGS += $(_CFLAGS)63 export PJ STUN_SRV_TEST_LDFLAGS += $(_LDFLAGS)64 export PJ STUN_SRV_TEST_EXE:=../bin/pjstun-srv-test-$(TARGET_NAME)$(HOST_EXE)63 export PJTURN_SRV_CFLAGS += $(_CFLAGS) 64 export PJTURN_SRV_LDFLAGS += $(_LDFLAGS) 65 export PJTURN_SRV_EXE:=../bin/pjturn-srv-$(TARGET_NAME)$(HOST_EXE) 65 66 66 67 … … 72 73 # $(TARGET) is defined in os-$(OS_NAME).mak file in current directory. 73 74 # 74 TARGETS := pjnath pjnath-test 75 #pjstun-client pjstun-srv-test 75 TARGETS := pjnath pjnath-test pjturn-client pjturn-srv 76 76 77 77 all: $(TARGETS) … … 91 91 $(MAKE) -f $(RULES_MAK) APP=PJNATH_TEST app=pjnath-test $(PJNATH_TEST_EXE) 92 92 93 pj stun-client: $(PJLIB_LIB) $(PJLIB_UTIL_LIB) $(PJNATH_LIB)94 $(MAKE) -f $(RULES_MAK) APP=PJ STUN_CLIENT app=pjstun-client $(PJSTUN_CLIENT_EXE)93 pjturn-client: $(PJLIB_LIB) $(PJLIB_UTIL_LIB) $(PJNATH_LIB) 94 $(MAKE) -f $(RULES_MAK) APP=PJTURN_CLIENT app=pjturn-client $(PJTURN_CLIENT_EXE) 95 95 96 pj stun-srv-test: $(PJLIB_LIB) $(PJLIB_UTIL_LIB) $(PJNATH_LIB)97 $(MAKE) -f $(RULES_MAK) APP=PJ STUN_SRV_TEST app=pjstun-srv-test $(PJSTUN_SRV_TEST_EXE)96 pjturn-srv: $(PJLIB_LIB) $(PJLIB_UTIL_LIB) $(PJNATH_LIB) 97 $(MAKE) -f $(RULES_MAK) APP=PJTURN_SRV app=pjturn-srv $(PJTURN_SRV_EXE) 98 98 99 99 .PHONY: ../lib/pjnath.ko … … 109 109 $(MAKE) -f $(RULES_MAK) APP=PJNATH app=pjnath $@ 110 110 $(MAKE) -f $(RULES_MAK) APP=PJNATH_TEST app=pjnath-test $@ 111 $(MAKE) -f $(RULES_MAK) APP=PJ STUN_CLIENT app=pjstun-client $@112 $(MAKE) -f $(RULES_MAK) APP=PJ STUN_SRV_TEST app=pjstun-srv-test$@111 $(MAKE) -f $(RULES_MAK) APP=PJTURN_CLIENT app=pjturn-client $@ 112 $(MAKE) -f $(RULES_MAK) APP=PJTURN_SRV app=pjturn-srv $@ 113 113 114 114 realclean: 115 115 $(subst @@,$(subst /,$(HOST_PSEP),.pjnath-$(TARGET_NAME).depend),$(HOST_RMR)) 116 116 $(subst @@,$(subst /,$(HOST_PSEP),.pjnath-test-$(TARGET_NAME).depend),$(HOST_RMR)) 117 $(subst @@,$(subst /,$(HOST_PSEP),.pj stun-client-$(TARGET_NAME).depend),$(HOST_RMR))118 $(subst @@,$(subst /,$(HOST_PSEP),.pj stun-srv-test-$(TARGET_NAME).depend),$(HOST_RMR))117 $(subst @@,$(subst /,$(HOST_PSEP),.pjturn-client-$(TARGET_NAME).depend),$(HOST_RMR)) 118 $(subst @@,$(subst /,$(HOST_PSEP),.pjturn-srv-$(TARGET_NAME).depend),$(HOST_RMR)) 119 119 $(MAKE) -f $(RULES_MAK) APP=PJNATH app=pjnath $@ 120 120 $(MAKE) -f $(RULES_MAK) APP=PJNATH_TEST app=pjnath-test $@ 121 $(MAKE) -f $(RULES_MAK) APP=PJ STUN_CLIENT app=pjstun-client $@122 $(MAKE) -f $(RULES_MAK) APP=PJ STUN_SRV_TEST app=pjstun-srv-test$@121 $(MAKE) -f $(RULES_MAK) APP=PJTURN_CLIENT app=pjturn-client $@ 122 $(MAKE) -f $(RULES_MAK) APP=PJTURN_SRV app=pjturn-srv $@ 123 123 124 124 depend: 125 125 $(MAKE) -f $(RULES_MAK) APP=PJNATH app=pjnath $@ 126 126 $(MAKE) -f $(RULES_MAK) APP=PJNATH_TEST app=pjnath-test $@ 127 $(MAKE) -f $(RULES_MAK) APP=PJ STUN_CLIENT app=pjstun-client $@128 $(MAKE) -f $(RULES_MAK) APP=PJ STUN_SRV_TEST app=pjstun-srv-test$@127 $(MAKE) -f $(RULES_MAK) APP=PJTURN_CLIENT app=pjturn-client $@ 128 $(MAKE) -f $(RULES_MAK) APP=PJTURN_SRV app=pjturn-srv $@ 129 129 echo '$(TEST_EXE): $(PJNATH_LIB)' >> .pjnath-test-$(TARGET_NAME).depend; \ 130 130 -
pjproject/trunk/pjnath/src/pjnath/turn_session.c
r1879 r1882 337 337 break; 338 338 case PJ_TURN_STATE_DEALLOCATED: 339 case PJ_TURN_STATE_DESTROYING: 339 340 break; 340 341 } -
pjproject/trunk/pjnath/src/pjturn-client/client_main.c
r1879 r1882 67 67 68 68 static int worker_thread(void *unused); 69 static pj_status_t parse_addr(const char *input, pj_sockaddr_in *addr);70 69 static void turn_on_rx_data(pj_turn_udp *udp_rel, 71 70 const pj_uint8_t *pkt, … … 319 318 g.udp_rel = NULL; 320 319 } 321 }322 323 static pj_status_t parse_addr(const char *input,324 pj_sockaddr_in *addr)325 {326 const char *pos;327 pj_str_t ip;328 pj_uint16_t port;329 pj_sockaddr tmp_addr;330 331 pos = pj_ansi_strchr(input, ':');332 if (pos==NULL) {333 puts("Invalid format");334 return -1;335 }336 337 ip.ptr = (char*)input;338 ip.slen = pos - input;339 port = (pj_uint16_t)atoi(pos+1);340 341 if (port==0) {342 puts("Invalid port");343 return -1;344 }345 346 if (pj_sockaddr_in_init(&tmp_addr.ipv4, &ip, port)!=PJ_SUCCESS) {347 puts("Invalid address");348 return -1;349 }350 351 pj_memcpy(addr, &tmp_addr, sizeof(pj_sockaddr_in));352 353 return PJ_SUCCESS;354 320 } 355 321 … … 424 390 425 391 strcpy(input, "Hello from client"); 426 status = pj_turn_udp_sendto(g.udp_rel, input, strlen(input)+1, 392 status = pj_turn_udp_sendto(g.udp_rel, (const pj_uint8_t*)input, 393 strlen(input)+1, 427 394 &peer->addr, 428 395 pj_sockaddr_get_len(&peer->addr)); … … 454 421 case '0': 455 422 case '1': 423 if (g.udp_rel == NULL) { 424 puts("No relay"); 425 break; 426 } 456 427 peer = &g.peer[input[0]-'0']; 457 428 sprintf(input, "Hello from peer%d", input[0]-'0'); … … 523 494 if (pj_optind == argc) { 524 495 puts("Error: TARGET is needed"); 496 usage(); 525 497 return 1; 526 498 } -
pjproject/trunk/pjnath/src/pjturn-srv/auth.c
r1879 r1882 86 86 const pj_str_t *username, 87 87 pj_pool_t *pool, 88 int*data_type,88 pj_stun_passwd_type *data_type, 89 89 pj_str_t *data) 90 90 { … … 96 96 97 97 if (pj_stricmp2(realm, g_realm)) 98 PJ_EINVAL;98 return PJ_EINVAL; 99 99 100 100 for (i=0; i<PJ_ARRAY_SIZE(g_cred); ++i) { -
pjproject/trunk/pjnath/src/pjturn-srv/auth.h
r1879 r1882 89 89 const pj_str_t *username, 90 90 pj_pool_t *pool, 91 int*data_type,91 pj_stun_passwd_type *data_type, 92 92 pj_str_t *data); 93 93 -
pjproject/trunk/pjnath/src/pjturn-srv/main.c
r1879 r1882 70 70 pj_turn_allocation *alloc = (pj_turn_allocation*) 71 71 pj_hash_this(srv->tables.alloc, it); 72 printf("%-3d %-22s %-22s %-8.*s %-4d %-4 d %-4d %-4d\n",72 printf("%-3d %-22s %-22s %-8.*s %-4d %-4ld %-4d %-4d\n", 73 73 i, 74 74 alloc->info, 75 75 pj_sockaddr_print(&alloc->relay.hkey.addr, addr, sizeof(addr), 3), 76 76 (int)alloc->cred.data.static_cred.username.slen, 77 (int)alloc->cred.data.static_cred.username.ptr,77 alloc->cred.data.static_cred.username.ptr, 78 78 alloc->relay.lifetime, 79 79 alloc->relay.expiry.sec - now.sec, 80 80 pj_hash_count(alloc->peer_table), 81 81 pj_hash_count(alloc->ch_table)); 82 82 83 it = pj_hash_next(srv->tables.alloc, it); 83 84 ++i;
Note: See TracChangeset
for help on using the changeset viewer.