Changeset 5375:2b4d1e027b2d in roaraudio for libroar
- Timestamp:
- 12/22/11 21:16:34 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- libroar
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libroar/basic.c
r5373 r5375 226 226 227 227 if ( port || is_decnet ) { 228 fh = roar_socket_connect( user_sock, port);228 fh = roar_socket_connect(type, user_sock, port); 229 229 // restore the original string 230 230 user_sock[i] = ':'; … … 239 239 } 240 240 #endif 241 fh = roar_socket_connect( user_sock, ROAR_DEFAULT_PORT);241 fh = roar_socket_connect(type, user_sock, ROAR_DEFAULT_PORT); 242 242 } 243 243 … … 368 368 #endif 369 369 370 if ( _connect_server(con, "+abstract", -1, flags, timeout) == 0 )370 if ( _connect_server(con, "+abstract", ROAR_SOCKET_TYPE_UNKNOWN, flags, timeout) == 0 ) 371 371 return 0; 372 372 … … 377 377 ) { 378 378 if ( (server = roar_slp_find_roard(0)) != NULL ) { 379 if ( _connect_server(con, server, -1, 0, 0) == 0 )379 if ( _connect_server(con, server, ROAR_SOCKET_TYPE_UNKNOWN, 0, 0) == 0 ) 380 380 return 0; 381 381 … … 384 384 ROAR_WARN("roar_connect_raw(*): Can not connect to SLP located server, disabling cache"); 385 385 if ( (server = roar_slp_find_roard(1)) != NULL ) 386 if ( _connect_server(con, server, -1, 0, 0) == 0 )386 if ( _connect_server(con, server, ROAR_SOCKET_TYPE_UNKNOWN, 0, 0) == 0 ) 387 387 return 0; 388 388 } … … 395 395 if ( list != NULL ) { 396 396 for (i = 0; list[i].server != NULL; i++) { 397 if ( _connect_server(con, list[i].server, -1, 0, 0) == 0 ) {397 if ( _connect_server(con, list[i].server, ROAR_SOCKET_TYPE_UNKNOWN, 0, 0) == 0 ) { 398 398 roar_enum_servers_free(list); 399 399 return 0; … … 408 408 } else { 409 409 /* connect via (char*)server */ 410 if ( _connect_server(con, server, -1, flags, timeout) != 0 )410 if ( _connect_server(con, server, ROAR_SOCKET_TYPE_UNKNOWN, flags, timeout) != 0 ) 411 411 return -1; 412 412 return 0; -
libroar/socket.c
r5373 r5375 40 40 #define MODE_CONNECT ROAR_SOCKET_MODE_CONNECT 41 41 42 static int roar_socket_open_file (int mode, const char * host, int port); 43 static int roar_socket_open_proxy (int mode, int type, const char * host, int port, const char * proxy_type); 44 45 static int roar_socket_open_socks4 (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts); 46 static int roar_socket_open_socks4a(int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts); 47 static int roar_socket_open_socks4d(int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts); 48 static int roar_socket_open_socks4x(int mode, int fh, char host[4], int port, const char * app, size_t app_len, const char * user); 49 50 static int roar_socket_open_http (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts); 51 52 static int roar_socket_open_ssh (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts); 53 54 42 55 #ifdef ROAR_TARGET_WIN32 43 56 void roar_socket_win32_init (void) { … … 54 67 #endif 55 68 56 int roar_socket_decnet_set_timeout (int fh, time_t sec, int usec) {69 int roar_socket_decnet_set_timeout (int fh, time_t sec, int_least32_t usec) { 57 70 #ifdef ROAR_HAVE_LIBDNET 58 71 struct timeval timeout = {sec, usec}; … … 64 77 } 65 78 66 int roar_socket_recvbuf(int fh, int len) { 67 #ifdef ROAR_HAVE_BSDSOCKETS 68 if ( len < 256 ) len = 256; 69 70 return setsockopt(fh, SOL_SOCKET, SO_RCVBUF, (void *)&len, sizeof(len)); 71 #else 72 return -1; 73 #endif 74 } 75 76 int roar_socket_set_tos(int fh) { 79 static int roar_socket_set_tos(int fh) { 77 80 #if defined(ROAR_HAVE_BSDSOCKETS) && !defined(ROAR_TARGET_WIN32) 78 81 int opt = IPTOS_LOWDELAY; … … 86 89 return ret; 87 90 #else 91 roar_err_set(ROAR_ERROR_NOSYS); 88 92 return -1; 89 93 #endif … … 387 391 } 388 392 389 int roar_socket_connect ( const char * host, int port) {393 int roar_socket_connect (int type, const char * host, int port) { 390 394 char * proxy_type = getenv("ROAR_PROXY"); 391 395 … … 393 397 394 398 if ( proxy_type == NULL || strcmp(proxy_type, "") == 0 ) { 395 return roar_socket_open(MODE_CONNECT, ROAR_SOCKET_TYPE_UNKNOWN, host, port);399 return roar_socket_open(MODE_CONNECT, type, host, port); 396 400 } else { 397 401 #ifdef ROAR_SUPPORT_PROXY 398 return roar_socket_open_proxy(MODE_CONNECT, ROAR_SOCKET_TYPE_UNKNOWN, host, port, proxy_type);402 return roar_socket_open_proxy(MODE_CONNECT, type, host, port, proxy_type); 399 403 #else 400 404 ROAR_ERR("roar_socket_connect(host='%s', port=%i): no support for proxy code (proxy_type=%s)", host, port, proxy_type); … … 820 824 } 821 825 822 int roar_socket_open_file (int mode, const char * host, int port) {826 static int roar_socket_open_file (int mode, const char * host, int port) { 823 827 #ifdef ROAR_HAVE_IO_POSIX 824 828 int fh; … … 848 852 849 853 #ifdef ROAR_SUPPORT_PROXY 850 int roar_socket_open_proxy (int mode, int type, const char * host, int port, const char * proxy_type) {854 static int roar_socket_open_proxy (int mode, int type, const char * host, int port, const char * proxy_type) { 851 855 int proxy_port = -1; 852 856 char proxy_host[ROAR_SOCKET_MAX_HOSTNAMELEN]; … … 975 979 // protocoll dependet proxy code: 976 980 977 int roar_socket_open_socks4 (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) {981 static int roar_socket_open_socks4 (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) { 978 982 #ifndef ROAR_TARGET_MICROCONTROLLER 979 983 struct hostent * he; … … 990 994 } 991 995 992 int roar_socket_open_socks4a(int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) {996 static int roar_socket_open_socks4a(int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) { 993 997 return roar_socket_open_socks4x(mode, fh, "\0\0\0\1", port, host, strlen(host)+1, user); 994 998 } 995 999 996 int roar_socket_open_socks4d(int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) {1000 static int roar_socket_open_socks4d(int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) { 997 1001 size_t len = strlen(host)+1; 998 1002 char * dp; … … 1010 1014 } 1011 1015 1012 int roar_socket_open_socks4x(int mode, int fh, char host[4], int port, const char * app, size_t app_len, const char * user) {1016 static int roar_socket_open_socks4x(int mode, int fh, char host[4], int port, const char * app, size_t app_len, const char * user) { 1013 1017 char buf[9]; 1014 1018 int len; … … 1048 1052 } 1049 1053 1050 int roar_socket_open_http (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) {1054 static int roar_socket_open_http (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) { 1051 1055 char buf[1024]; 1052 1056 int len; … … 1081 1085 1082 1086 #ifdef ROAR_HAVE_BIN_SSH 1083 int roar_socket_open_ssh (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) {1087 static int roar_socket_open_ssh (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) { 1084 1088 char * proxy_addr = getenv("ssh_proxy"); 1085 1089 char * sep; -
libroar/vio.c
r5278 r5375 346 346 } 347 347 348 if ( (fh = roar_socket_connect( host, port)) == -1 )348 if ( (fh = roar_socket_connect(ROAR_SOCKET_TYPE_UNKNOWN, host, port)) == -1 ) 349 349 return -1; 350 350
Note: See TracChangeset
for help on using the changeset viewer.