]> git.proxmox.com Git - mirror_frr.git/blobdiff - isisd/isis_spf_private.h
zebra, lib: fix the ZEBRA_INTERFACE_VRF_UPDATE zapi message
[mirror_frr.git] / isisd / isis_spf_private.h
index 2c6514d470b48a4c3cf7f3617d188196acbf4e2b..3a05df3f1493fd8733c1589adc7f7e21fa1cf570 100644 (file)
@@ -53,13 +53,12 @@ struct prefix_pair {
 /*
  * Triple <N, d(N), {Adj(N)}>
  */
-union isis_N {
-       uint8_t id[ISIS_SYS_ID_LEN + 1];
-       struct prefix_pair ip;
-};
 struct isis_vertex {
        enum vertextype type;
-       union isis_N N;
+       union {
+               uint8_t id[ISIS_SYS_ID_LEN + 1];
+               struct prefix_pair ip;
+       } N;
        uint32_t d_N;     /* d(N) Distance from this IS      */
        uint16_t depth; /* The depth in the imaginary tree */
        struct list *Adj_N;    /* {Adj(N)} next hop or neighbor list */
@@ -96,19 +95,19 @@ static unsigned isis_vertex_queue_hash_key(void *vp)
 }
 
 __attribute__((__unused__))
-static int isis_vertex_queue_hash_cmp(const void *a, const void *b)
+static bool isis_vertex_queue_hash_cmp(const void *a, const void *b)
 {
        const struct isis_vertex *va = a, *vb = b;
 
        if (va->type != vb->type)
-               return 0;
+               return false;
 
        if (VTYPE_IP(va->type)) {
                if (prefix_cmp(&va->N.ip.dest, &vb->N.ip.dest))
-                       return 0;
+                       return false;
 
-               return prefix_cmp((struct prefix *)&va->N.ip.src,
-                                 (struct prefix *)&vb->N.ip.src) == 0;
+               return prefix_cmp((const struct prefix *)&va->N.ip.src,
+                                 (const struct prefix *)&vb->N.ip.src) == 0;
        }
 
        return memcmp(va->N.id, vb->N.id, ISIS_SYS_ID_LEN + 1) == 0;
@@ -169,8 +168,8 @@ static void isis_vertex_queue_init(struct isis_vertex_queue *queue,
 __attribute__((__unused__))
 static void isis_vertex_del(struct isis_vertex *vertex)
 {
-       list_delete_and_null(&vertex->Adj_N);
-       list_delete_and_null(&vertex->parents);
+       list_delete(&vertex->Adj_N);
+       list_delete(&vertex->parents);
        if (vertex->firsthops) {
                hash_clean(vertex->firsthops, NULL);
                hash_free(vertex->firsthops);
@@ -213,7 +212,7 @@ static void isis_vertex_queue_free(struct isis_vertex_queue *queue)
                skiplist_free(queue->l.slist);
                queue->l.slist = NULL;
        } else
-               list_delete_and_null(&queue->l.list);
+               list_delete(&queue->l.list);
 }
 
 __attribute__((__unused__))
@@ -239,9 +238,12 @@ static void isis_vertex_queue_append(struct isis_vertex_queue *queue,
 __attribute__((__unused__))
 static struct isis_vertex *isis_vertex_queue_last(struct isis_vertex_queue *queue)
 {
-       assert(!queue->insert_counter);
+       struct listnode *tail;
 
-       return listgetdata(listtail(queue->l.list));
+       assert(!queue->insert_counter);
+       tail = listtail(queue->l.list);
+       assert(tail);
+       return listgetdata(tail);
 }
 
 __attribute__((__unused__))
@@ -309,28 +311,28 @@ struct isis_spftree {
 };
 
 __attribute__((__unused__))
-static void isis_vertex_id_init(struct isis_vertex *vertex, const union isis_N *n,
+static void isis_vertex_id_init(struct isis_vertex *vertex, const void *id,
                                enum vertextype vtype)
 {
        vertex->type = vtype;
 
        if (VTYPE_IS(vtype) || VTYPE_ES(vtype)) {
-               memcpy(vertex->N.id, n->id, ISIS_SYS_ID_LEN + 1);
+               memcpy(vertex->N.id, id, ISIS_SYS_ID_LEN + 1);
        } else if (VTYPE_IP(vtype)) {
-               memcpy(&vertex->N.ip, &n->ip, sizeof(n->ip));
+               memcpy(&vertex->N.ip, id, sizeof(vertex->N.ip));
        } else {
-               flog_err(LIB_ERR_DEVELOPMENT, "Unknown Vertex Type");
+               flog_err(EC_LIB_DEVELOPMENT, "Unknown Vertex Type");
        }
 }
 
 __attribute__((__unused__))
 static struct isis_vertex *isis_find_vertex(struct isis_vertex_queue *queue,
-                                           union isis_N *n,
+                                           const void *id,
                                            enum vertextype vtype)
 {
        struct isis_vertex querier;
 
-       isis_vertex_id_init(&querier, n, vtype);
+       isis_vertex_id_init(&querier, id, vtype);
        return hash_lookup(queue->hash, &querier);
 }
 
@@ -354,4 +356,7 @@ static struct isis_lsp *lsp_for_vertex(struct isis_spftree *spftree,
        return NULL;
 }
 
+#define VID2STR_BUFFER SRCDEST2STR_BUFFER
+const char *vid2string(struct isis_vertex *vertex, char *buff, int size);
+
 #endif