Changeset 4500:07a9fe743aa1 in roaraudio


Ignore:
Timestamp:
10/13/10 02:55:42 (8 years ago)
Author:
phi
Branch:
default
Message:

done some basic work for stds listing

Location:
roard
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • roard/commands.c

    r4467 r4500  
    5757                                                                                       // provieds all needed features 
    5858  {ROAR_CMD_SERVER_OINFO, _NAME("SERVER_OINFO"), req_on_server_oinfo, ACCLEV_IDENTED}, // same as above 
     59  {ROAR_CMD_CAPS,         _NAME("CAPS"),         req_on_caps,         ACCLEV_IDENTED}, // and again the same 
    5960  {ROAR_CMD_GET_STANDBY,  _NAME("GET_STANDBY"),  req_on_get_standby,  ACCLEV_GUEST}, 
    6061  {ROAR_CMD_SET_STANDBY,  _NAME("SET_STANDBY"),  req_on_set_standby,  ACCLEV_PWRUSER}, // should this be set to ACCLEV_ALL? 
  • roard/include/req.h

    r4431 r4500  
    5656int req_on_server_oinfo(int client, struct roar_message * mes, char ** data, uint32_t flags[2]); 
    5757 
     58int req_on_caps        (int client, struct roar_message * mes, char ** data, uint32_t flags[2]); 
     59 
    5860int req_on_list_clients(int client, struct roar_message * mes, char ** data, uint32_t flags[2]); 
    5961int req_on_list_streams(int client, struct roar_message * mes, char ** data, uint32_t flags[2]); 
  • roard/req.c

    r4474 r4500  
    644644} 
    645645 
     646int req_on_caps        (int client, struct roar_message * mes, char ** data, uint32_t flags[2]) { 
     647 struct roar_caps caps; 
     648 struct roar_stds * stds; 
     649 size_t i; 
     650 
     651 if ( roar_caps_from_msg(&caps, mes, *data) == -1 ) 
     652  return -1; 
     653 
     654 // handle the data from the caps command here... 
     655 
     656 if ( !(caps.flags & ROAR_CF_REQUEST) ) { 
     657  mes->cmd = ROAR_CMD_OK; 
     658  mes->datalen = 0; 
     659  return 0; 
     660 } 
     661 
     662 mes->datalen = 0; 
     663 
     664 switch (caps.type) { 
     665  case ROAR_CT_STANDARDS: 
     666    if ( (stds = roar_stds_new(1)) == NULL ) 
     667     return -1; 
     668    stds->stds[0] = 0x11223344; 
     669 
     670    for ( i = 0; i < stds->stds_len; i++) { 
     671     stds->stds[i] = ROAR_HOST2NET32(stds->stds[i]); 
     672    } 
     673 
     674    caps.data = stds->stds; 
     675    caps.len  = stds->stds_len * 4; 
     676    // TODO: add support for **data. 
     677    if ( roar_caps_to_msg(mes, &caps, NULL) == -1 ) { 
     678     roar_stds_free(stds); 
     679     return -1; 
     680    } 
     681    roar_stds_free(stds); 
     682   break; 
     683  default: 
     684    return -1; 
     685   break; 
     686 } 
     687 
     688 mes->cmd = ROAR_CMD_OK; 
     689 
     690 return 0; 
     691} 
    646692 
    647693int req_on_get_standby (int client, struct roar_message * mes, char ** data, uint32_t flags[2]) { 
Note: See TracChangeset for help on using the changeset viewer.