Example #1
0
int config_search_mod(struct katcp_dispatch *d, struct katcp_notice *n, void *data)
{
  struct katcp_stack *stack;
  char *string;
  struct config_setting *cs;

  stack = data;
 
  string = pop_data_expecting_stack_katcp(d, stack, KATCP_TYPE_STRING);
  
  cs = search_config_settings_mod(d, string);
  
  if (cs == NULL){
    log_message_katcp(d, KATCP_LEVEL_INFO, NULL, "config search not found!");
    return -1;
  }

  print_config_setting_type_mod(d, cs);
  
  if (push_named_stack_katcp(d, stack, cs, KATCP_TYPE_CONFIG_SETTING) < 0){
    log_message_katcp(d, KATCP_LEVEL_INFO, NULL, "config search could not push return to stack!");
    return -1;
  }
  
  wake_notice_katcp(d, n, NULL);

  return 0;
}
Example #2
0
int peek_stack_type_statemachine_kcs(struct katcp_dispatch *d, struct katcp_notice *n, void *data)
{
  struct katcp_stack *stack;
  struct katcp_type *t;
  struct katcp_tobject *to;
  char *ctype;

  stack = data;
  if (stack == NULL)
    return -1;

  ctype = pop_data_expecting_stack_katcp(d, stack, KATCP_TYPE_STRING);
  if (ctype == NULL)
    return -1;
  
  t = find_name_type_katcp(d, ctype);
  if (t == NULL)
    return -1;

  to = peek_stack_katcp(stack);
  if (to == NULL && to->o_type != t)
    return -1;

  wake_notice_katcp(d, n, NULL);
  
  return 0;
}
Example #3
0
int is_stack_empty_statemachine_kcs(struct katcp_dispatch *d, struct katcp_notice *n, void *data)
{
  struct katcp_stack *stack;

  stack = data;
  if (stack == NULL)
    return -1;

  if (is_empty_stack_katcp(stack)){
    wake_notice_katcp(d, n, NULL);
    return 0;
  }

  return -1;
}