Beispiel #1
0
void *Opening(OpenMessage *open_msg)
{
printf("Opening state\n");
int flag;
int fileID;
fileID=open_msg->file_id;
flag=check_file_valid(fileID);

if(flag==1)
{printf("file #%d valid\n",open_msg->file_id);
AckMessage ackopen_msg;
ackopen_msg.type=5;
ackopen_msg.length=32;


}

else
{printf("file #%d invalid\n",open_msg->file_id);
 ErrorMessage error_msg;
 error_msg.type=1;
 error_msg.length=48;
 error_msg.error_code=3;
}
}
dbus_bool_t
bus_config_parser_trivial_test (const DBusString *test_data_dir)
{
  DBusString full_path;
  dbus_bool_t retval;

  retval = FALSE;

  if (test_data_dir == NULL ||
      _dbus_string_get_length (test_data_dir) == 0)
    {
      printf ("No test data\n");
      return TRUE;
    }
  
  /* We already test default_session_servicedirs and default_system_servicedirs
   * in bus_config_parser_test() */
  if (!process_test_valid_subdir (test_data_dir, "valid-config-files", VALID))
    goto finish;

  /* we don't process all the invalid files, as the trivial parser can't hope
   * to validate them all for all different syntaxes. We just check one broken
   * file to see if junk is received */
  if (!make_full_path (test_data_dir, "invalid-config-files", "not-well-formed.conf", &full_path))
    goto finish;
  if (!check_file_valid (&full_path, INVALID))
    goto finish;
  _dbus_string_free (&full_path);

  /* just test if the check_file_valid works okay and we got sane values */
  if (!make_full_path (test_data_dir, "valid-config-files", "system.conf", &full_path))
    goto finish;
  if (!check_file_valid (&full_path, VALID))
    goto finish;
  /* check to see if we got the correct values from the parser */
  if (!check_return_values (&full_path))
    goto finish;

  /* woot! */
  retval = TRUE;

finish:
  _dbus_string_free (&full_path);

  /* we don't process equiv-config-files as we don't handle <include> */
  return retval;
}