Ejemplo n.º 1
0
void condor_sockaddr::set_protocol(condor_protocol proto) {
	switch(proto) {
		case CP_IPV4: set_ipv4(); break;
		case CP_IPV6: set_ipv6(); break;
		default: ASSERT(0); break;
	}
}
Ejemplo n.º 2
0
static int execute_set_action(struct sk_buff *skb,
				 const struct nlattr *nested_attr)
{
	int err = 0;

	switch (nla_type(nested_attr)) {
	case OVS_KEY_ATTR_PRIORITY:
		skb->priority = nla_get_u32(nested_attr);
		break;

	case OVS_KEY_ATTR_ETHERNET:
		err = set_eth_addr(skb, nla_data(nested_attr));
		break;

	case OVS_KEY_ATTR_IPV4:
		err = set_ipv4(skb, nla_data(nested_attr));
		break;

	case OVS_KEY_ATTR_TCP:
		err = set_tcp(skb, nla_data(nested_attr));
		break;

	case OVS_KEY_ATTR_UDP:
		err = set_udp(skb, nla_data(nested_attr));
		break;
	}

	return err;
}
Ejemplo n.º 3
0
void tictacpacket::MergeFrom(const tictacpacket& from) {
  GOOGLE_CHECK_NE(&from, this);
  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
    if (from.has_ipv4()) {
      set_ipv4(from.ipv4());
    }
    if (from.has_msgtype()) {
      set_msgtype(from.msgtype());
    }
    if (from.has_playername()) {
      set_playername(from.playername());
    }
    if (from.has_state()) {
      set_state(from.state());
    }
    if (from.has_ipv4opp()) {
      set_ipv4opp(from.ipv4opp());
    }
    if (from.has_endtype()) {
      set_endtype(from.endtype());
    }
    if (from.has_npos()) {
      set_npos(from.npos());
    }
  }
  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
Ejemplo n.º 4
0
static int execute_set_action(struct sk_buff *skb,
				 const struct nlattr *nested_attr,
				 struct ovs_key_ipv4_tunnel *tun_key)
{
	int err = 0;

	switch (nla_type(nested_attr)) {
	case OVS_KEY_ATTR_PRIORITY:
		skb->priority = nla_get_u32(nested_attr);
		break;

	case OVS_KEY_ATTR_TUN_ID:
		/* If we're only using the TUN_ID action, store the value in a
		 * temporary instance of struct ovs_key_ipv4_tunnel on the stack.
		 * If both IPV4_TUNNEL and TUN_ID are being used together we
		 * can't write into the IPV4_TUNNEL action, so make a copy and
		 * write into that version.
		 */
		if (!OVS_CB(skb)->tun_key)
			memset(tun_key, 0, sizeof(*tun_key));
		else if (OVS_CB(skb)->tun_key != tun_key)
			memcpy(tun_key, OVS_CB(skb)->tun_key, sizeof(*tun_key));
		OVS_CB(skb)->tun_key = tun_key;

		OVS_CB(skb)->tun_key->tun_id = nla_get_be64(nested_attr);
		break;

	case OVS_KEY_ATTR_IPV4_TUNNEL:
		OVS_CB(skb)->tun_key = nla_data(nested_attr);
		break;

	case OVS_KEY_ATTR_ETHERNET:
		err = set_eth_addr(skb, nla_data(nested_attr));
		break;

	case OVS_KEY_ATTR_IPV4:
		err = set_ipv4(skb, nla_data(nested_attr));
		break;

	case OVS_KEY_ATTR_TCP:
		err = set_tcp(skb, nla_data(nested_attr));
		break;

	case OVS_KEY_ATTR_UDP:
		err = set_udp(skb, nla_data(nested_attr));
		break;
	}

	return err;
}
Ejemplo n.º 5
0
static int execute_set_action(struct sk_buff *skb,
				 const struct nlattr *nested_attr,
				 struct ovs_key_ipv4_tunnel *tun_key)
{
	int err = 0;

	switch (nla_type(nested_attr)) {
	case OVS_KEY_ATTR_PRIORITY:
		skb->priority = nla_get_u32(nested_attr);
		break;

	case OVS_KEY_ATTR_TUN_ID:
		if (!OVS_CB(skb)->tun_key) {
			/* If tun_key is NULL for this skb, assign it to
			 * a value the caller passed in for action processing
			 * and output. This can disappear once we drop support
			 * for setting tun_id outside of tun_key.
			 */
			memset(tun_key, 0, sizeof(struct ovs_key_ipv4_tunnel));
			OVS_CB(skb)->tun_key = tun_key;
		}

		OVS_CB(skb)->tun_key->tun_id = nla_get_be64(nested_attr);
		OVS_CB(skb)->tun_key->tun_flags |= OVS_FLOW_TNL_F_KEY;
		break;

	case OVS_KEY_ATTR_IPV4_TUNNEL:
		OVS_CB(skb)->tun_key = nla_data(nested_attr);
		break;

	case OVS_KEY_ATTR_ETHERNET:
		err = set_eth_addr(skb, nla_data(nested_attr));
		break;

	case OVS_KEY_ATTR_IPV4:
		err = set_ipv4(skb, nla_data(nested_attr));
		break;

	case OVS_KEY_ATTR_TCP:
		err = set_tcp(skb, nla_data(nested_attr));
		break;

	case OVS_KEY_ATTR_UDP:
		err = set_udp(skb, nla_data(nested_attr));
		break;
	}

	return err;
}
Ejemplo n.º 6
0
IpAddress::IpAddress(u_int32_t _ipv4) {
  ip_key = 0;
  set_ipv4(_ipv4);
  compute_key();
}
IPAddress& IPAddress::operator=(const uint8_t* address)
{
    set_ipv4(address[0], address[1], address[2], address[3]);
    return *this;
}
IPAddress::IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet)
{
    set_ipv4(first_octet, second_octet, third_octet, fourth_octet);
}