示例#1
0
void
reset_conversation_table_data(conv_hash_t *ch)
{
    if (!ch) {
        return;
    }

    if (ch->conv_array != NULL) {
        guint i;
        for(i = 0; i < ch->conv_array->len; i++){
            conv_item_t *conv = &g_array_index(ch->conv_array, conv_item_t, i);
            free_address(&conv->src_address);
            free_address(&conv->dst_address);
        }

        g_array_free(ch->conv_array, TRUE);
    }

    if (ch->hashtable != NULL) {
        g_hash_table_destroy(ch->hashtable);
    }

    ch->conv_array=NULL;
    ch->hashtable=NULL;
}
示例#2
0
static void sequence_analysis_item_free(gpointer data)
{
    seq_analysis_item_t *seq_item = (seq_analysis_item_t *)data;
    g_free(seq_item->frame_label);
    g_free(seq_item->time_str);
    g_free(seq_item->comment);
    free_address(&seq_item->src_addr);
    free_address(&seq_item->dst_addr);
    g_free(data);
}
示例#3
0
文件: rfc822.c 项目: 2ion/mutt-1.5.22
int rfc822_remove_from_adrlist (ADDRESS **a, const char *mailbox)
{
  ADDRESS *p, *last = NULL, *t;
  int rv = -1;

  p = *a;
  last = NULL;
  while (p)
  {
    if (ascii_strcasecmp (mailbox, p->mailbox) == 0)
    {
      if (last)
	last->next = p->next;
      else
	(*a) = p->next;
      t = p;
      p = p->next;
      free_address (t);
      rv = 0;
    }
    else
    {
      last = p;
      p = p->next;
    }
  }

  return (rv);
}
/**
 * Destroy the given address.
 *
 * @param addr address to destroy
 * @return GNUNET_YES if bandwidth allocations should be recalcualted
 */
static int
destroy_address (struct ATS_Address *addr)
{
  int ret;

  ret = GNUNET_NO;
  GNUNET_assert (GNUNET_YES ==
                 GNUNET_CONTAINER_multihashmap_remove (addresses,
                                                       &addr->peer.hashPubKey,
                                                       addr));

#if HAVE_LIBGLPK
  if (ats_mode == MLP)
    GAS_mlp_address_delete (mlp, addresses, addr);
#endif

  if (GNUNET_YES == addr->active)
  {
    active_addr_count--;
    addr->active = GNUNET_NO;
    ret = GNUNET_YES;
  }
  free_address (addr);
  return ret;
}
void
GAS_addresses_destroy (const struct GNUNET_PeerIdentity *peer,
                       const char *plugin_name, const void *plugin_addr,
                       size_t plugin_addr_len, uint32_t session_id)
{
  struct ATS_Address *aa;
  struct ATS_Address *old;

  if (GNUNET_NO == running)
    return;

  /* Get existing address */
  old = lookup_address (peer, plugin_name, plugin_addr, plugin_addr_len,
                       session_id, NULL, 0);
  if (old == NULL)
  {
    GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Tried to destroy unknown address for peer `%s' `%s' session id %u\n",
                GNUNET_i2s (peer), plugin_name, session_id);
    return;
  }


  GNUNET_break (0 < strlen (plugin_name));
  aa = create_address (peer, plugin_name, plugin_addr, plugin_addr_len, session_id);

  GNUNET_CONTAINER_multihashmap_get_multiple (addresses, &peer->hashPubKey,
                                              &destroy_by_session_id, aa);

  free_address (aa);
}
static struct ATS_Address *
lookup_address (const struct GNUNET_PeerIdentity *peer,
                const char *plugin_name, const void *plugin_addr,
                size_t plugin_addr_len, uint32_t session_id,
                const struct GNUNET_ATS_Information *atsi,
                uint32_t atsi_count)
{
  struct ATS_Address *aa;
  struct ATS_Address *old;

  aa = create_address (peer,
                       plugin_name,
                       plugin_addr, plugin_addr_len,
                       session_id);

  aa->mlp_information = NULL;
  aa->ats = GNUNET_malloc (atsi_count * sizeof (struct GNUNET_ATS_Information));
  aa->ats_count = atsi_count;
  memcpy (aa->ats, atsi, atsi_count * sizeof (struct GNUNET_ATS_Information));

  /* Get existing address or address with session == 0 */
  old = find_address (peer, aa);
  free_address (aa);
  if (old == NULL)
  {
    return NULL;
  }
  else if (old->session_id != session_id)
  {
    return NULL;
  }
  return old;
}
示例#7
0
void free_dhcp (dhcp_t *dhcp)
{
	if (! dhcp)
		return;

	free_route (dhcp->routes);
	free (dhcp->hostname);
	free_address (dhcp->dnsservers);
	free (dhcp->dnsdomain);
	free (dhcp->dnssearch);
	free_address (dhcp->ntpservers);
	free (dhcp->nisdomain);
	free_address (dhcp->nisservers);
	free (dhcp->rootpath);
	if (dhcp->fqdn) {
		free (dhcp->fqdn->name);
		free (dhcp->fqdn);
	}
}
示例#8
0
void
sequence_analysis_free_nodes(seq_analysis_info_t *sainfo)
{
    int i;

    for (i=0; i<MAX_NUM_NODES; i++) {
        free_address(&sainfo->nodes[i]);
    }
    sainfo->num_nodes = 0;
}
/** Make a copy of an address_t object */
address_t copy_address(address_t self)
{ address_t it,out=0;
  if(!self) return 0;
  TRY(out=make_address());
  for(it=address_begin(self);it;it=address_next(self))
    address_push(out,address_id(it));
  return out;
Error:
  free_address(out);
  return 0;
}
示例#10
0
void
follow_info_free(follow_info_t* follow_info)
{
    GList *cur;
    follow_record_t *follow_record;

    for (cur = follow_info->payload; cur; cur = g_list_next(cur)) {
        if(cur->data) {
            follow_record = (follow_record_t *)cur->data;
            if(follow_record->data)
                g_byte_array_free(follow_record->data, TRUE);

            g_free(follow_record);
        }
    }
    g_list_free(follow_info->payload);

    //Only TCP stream uses fragments
    for (cur = follow_info->fragments[0]; cur; cur = g_list_next(cur)) {
        follow_record = (follow_record_t *)cur->data;
        if(follow_record->data) {
            g_byte_array_free(follow_record->data, TRUE);
        }
        g_free(follow_record);
    }
    for (cur = follow_info->fragments[1]; cur; cur = g_list_next(cur)) {
        follow_record = (follow_record_t *)cur->data;
        if(follow_record->data) {
            g_byte_array_free(follow_record->data, TRUE);
        }
        g_free(follow_record);
    }

    free_address(&follow_info->client_ip);
    free_address(&follow_info->server_ip);
    g_free(follow_info->filter_out_filter);
    g_free(follow_info);
}
示例#11
0
void free_chat_args(struct chat_args* a)
{
    if(a->local_key_path!=NULL)
    {
        free(a->local_key_path);
        a->local_key_path=NULL;
    }
    if(a->remote_key_path!=NULL)
    {
        free(a->remote_key_path);
        a->remote_key_path=NULL;
    }
    free_address(&a->addr);
}
address_t address_from_int(uint64_t v, size_t ndigits, uint64_t base)
{ size_t i;
  address_t out=0;
  TRY(out=make_address());
  if(v==0)
    return out;
  TRY(reserve(out,ndigits));
  out->sz=ndigits;
  for(i=0;i<ndigits;++i)
  { out->ids[ndigits-i-1]=v?(v-1)%base:0;    // 0 is root.  digits 1-4 address nodes on the path.
    v/=base;
  }
  return out;
Error:
  free_address(out);
  return 0;
}
void
GAS_addresses_destroy (const struct GNUNET_PeerIdentity *peer,
                       const char *plugin_name, const void *plugin_addr,
                       size_t plugin_addr_len, uint32_t session_id)
{
  struct ATS_Address *aa;

  if (GNUNET_NO == running)
    return;

  GNUNET_break (0 < strlen (plugin_name));
  aa = create_address (peer, plugin_name, plugin_addr, plugin_addr_len, session_id);

  GNUNET_CONTAINER_multihashmap_get_multiple (addresses, &peer->hashPubKey,
                                              &destroy_by_session_id, aa);

  free_address (aa);
}
int
GAS_addresses_in_use (const struct GNUNET_PeerIdentity *peer,
                      const char *plugin_name, const void *plugin_addr,
                      size_t plugin_addr_len, uint32_t session_id, int in_use)
{
#if DEBUG_ATS
  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Received `%s' message for peer `%s': %i\n", "ADDRESS_IN_USE",
              GNUNET_i2s (peer), in_use);
#endif

  struct ATS_Address *aa;
  struct ATS_Address *old;

  if (GNUNET_NO == running)
    return GNUNET_SYSERR;

  aa = create_address (peer, plugin_name, plugin_addr, plugin_addr_len, session_id);
  old = find_exact_address (peer, aa);
  free_address (aa);

  if (NULL == old)
  {
    GNUNET_break (0);
    return GNUNET_SYSERR;
  }
  if (old->used == in_use)
  {
    GNUNET_break (0);
    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                "Address in use called multiple times for peer `%s': %s -> %s \n",
                GNUNET_i2s (peer),
                (GNUNET_NO == old->used) ? "NO" : "YES",
                (GNUNET_NO == in_use) ? "NO" : "YES");
    return GNUNET_SYSERR;
  }
  old->used = in_use;
#if HAVE_LIBGLPK
  if (ats_mode == MLP)
     GAS_mlp_address_update (mlp, addresses, old);
#endif
  return GNUNET_OK;
}
示例#15
0
void reset_hostlist_table_data(conv_hash_t *ch)
{
    if (!ch) {
        return;
    }

    if (ch->conv_array != NULL) {
        guint i;
        for(i = 0; i < ch->conv_array->len; i++){
            hostlist_talker_t *host = &g_array_index(ch->conv_array, hostlist_talker_t, i);
            free_address(&host->myaddress);
        }

        g_array_free(ch->conv_array, TRUE);
    }

    if (ch->hashtable != NULL) {
        g_hash_table_destroy(ch->hashtable);
    }

    ch->conv_array=NULL;
    ch->hashtable=NULL;
}
示例#16
0
/* free memory allocated for id */
void rtpstream_id_free(rtpstream_id_t *id)
{
	free_address(&(id->src_addr));
	free_address(&(id->dst_addr));
	memset(id, 0, sizeof(*id));
}