#ifndef _QUAGGA_MPLS_H
#define _QUAGGA_MPLS_H
+#include <zebra.h>
#include <arpa/inet.h>
#ifdef MPLS_LABEL_MAX
#undef MPLS_LABEL_MAX
#endif
+#define MPLS_LABEL_HELPSTR \
+ "Specify label(s) for this route\nOne or more " \
+ "labels in the range (16-1048575) separated by '/'\n"
+
/* Well-known MPLS label values (RFC 3032 etc). */
#define MPLS_LABEL_IPV4_EXPLICIT_NULL 0 /* [RFC3032] */
#define MPLS_LABEL_ROUTER_ALERT 1 /* [RFC3032] */
/* Encode a label stack entry from fields; convert to network byte-order as
* the Netlink interface expects MPLS labels to be in this format.
*/
-static inline mpls_lse_t mpls_lse_encode(mpls_label_t label, u_int32_t ttl,
- u_int32_t exp, u_int32_t bos)
+static inline mpls_lse_t mpls_lse_encode(mpls_label_t label, uint32_t ttl,
+ uint32_t exp, uint32_t bos)
{
mpls_lse_t lse;
lse = htonl((label << MPLS_LS_LABEL_SHIFT) | (exp << MPLS_LS_EXP_SHIFT)
* Netlink interface.
*/
static inline void mpls_lse_decode(mpls_lse_t lse, mpls_label_t *label,
- u_int32_t *ttl, u_int32_t *exp,
- u_int32_t *bos)
+ uint32_t *ttl, uint32_t *exp, uint32_t *bos)
{
mpls_lse_t local_lse;
strlcpy(buf, "Router Alert", len);
return (buf);
case MPLS_LABEL_IPV6_EXPLICIT_NULL:
- strlcpy(buf, "IPv6 Explict Null", len);
+ strlcpy(buf, "IPv6 Explicit Null", len);
return (buf);
case MPLS_LABEL_IMPLICIT_NULL:
strlcpy(buf, "implicit-null", len);
}
}
+/*
+ * String to label conversion, labels separated by '/'.
+ */
+int mpls_str2label(const char *label_str, uint8_t *num_labels,
+ mpls_label_t *labels);
+
+/*
+ * Label to string conversion, labels in string separated by '/'.
+ */
+char *mpls_label2str(uint8_t num_labels, mpls_label_t *labels, char *buf,
+ int len, int pretty);
#endif