Changeset 4431:cbea30f1890d in roaraudio


Ignore:
Timestamp:
10/09/10 14:38:41 (8 years ago)
Author:
phi
Branch:
default
Message:

implemented basic SERVER_INFO with IT_SERVER

Location:
roard
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • roard/commands.c

    r4343 r4431  
    5353  {ROAR_CMD_PASSFH,       _NAME("PASSFH"),       req_on_passfh}, 
    5454 
     55  {ROAR_CMD_SERVER_INFO,  _NAME("SERVER_INFO"),  req_on_server_info}, 
    5556  {ROAR_CMD_SERVER_OINFO, _NAME("SERVER_OINFO"), req_on_server_oinfo}, 
    5657  {ROAR_CMD_GET_STANDBY,  _NAME("GET_STANDBY"),  req_on_get_standby}, 
  • roard/include/req.h

    r4343 r4431  
    5252int req_on_exit        (int client, struct roar_message * mes, char ** data, uint32_t flags[2]); 
    5353 
     54int req_on_server_info (int client, struct roar_message * mes, char ** data, uint32_t flags[2]); 
     55 
    5456int req_on_server_oinfo(int client, struct roar_message * mes, char ** data, uint32_t flags[2]); 
    5557 
  • roard/req.c

    r4343 r4431  
    536536#endif 
    537537 
     538int req_on_server_info (int client, struct roar_message * mes, char ** data, uint32_t flags[2]) { 
     539 struct roar_server_info info; 
     540 uint16_t * d16; 
     541 
     542 if ( mes->datalen != 4 ) 
     543  return -1; 
     544 
     545 d16 = (uint16_t*)mes->data; 
     546 
     547 // check version. 
     548 if ( ROAR_NET2HOST16(d16[0]) != 0 ) 
     549  return -1; 
     550 
     551 switch (ROAR_NET2HOST16(d16[1])) { 
     552  case ROAR_IT_SERVER: 
     553   memset(&info, 0, sizeof(info)); 
     554 
     555   info.version = "roard/? <0/RoarAudio>"; 
     556   info.location = g_config->location; 
     557   info.description = g_config->description; 
     558 
     559   if ( roar_server_info_to_mes(mes, &info) == -1 ) 
     560    return -1; 
     561  break; 
     562  default: /* unknown request */ 
     563    return -1; 
     564   break; 
     565 } 
     566 
     567 mes->cmd = ROAR_CMD_OK; 
     568 
     569 return 0; 
     570} 
     571 
    538572int req_on_server_oinfo    (int client, struct roar_message * mes, char ** data, uint32_t flags[2]) { 
    539573 struct roar_stream s; 
Note: See TracChangeset for help on using the changeset viewer.