Changeset 77:284968f15643 in roaraudio


Ignore:
Timestamp:
07/12/08 18:02:24 (16 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

prepered a lot of code for multi-stream clientss

Location:
roard
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • roard/commands.c

    r23 r77  
    1111  {ROAR_CMD_EXEC_STREAM,  "EXEC_STREAM",  req_on_exec_stream}, 
    1212  {ROAR_CMD_QUIT,         "QUIT",         clients_delete}, 
     13 
     14  {ROAR_CMD_CON_STREAM,   "CON_STREAM",   req_on_con_stream}, 
    1315 
    1416  {ROAR_CMD_SERVER_OINFO, "SERVER_OINFO", req_on_server_oinfo}, 
  • roard/include/req.h

    r22 r77  
    1313int req_on_new_stream  (int client, struct roar_message * mes, char * data); 
    1414int req_on_exec_stream (int client, struct roar_message * mes, char * data); 
     15int req_on_con_stream  (int client, struct roar_message * mes, char * data); 
    1516 
    1617int req_on_set_meta    (int client, struct roar_message * mes, char * data); 
  • roard/req.c

    r23 r77  
    8484 
    8585 return 0; 
     86} 
     87 
     88int req_on_con_stream  (int client, struct roar_message * mes, char * data) { 
     89 char   host[80] = {0}; 
     90 int    port = 0; 
     91 int    type; 
     92 int    fh; 
     93 int    len; 
     94 
     95 if ( mes->datalen < 4 ) 
     96  return -1; 
     97 
     98 if ( *(mes->data) != 0 ) 
     99  return -1; 
     100 
     101 type = (unsigned)mes->data[1]; 
     102 port = ((uint16_t*)mes->data)[1]; 
     103 
     104 len = mes->datalen > 83 ? 79 : mes->datalen - 4; 
     105 
     106 strncmp(host, &(mes->data[4]), len); 
     107 host[len] = 0; 
     108 
     109 if ( type > ROAR_SOCKET_TYPE_MAX ) 
     110  return -1; 
     111 
     112 if ( type == ROAR_SOCKET_TYPE_FILE ) // disabled because of security resons 
     113  return -1; 
     114 
     115 if ( type == ROAR_SOCKET_TYPE_FORK ) // why should we connect to ourself? 
     116  return -1; 
     117 
     118 if ( (fh = roar_socket_open(ROAR_SOCKET_MODE_CONNECT, type, host, port)) == -1 ) 
     119  return -1; 
     120 
     121 close(fh); 
    86122} 
    87123 
Note: See TracChangeset for help on using the changeset viewer.