summaryrefslogtreecommitdiffstats
path: root/src/vppinfra/vector.h
AgeCommit message (Expand)AuthorFilesLines
2022-03-25vppinfra: add vec128_t, vec256_t and vec512_t typesDamjan Marion1-19/+41
2021-12-02vppinfra: vector shuffle cleanupDamjan Marion1-0/+62
2021-11-10vppinfra: new memcpy for x86_64Damjan Marion1-2/+3
2021-07-14vppinfra: remove old and unused vector macros and inlinesDamjan Marion1-41/+0
2021-04-27vlib: improve enqueue_to_next buffer indices extractionDamjan Marion1-4/+0
2021-04-21vppinfra: more avx512 inlines (compress, expand, from, is_equal_mask)Damjan Marion1-4/+1
2020-07-23vppinfra: add *_zero() vector inlinesDamjan Marion1-0/+9
2020-04-30build: rework x86 CPU variantsDamjan Marion1-2/+5
2019-09-26classify: use vector code even when data is not alignedDamjan Marion1-0/+2
2018-08-2832/64 shmem bihash interoperabilityDave Barach1-2/+3
2018-05-20vector functions cleanup and improvementsDamjan Marion1-41/+18
2018-04-25dpdk: complete rework of the dpdk-input nodeDamjan Marion1-3/+14
2018-02-21vppinfra: remove vector_iwmmxt.hDamjan Marion1-4/+0
2018-02-20vppinfra: autogerate vector typedefs and basic inline functionsDamjan Marion1-139/+83
2018-02-20vppinfra: CLIB_HAVE_VEC128 mandates SSE4.2Damjan Marion1-9/+3
2018-02-08add CLIB_HAVE_VEC128 with NEON intrinsics (VPP-1127)Gabriel Ganne1-8/+4
2017-11-10vppinfra: add 512-bit vector definitions and typesDamjan Marion1-0/+25
2016-12-28Reorganize source tree to use single autotools instanceDamjan Marion1-0/+268
t .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
/*
 * Copyright (c) 2015 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 * client.h: dhcp client
 */

#ifndef included_dhcp_client_h
#define included_dhcp_client_h

#include <vnet/ip/ip.h>
#include <vnet/dhcp/dhcp4_packet.h>

#define foreach_dhcp_client_state               \
_(DHCP_DISCOVER)                                \
_(DHCP_REQUEST)                                 \
_(DHCP_BOUND)

typedef enum
{
#define _(a) a,
  foreach_dhcp_client_state
#undef _
} dhcp_client_state_t;

struct dhcp_client_t_;

/**
 * Callback function for DHCP complete events
 */
typedef void (*dhcp_event_cb_t) (u32 client_index,
				 const struct dhcp_client_t_ * client);

typedef struct dhcp_client_t_
{
  dhcp_client_state_t state;

  /* the interface in question */
  u32 sw_if_index;

  /* State machine retry counter */
  u32 retry_count;

  /* Send next pkt at this time */
  f64 next_transmit;
  f64 lease_expires;

  /* DHCP transaction ID, a random number */
  u32 transaction_id;

  /* leased address, other learned info DHCP */
  ip4_address_t leased_address;	/* from your_ip_address field */
  ip4_address_t dhcp_server;
  u32 subnet_mask_width;	/* option 1 */
  ip4_address_t router_address;	/* option 3 */
  u32 lease_renewal_interval;	/* option 51 */
  u32 lease_lifetime;		/* option 59 */

  /* Requested data (option 55) */
  u8 *option_55_data;

  u8 *l2_rewrite;

  /* hostname and software client identifiers */
  u8 *hostname;
  u8 *client_identifier;	/* software version, e.g. vpe 1.0 */

  /* Information used for event callback */
  u32 client_index;
  u32 pid;

  /* Set the broadcast Flag in the Discover/Request messages */
  u8 set_broadcast_flag;
  /* Interface MAC address, so we can do an rx-packet-for-us check */
  u8 client_hardware_address[6];
  u8 client_detect_feature_enabled;

  dhcp_event_cb_t event_callback;
} dhcp_client_t;

typedef struct
{
  /* DHCP client pool */
  dhcp_client_t *clients;
  uword *client_by_sw_if_index;
  u32 seed;

  /* convenience */
  vlib_main_t *vlib_main;
  vnet_main_t *vnet_main;
} dhcp_client_main_t;

typedef struct
{
  int is_add;
  u32 sw_if_index;
  u8 set_broadcast_flag;

  /* vectors, consumed by dhcp client code */
  u8 *hostname;
  u8 *client_identifier;

  /* Bytes containing requested option numbers */
  u8 *option_55_data;

  /* Information used for event callback */
  u32 client_index;
  u32 pid;
  dhcp_event_cb_t event_callback;
} dhcp_client_add_del_args_t;

extern dhcp_client_main_t dhcp_client_main;

#define EVENT_DHCP_CLIENT_WAKEUP	1

int dhcp_client_for_us (u32 bi0,
			vlib_buffer_t * b0,
			ip4_header_t * ip0,
			udp_header_t * u0, dhcp_header_t * dh0);

/**
 * Add/Delete DHCP clients
 */
extern int dhcp_client_config (u32 is_add,
			       u32 client_index,
			       vlib_main_t * vm,
			       u32 sw_if_index,
			       u8 * hostname,
			       u8 * client_id,
			       dhcp_event_cb_t event_callback,
			       u8 set_broadcast_flag, u32 pid);

/**
 * callback function for clients walking the DHCP client configurations
 *
 * @param client The client being visitsed
 * @param data   The data passed during the call to 'walk'
 * @return !0 to continue walking 0 to stop.
 */
typedef int (*dhcp_client_walk_cb_t) (const dhcp_client_t * client,
				      void *data);

/**
 * Walk (visit each) DHCP client configuration
 *
 * @param cb The callback function invoked as each client is visited
 * @param ctx Context data passed back to the client in the invocation of
 *             the callback.
 */
extern void dhcp_client_walk (dhcp_client_walk_cb_t cb, void *ctx);

#endif /* included_dhcp_client_h */

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */