Пример #1
0
static int	send_specs(int fd, t_scene_spec *spec)
{
  char		tmp[sizeof(t_scene_spec)];

  my_bzero(tmp, sizeof(t_scene_spec));
  create_specs_packet(tmp, spec);
  if (write(fd, tmp, sizeof(t_scene_spec)) == -1 || read_ok(fd))
    return (1);
  write(1, "Specs sent !\n", 13);
  return (0);
}
Пример #2
0
CMPI_RETURN
accessor_put(char* key, void* data, int length)
{
  char buffer[32];
  CMPI_RETURN error;

  fprintf(to_cmpi, "put %s %i\n", key, length);
  fflush(to_cmpi);

  error = read_ok(buffer, from_cmpi);
  CHECK_ERROR;

  buffer_to_stream(data, length, to_cmpi);
  fflush(to_cmpi);

  read_ok(buffer, from_cmpi);
  CHECK_ERROR;

  return CMPI_SUCCESS;
}
Пример #3
0
static void	count_scenes(int fd, t_scene *scenes)
{
  static int	i = 0;

  if (!i)
    while (scenes)
      {
	++i;
	scenes = scenes->next;
      }
  if (send_number(fd, i) || read_ok(fd))
    return ;
  write(1, "Sent new scene\n", 15);
  return ;
}
Пример #4
0
static void
canRead (ccnet_packet *packet, void *arg)
{
    CcnetHandshake *handshake = (CcnetHandshake *)arg;
    ccnet_debug("current state is %d\n", handshake->state);

    switch (handshake->state) {
    case INIT:
        read_peer_id (handshake, packet);
        break;
    case ID_SENT:
        read_peer_id (handshake, packet);
        break;
    case ID_RECEIVED:
        read_ok (handshake, packet);
        break;
    default: g_assert(0) ;
    }
}