Changeset 5375:2b4d1e027b2d in roaraudio


Ignore:
Timestamp:
12/22/11 21:16:34 (12 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

made some _LIBROAR_ATTR_TO_STATIC functions static

Files:
7 edited

Legend:

Unmodified
Added
Removed
  • include/libroar/socket.h

    r5369 r5375  
    5151 
    5252int roar_socket_listen  (int type, const char * host, int port); 
    53 int roar_socket_connect (const char * host, int port); 
     53int roar_socket_connect (int type, const char * host, int port); 
    5454 
    5555// TODO: those function should be made /static/. 
     
    6262 
    6363int roar_socket_open       (int mode, int type, const char * host, int port); 
    64 int roar_socket_open_file  (int mode, const char * host, int port) _LIBROAR_ATTR_TO_STATIC; 
    65 int roar_socket_open_proxy (int mode, int type, const char * host, int port, const char * proxy_type) _LIBROAR_ATTR_TO_STATIC; 
    6664 
    6765int roar_socket_listen_decnet (const char * object, int num); 
     
    7068 
    7169int roar_socket_nonblock(int fh, int state); 
    72 int roar_socket_decnet_set_timeout (int fh, time_t sec, int usec); 
    73 int roar_socket_recvbuf(int fh, int len); 
    74 int roar_socket_set_tos(int fh); 
     70int roar_socket_decnet_set_timeout (int fh, time_t sec, int_least32_t usec); 
    7571 
    7672int roar_socket_dup_udp_local_end (int fh); 
     
    7975int roar_socket_recv_fh (int sock,         char * mes, size_t * len); 
    8076 
    81 int roar_socket_open_socks4 (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) _LIBROAR_ATTR_TO_STATIC; 
    82 int roar_socket_open_socks4a(int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) _LIBROAR_ATTR_TO_STATIC; 
    83 int roar_socket_open_socks4d(int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) _LIBROAR_ATTR_TO_STATIC; 
    84 int roar_socket_open_socks4x(int mode, int fh, char host[4], int port, const char * app, size_t app_len, const char * user) _LIBROAR_ATTR_TO_STATIC; 
    85  
    86 int roar_socket_open_http   (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) _LIBROAR_ATTR_TO_STATIC; 
    87  
    88 int roar_socket_open_ssh    (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) _LIBROAR_ATTR_TO_STATIC; 
    89  
    9077#endif 
    9178 
  • libroar/basic.c

    r5373 r5375  
    226226 
    227227 if ( port || is_decnet ) { 
    228   fh = roar_socket_connect(user_sock, port); 
     228  fh = roar_socket_connect(type, user_sock, port); 
    229229  // restore the original string 
    230230  user_sock[i] = ':'; 
     
    239239  } 
    240240#endif 
    241   fh = roar_socket_connect(user_sock, ROAR_DEFAULT_PORT); 
     241  fh = roar_socket_connect(type, user_sock, ROAR_DEFAULT_PORT); 
    242242 } 
    243243 
     
    368368#endif 
    369369 
    370   if ( _connect_server(con, "+abstract", -1, flags, timeout) == 0 ) 
     370  if ( _connect_server(con, "+abstract", ROAR_SOCKET_TYPE_UNKNOWN, flags, timeout) == 0 ) 
    371371   return 0; 
    372372 
     
    377377    ) { 
    378378  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 ) 
    380380    return 0; 
    381381 
     
    384384   ROAR_WARN("roar_connect_raw(*): Can not connect to SLP located server, disabling cache"); 
    385385   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 ) 
    387387     return 0; 
    388388  } 
     
    395395 if ( list != NULL ) { 
    396396  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 ) { 
    398398    roar_enum_servers_free(list); 
    399399    return 0; 
     
    408408 } else { 
    409409  /* 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 ) 
    411411   return -1; 
    412412  return 0; 
  • libroar/socket.c

    r5373 r5375  
    4040#define MODE_CONNECT ROAR_SOCKET_MODE_CONNECT 
    4141 
     42static int roar_socket_open_file  (int mode, const char * host, int port); 
     43static int roar_socket_open_proxy (int mode, int type, const char * host, int port, const char * proxy_type); 
     44 
     45static int roar_socket_open_socks4 (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts); 
     46static int roar_socket_open_socks4a(int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts); 
     47static int roar_socket_open_socks4d(int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts); 
     48static 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 
     50static int roar_socket_open_http   (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts); 
     51 
     52static 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 
    4255#ifdef ROAR_TARGET_WIN32 
    4356void roar_socket_win32_init (void) { 
     
    5467#endif 
    5568 
    56 int roar_socket_decnet_set_timeout (int fh, time_t sec, int usec) { 
     69int roar_socket_decnet_set_timeout (int fh, time_t sec, int_least32_t usec) { 
    5770#ifdef ROAR_HAVE_LIBDNET 
    5871 struct timeval timeout = {sec, usec}; 
     
    6477} 
    6578 
    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) { 
     79static int roar_socket_set_tos(int fh) { 
    7780#if defined(ROAR_HAVE_BSDSOCKETS) && !defined(ROAR_TARGET_WIN32) 
    7881 int opt = IPTOS_LOWDELAY; 
     
    8689 return ret; 
    8790#else 
     91 roar_err_set(ROAR_ERROR_NOSYS); 
    8892 return -1; 
    8993#endif 
     
    387391} 
    388392 
    389 int roar_socket_connect (const char * host, int port) { 
     393int roar_socket_connect (int type, const char * host, int port) { 
    390394 char * proxy_type = getenv("ROAR_PROXY"); 
    391395 
     
    393397 
    394398 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); 
    396400 } else { 
    397401#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); 
    399403#else 
    400404  ROAR_ERR("roar_socket_connect(host='%s', port=%i): no support for proxy code (proxy_type=%s)", host, port, proxy_type); 
     
    820824} 
    821825 
    822 int roar_socket_open_file  (int mode, const char * host, int port) { 
     826static int roar_socket_open_file  (int mode, const char * host, int port) { 
    823827#ifdef ROAR_HAVE_IO_POSIX 
    824828 int fh; 
     
    848852 
    849853#ifdef ROAR_SUPPORT_PROXY 
    850 int roar_socket_open_proxy (int mode, int type, const char * host, int port, const char * proxy_type) { 
     854static int roar_socket_open_proxy (int mode, int type, const char * host, int port, const char * proxy_type) { 
    851855 int    proxy_port = -1; 
    852856 char   proxy_host[ROAR_SOCKET_MAX_HOSTNAMELEN]; 
     
    975979// protocoll dependet proxy code: 
    976980 
    977 int roar_socket_open_socks4 (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) { 
     981static int roar_socket_open_socks4 (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) { 
    978982#ifndef ROAR_TARGET_MICROCONTROLLER 
    979983 struct hostent     * he; 
     
    990994} 
    991995 
    992 int roar_socket_open_socks4a(int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) { 
     996static int roar_socket_open_socks4a(int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) { 
    993997 return roar_socket_open_socks4x(mode, fh, "\0\0\0\1", port, host, strlen(host)+1, user); 
    994998} 
    995999 
    996 int roar_socket_open_socks4d(int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) { 
     1000static int roar_socket_open_socks4d(int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) { 
    9971001 size_t len = strlen(host)+1; 
    9981002 char * dp; 
     
    10101014} 
    10111015 
    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) { 
     1016static int roar_socket_open_socks4x(int mode, int fh, char host[4], int port, const char * app, size_t app_len, const char * user) { 
    10131017 char buf[9]; 
    10141018 int len; 
     
    10481052} 
    10491053 
    1050 int roar_socket_open_http   (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) { 
     1054static int roar_socket_open_http   (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) { 
    10511055 char buf[1024]; 
    10521056 int len; 
     
    10811085 
    10821086#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) { 
     1087static int roar_socket_open_ssh    (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) { 
    10841088 char * proxy_addr = getenv("ssh_proxy"); 
    10851089 char * sep; 
  • libroar/vio.c

    r5278 r5375  
    346346 } 
    347347 
    348  if ( (fh = roar_socket_connect(host, port)) == -1 ) 
     348 if ( (fh = roar_socket_connect(ROAR_SOCKET_TYPE_UNKNOWN, host, port)) == -1 ) 
    349349  return -1; 
    350350 
  • roarclients/roarradio.c

    r5238 r5375  
    125125    file = "/"; 
    126126 
    127     if ( (in = roar_socket_connect(host, port)) == -1 ) { 
     127    if ( (in = roar_socket_connect(ROAR_SOCKET_TYPE_UNKNOWN, host, port)) == -1 ) { 
    128128     ROAR_ERR("can not connect to remote server %s (port %i): %s", host, port, strerror(errno)); 
    129129     return 0; 
     
    132132    *file = 0; 
    133133 
    134     if ( (in = roar_socket_connect(host, port)) == -1 ) { 
     134    if ( (in = roar_socket_connect(ROAR_SOCKET_TYPE_UNKNOWN, host, port)) == -1 ) { 
    135135     ROAR_ERR("can not connect to remote server %s (port %i): %s", host, port, strerror(errno)); 
    136136     return 0; 
  • roarclients/roarsockconnect.c

    r4708 r5375  
    4545 port     = atoi(argv[2]); 
    4646 
    47  if ( (fh = roar_socket_connect(argv[1], port)) == -1 ) { 
     47 if ( (fh = roar_socket_connect(ROAR_SOCKET_TYPE_UNKNOWN, argv[1], port)) == -1 ) { 
    4848  ROAR_ERR("Error: can not connect!"); 
    4949  return 1; 
  • roard/roard.c

    r5350 r5375  
    855855     unsetenv("ROAR_PROXY"); 
    856856    } 
    857     if ( (sock = roar_socket_connect(addr, port)) != -1 ) { 
     857    if ( (sock = roar_socket_connect(ROAR_SOCKET_TYPE_UNKNOWN, addr, port)) != -1 ) { 
    858858     close(sock); 
    859859     ROAR_ERR("Can not open listen socket: Socket allready in use"); 
Note: See TracChangeset for help on using the changeset viewer.