lib: Add new if_link_params structure

This new structure is the basis to get new link parameters for
Traffic Engineering from Zebra/interface layer to OSPFD and ISISD
for the support of Traffic Engineering

* lib/if.[c,h]: link parameters struture and get/set functions
* lib/command.[c,h]: creation of a new link-node
* lib/zclient.[c,h]: modification to the ZBUS message to convey the
  link parameters structure
* lib/zebra.h: New ZBUS message
* lib/memtypes.c: Add new memory type for Traffic Engineering support

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
diff --git a/lib/if.c b/lib/if.c
index 44b8586..45c1acc 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -168,6 +168,8 @@
 
   list_free (ifp->connected);
 
+  if_link_params_free (ifp);
+  
   XFREE (MTYPE_IF, ifp);
 }
 
@@ -1125,3 +1127,43 @@
     }
   return NULL;
 }
+
+struct if_link_params *
+if_link_params_get (struct interface *ifp)
+{
+  if (ifp->link_params != NULL)
+    return ifp->link_params;
+  
+  struct if_link_params *iflp = XCALLOC(MTYPE_IF_LINK_PARAMS,
+                                      sizeof (struct if_link_params));
+  if (iflp == NULL) return NULL;
+  
+  /* Set TE metric == standard metric */
+  iflp->te_metric = ifp->metric;
+
+  /* Compute default bandwidth based on interface */
+  int bw = (float)((ifp->bandwidth ? ifp->bandwidth : DEFAULT_BANDWIDTH) 
+                   * TE_KILO_BIT / TE_BYTE);
+  
+  /* Set Max, Reservable and Unreserved Bandwidth */
+  iflp->max_bw = bw;
+  iflp->max_rsv_bw = bw;
+  for (int i = 0; i < MAX_CLASS_TYPE; i++)
+    iflp->unrsv_bw[i] = bw;
+  
+  /* Update Link parameters status */
+  iflp->lp_status = LP_TE | LP_MAX_BW | LP_MAX_RSV_BW | LP_UNRSV_BW;
+
+  /* Finally attach newly created Link Parameters */
+  ifp->link_params = iflp;
+
+  return iflp;
+}
+
+void
+if_link_params_free (struct interface *ifp)
+{
+  if (ifp->link_params == NULL) return;
+  XFREE(MTYPE_IF_LINK_PARAMS, ifp->link_params);
+  ifp->link_params = NULL;
+}