Author: adrian.chadd
Date: Mon Feb 23 05:54:26 2009
New Revision: 13850
Added:
playpen/LUSCA_HEAD_bgp/libsqbgp/bgp_aspath.c
playpen/LUSCA_HEAD_bgp/libsqbgp/bgp_aspath.h
Log:
Begin fleshing out an AS path storage method.
I'm not sure how to effectively handle networks w/ AS paths w/ NUL's in
them,
as the strcmp() function just won't compare those, thus the "normal" hash
table functions can't be (ab)used..
Added: playpen/LUSCA_HEAD_bgp/libsqbgp/bgp_aspath.c
==============================================================================
--- (empty file)
+++ playpen/LUSCA_HEAD_bgp/libsqbgp/bgp_aspath.c Mon Feb 23 05:54:26 2009
@@ -0,0 +1,58 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include "../include/util.h"
+#include "../include/hash.h"
+#include "../libcore/tools.h"
+#include "../libsqdebug/debug.h"
+
+#include "bgp_aspath.h"
+
+
+void
+aspath_head_init(aspath_head_t *h)
+{
+ bzero(h, sizeof(*h));
+}
+
+void
+aspath_head_free(aspath_head_t *h)
+{
+
+}
+
+/*
+ * Create an AS path. This does NOT check for duplicate
+ * entries!
+ */
+aspath_entry_t *
+aspath_create(u_int16_t *aspath, int aspath_cnt)
+{
+
+}
+
+/*
+ * create or ref an AS Path
+ */
+aspath_entry_t *
+aspath_get(u_int16_t *aspath, int aspath_cnt)
+{
+
+}
+
+/*
+ * deref and potentially free the given as path
+ */
+void
+aspath_deref(aspath_entry_t *a)
+{
+
+}
Added: playpen/LUSCA_HEAD_bgp/libsqbgp/bgp_aspath.h
==============================================================================
--- (empty file)
+++ playpen/LUSCA_HEAD_bgp/libsqbgp/bgp_aspath.h Mon Feb 23 05:54:26 2009
@@ -0,0 +1,24 @@
+#ifndef __LIBSQBGP_ASPATH_H__
+#define __LIBSQBGP_ASPATH_H__
+
+struct _aspath_entry {
+ hash_link *link;
+ int *aspath;
+ int aspath_cnt;
+ int refcnt;
+};
+typedef struct _aspath_entry aspath_entry_t;
+
+struct _aspath_head {
+ hash_table *h;
+};
+typedef struct _aspath_head aspath_head_t;
+
+void aspath_head_init(aspath_head_t *h);
+void aspath_head_free(aspath_head_t *h);
+
+aspath_entry_t * aspath_create(u_int16_t *aspath, int aspath_cnt);
+aspath_entry_t * aspath_get(u_int16_t *aspath, int aspath_cnt);
+void aspath_deref(aspath_entry_t *a);
+
+#endif
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"lusca-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/lusca-commit?hl=en
-~----------~----~----~----~------~----~------~--~---