- Teoreticky analyzovat problematiku smerovania v pocitacovych sietach
- Navrhnut koncepciu adaptivneho mechanizmu pre optimalizaciu sietovej prevadzky
- Aplikacne realizovat nastroj na riadenie sietovej prevadzky s vyuzitim adaptivneho smerovania
- Experimentalne overit navrhnute riesenie
- Dokumentacia podla standardov katedry
Quagga
OSPF API - umoznuje externym aplikaciam komunikovat s LSDB.
funkcionalita:
- ziskanie celej databazy alebo databazy na zaklade jednotlivych liniek databazy OSPF demona. To umozni aplikaciam ziskat presnu kopiu LSDB vratane router a network LSA. Vzdy ked je OSPF demon dostane nove LSA API modul okamzite informuje aplikaciu poslanim spravy. Tymto je aplikacia stale synchronizovana s LSDB OSPF demona
- api je povodcom vlastny opaque LSA (typ 9, 10, alebo 11) ktore su potom transparentne distribuovane inym routrom vramci "flooding scope" a prijimane inymi aplikaciami cez OSPF API
http://wiki.quagga.net/index.php/Main/OspfApi
Zdrojove kody daemona ospfd (tie zaujimave :))
adresar:
quagga-
verzia /ospfd
- ospf_api.c
- ospf_apiserver.c
- ospf_lsa.c
- ospf_lsdb.c
- ospf_opaque.c
- ospf_packet.c
ospf_api.c
void api_opaque_lsa_print (struct lsa_header *data) - iba na debug ucely
struct msg *msg_new (u_char msgtype, void *msgbody, u_int32_t seqnum, u_int16_t msglen) - generic spravy
struct msg *msg_dup (struct msg *msg) - duplikacia spravy skopirovanim obsahu
struct nametab - iba na testovacie ucely
const char *ospf_api_typename (int msgtype) - prechadza strukturu typu nametab a ked najde zhodu vrati typ spravy inac "?"
const char *ospf_api_errname (int errcode) - podobne ako toto predtym len dekoduje chybovy kod
void msg_print (struct msg *msg) - printne spravu do zlog_debug (WTF?!?)
void msg_free (struct msg *msg) - uvolni stream
void msg_set_seq (struct msg *msg, u_int32_t seqnr) nastavi sekvencne cislo spravy
u_int32_t msg_get_seq (struct msg *msg) - ziskaj sekvencne cislo
struct msg_fifo * msg_fifo_new () - naalokuje nove fifo pre spravy
void msg_fifo_push (struct msg_fifo *fifo, struct msg *msg) - pridaj novu spravu do fifa
struct msg *msg_fifo_pop (struct msg_fifo *fifo) - odoberie prvu spravu z fifa
struct msg *msg_fifo_head (struct msg_fifo *fifo) - vrat prvy zaznam vo fifo ale neostran ho
void msg_fifo_flush (struct msg_fifo *fifo) - odstran zaznamy z fifa
void msg_fifo_free (struct msg_fifo *fifo) - dealokuj API message fifo
struct msg *msg_read (int fd) - precita spravu z fd (zrejme file descriptor)
int msg_write (int fd, struct msg *msg) - zapis spravu do fd. vrat 0 ak OK inac -1
struct msg *new_msg_register_opaque_type (u_int32_t seqnum, u_char ltype, u_char otype) - vrati novy message typu register opaque
struct msg *new_msg_register_event (u_int32_t seqnum, struct lsa_filter_type *filter) - vrati novu spravu typu register event
struct msg *new_msg_sync_lsdb (u_int32_t seqnum, struct lsa_filter_type *filter) - vrati novu spravu typu sync lsdb
struct msg *new_msg_originate_request (u_int32_t seqnum, struct in_addr ifaddr, struct in_addr area_id, struct lsa_header *data) - ...typu originate request
struct msg *new_msg_delete_request (u_int32_t seqnum, struct in_addr area_id, u_char lsa_type, u_char opaque_type, u_int32_t opaque_id) - ...typu delete request
struct msg *new_msg_reply (u_int32_t seqnr, u_char rc) - ...typu reply
struct msg *new_msg_ready_notify (u_int32_t seqnr, u_char lsa_type, u_char opaque_type, struct in_addr addr) - ready notify
struct msg *new_msg_new_if (u_int32_t seqnr, struct in_addr ifaddr, struct in_addr area_id) - typu new if
struct msg *new_msg_del_if (u_int32_t seqnr, struct in_addr ifaddr) - delete if
struct msg *new_msg_ism_change (u_int32_t seqnr, struct in_addr ifaddr, struct in_addr area_id, u_char status) - ism change
struct msg *new_msg_nsm_change (u_int32_t seqnr, struct in_addr ifaddr, struct in_addr nbraddr, struct in_addr router_id, u_char status) - nsm change
struct msg *new_msg_lsa_change_notify (u_char msgtype, u_int32_t seqnum, struct in_addr ifaddr, struct in_addr area_id, u_char is_self_originated, struct <brlsa_header *data) - lsa change notify
ospf_apiserver.c
struct list *apiserver_list - zoznam vsetkych aktivnych spojeni
struct ospf_interface *ospf_apiserver_if_lookup_by_addr (struct in_addr address) - funkcia pre vyhladanie rozhrania podla adresy
struct ospf_interface *ospf_apiserver_if_lookup_by_ifp (struct interface *ifp) - funkcia pre vyhladanie rozhrania podla ifp
unsigned short ospf_apiserver_getport (void) - ziskanie portu v inicializacii
int ospf_apiserver_init (void) - inicializacia OSPF API modulu vyvolana z ospf_opaque_init()
void ospf_apiserver_term (void) - ukoncenie OSPF API modulu
static struct ospf_apiserver *lookup_apiserver (u_char lsa_type, u_char opaque_type) - vyhladaj apiserver
static struct ospf_apiserver *lookup_apiserver_by_lsa (struct ospf_lsa *lsa) - vyhladaj apiserver na zaklade lsa
static int ospf_apiserver_new_lsa_hook (struct ospf_lsa *lsa) - zachytenie noveho lsa - pri debugu
static int ospf_apiserver_del_lsa_hook (struct ospf_lsa *lsa) - to iste pri vymazani
struct ospf_apiserver *ospf_apiserver_new (int fd_sync, int fd_async) - alokovanie novej struktury pre spojenie
void ospf_apiserver_event (enum event event, int fd, struct ospf_apiserver *apiserv) - ??? dake prepnutie na zaklade eventu
void ospf_apiserver_free (struct ospf_apiserver *apiserv) - dealokuj instanciu. najskor treba odregistrovat vsetky aplikaciou pouzite opaque typy, vyflushovat opaque lsa zavedene aplikaciou zo siete a zatvorit spojenie
int ospf_apiserver_read (struct thread *thread) - citanie apiservra
int ospf_apiserver_sync_write (struct thread *thread) - synchronne (?) pisanie apiservra
int ospf_apiserver_async_write (struct thread *thread) - asynchronne (?) pisanie apiservra
int ospf_apiserver_serv_sock_family (unsigned short port, int family) - vrati socket
int ospf_apiserver_accept (struct thread *thread) - akceptuj ziadanie o spojenie z externej aplikacie. pre kazde aplikovane spojenie alokuj vlastnu instanciu pre spojenie
static int ospf_apiserver_send_msg (struct ospf_apiserver *apiserv, struct msg *msg) - posli reply s navratovym kodom klientskej aplikacii
int ospf_apiserver_send_reply (struct ospf_apiserver *apiserv, u_int32_t seqnr, u_char rc) - to iste zrejme
int ospf_apiserver_handle_msg (struct ospf_apiserver *apiserv, struct msg *msg) - message handler dispatcher
int ospf_apiserver_register_opaque_type (struct ospf_apiserver *apiserv, u_char lsa_type, u_char opaque_type) - pre registraciu opaque paketov
int ospf_apiserver_unregister_opaque_type (struct ospf_apiserver *apiserv, u_char lsa_type, u_char opaque_type) - to iste len pre odregistrovanie
static int apiserver_is_opaque_type_registered (struct ospf_apiserver *apiserv, u_char lsa_type, u_char opaque_type) - je registrovany?
int ospf_apiserver_handle_register_opaque_type (struct ospf_apiserver *apiserv, struct msg *msg) - daky handler
void ospf_apiserver_notify_ready_type9 (struct ospf_apiserver *apiserv) - notifikuj specifickeho klienta o vsetkych opaque typoch 9 ktore su pripravene
void ospf_apiserver_notify_ready_type10 (struct ospf_apiserver *apiserv) - to iste len typ 10
void ospf_apiserver_notify_ready_type11 (struct ospf_apiserver *apiserv) - to iste len typ 11
int ospf_apiserver_handle_unregister_opaque_type (struct ospf_apiserver *apiserv, struct msg *msg) - odregistruj typ
int ospf_apiserver_handle_register_event (struct ospf_apiserver *apiserv, struct msg *msg) - pre event (filter) registraciu
static int apiserver_sync_callback (struct ospf_lsa *lsa, void *p_arg, int int_arg) - fcia pre synchronizaciu lsdb
int ospf_apiserver_handle_sync_lsdb (struct ospf_apiserver *apiserv, struct msg *msg) - taky tak :)
struct ospf_lsa * ospf_apiserver_opaque_lsa_new (struct ospf_area *area, struct ospf_interface *oi, struct lsa_header *protolsa) - fcia pre vyslanie alebo update LSA z aplikacie. vytvorenie novej vnutornej opaque lsa vybranim prototypu a vyplnenim chybajucich policok ako age, sekvencne cislo, advertising router, checksum a podobne. parameter rozhrania je pouzity pre typ 9 area parameter pre typ 10. typ 11 nepotrebuje ani jeden
int ospf_apiserver_is_ready_type9 (struct ospf_interface *oi) - typ 9 lsa moze byt vygenerovany ak je na rozhrani aspon jeden opaque capable sused pripojeny
int ospf_apiserver_is_ready_type10 (struct ospf_area *area) - podobne
int ospf_apiserver_is_ready_type11 (struct ospf *ospf) - podobne
int ospf_apiserver_handle_originate_request (struct ospf_apiserver *apiserv, struct msg *msg) - handler pre vytvorenie lsa
void ospf_apiserver_flood_opaque_lsa (struct ospf_lsa *lsa) - flooduj lsa vramci flooding scope. namiesto toho sa da pouzit druhu fciu avsak tam potrebujeme suseda. ak nastavime na null tak padne
int ospf_apiserver_originate1 (struct ospf_lsa *lsa) - vytvor
int ospf_apiserver_lsa9_originator (void *arg) - opaque typu devat mozu byt teraz vytvorene na rozhrani
int ospf_apiserver_lsa10_originator (void *arg) - the same
int ospf_apiserver_lsa11_originator (void *arg) - the same
void ospf_apiserver_lsa_refresher (struct ospf_lsa *lsa) - periodicky refreshovat lsa takze neexpiruju
int ospf_apiserver_handle_delete_request (struct ospf_apiserver *apiserv, struct msg *msg) - pre delete lsa
static int apiserver_flush_opaque_type_callback (struct ospf_lsa *lsa, void *p_arg, int int_arg) - flushni samo vytvorene lsa
void ospf_apiserver_flush_opaque_lsa (struct ospf_apiserver *apiserv, u_char lsa_type, u_char opaque_type) - vymaz samo vytvorene lsa daneho opaque typu. tato funkcia je vytvorena ked aplikacia odregistruje dany opaque typ alebo zavrie spojenie k aplikacii a vsetky tie lsa potrebuju byt mazane s lsdb
int ospf_apiserver_new_if (struct interface *ifp) - callback fcie pre spravu opaque typov
int ospf_apiserver_del_if (struct interface *ifp) - tiez daco take
void ospf_apiserver_ism_change (struct ospf_interface *oi, int old_state) - povedz klientom o zmene rozhrania
void ospf_apiserver_nsm_change (struct ospf_neighbor *nbr, int old_status) - povedz klientom o zmene susedstva
void ospf_apiserver_show_info (struct vty *vty, struct ospf_lsa *lsa) - vystupne info o opaque lsackach
void ospf_apiserver_clients_notify_all (struct msg *msg) - posli spravu vsetkym klientom. toto je uzitocne ak chceme poslat spravu vsetkym anprikllad v pripade zmeny interfaceu
void ospf_apiserver_clients_notify_ready_type9 (struct ospf_interface *oi) - interface je ready pre prijatie opaque lsa. oznam vsetkym registrovanym klientom aby ho pouzivali
void ospf_apiserver_clients_notify_ready_type10 (struct ospf_area *area)
void ospf_apiserver_clients_notify_ready_type11 (struct ospf *top)
void ospf_apiserver_clients_notify_new_if (struct ospf_interface *oi)
void ospf_apiserver_clients_notify_del_if (struct ospf_interface *oi)
void ospf_apiserver_clients_notify_ism_change (struct ospf_interface *oi)
void ospf_apiserver_clients_notify_nsm_change (struct ospf_neighbor *nbr)
static void apiserver_clients_lsa_change_notify (u_char msgtype, struct ospf_lsa *lsa)
static int apiserver_notify_clients_lsa (u_char msgtype, struct ospf_lsa *lsa) - zachytenia vyvolane ked su lsa updateovane alebo zmazane
int ospf_apiserver_lsa_update (struct ospf_lsa *lsa) - vrati lsa update
int ospf_apiserver_lsa_delete (struct ospf_lsa *lsa) - vrati lsa update
ospf_lsa.c
u_int32_t get_metric (u_char *metric) - vrati metriku
struct timeval tv_adjust (struct timeval a) - daky interval (?)
int tv_ceil (struct timeval a) - (?)
int tv_floor (struct timeval a) - (?)
struct timeval int2tv (int a) - (?)
struct timeval tv_add (struct timeval a, struct timeval b) - scitanie intervalov
struct timeval tv_sub (struct timeval a, struct timeval b) - odcitanie intervalov
int tv_cmp (struct timeval a, struct timeval b) - porovnanie - ak rovne odcitaj usec inac sec
int ospf_lsa_refresh_delay (struct ospf_lsa *lsa) - vrati refresh delay
int get_age (struct ospf_lsa *lsa) - vrati age lsacka
u_int16_t ospf_lsa_checksum (struct lsa_header *lsa) - vrati fletcherov checksum - RFC1008
struct ospf_lsa *ospf_lsa_new () - vytvori nove lsa
struct ospf_lsa *ospf_lsa_dup (struct ospf_lsa *lsa) - duplikuj lsa
void ospf_lsa_free (struct ospf_lsa *lsa) - uvolni pamat pre lsa
struct ospf_lsa *ospf_lsa_lock (struct ospf_lsa *lsa) - lockni lsa
void ospf_lsa_unlock (struct ospf_lsa **lsa) - unlockni lsa
void ospf_lsa_discard (struct ospf_lsa *lsa) - checkni discard flag
struct lsa_header *ospf_lsa_data_new (size_t size) - vytvor data lsacka
struct lsa_header *ospf_lsa_data_dup (struct lsa_header *lsah) - duplikuj data pre lsa
void ospf_lsa_data_free (struct lsa_header *lsah) - uvolni pamat pre lsa data
const char *dump_lsa_key (struct ospf_lsa *lsa) - (?)
u_int32_t lsa_seqnum_increment (struct ospf_lsa *lsa) - inkrementuj sekvencne cislo
void lsa_header_set (struct stream *s, u_char options, u_char type, struct in_addr id, struct in_addr router_id) - nastav hlavicku lsa
static u_char router_lsa_flags (struct ospf_area *area) - ziskaj router-lsa flagy
struct ospf_neighbor *ospf_nbr_lookup_ptop (struct ospf_interface *oi) - vyhladaj ineho suseda nez seba. P2P linka musi mat len jedneho suseda
static u_int16_t ospf_link_cost (struct ospf_interface *oi) - zisti cost linky s tym ze zober do uvahy aj stub router podla RFC3137
static char link_info_set (struct stream *s, struct in_addr id, struct in_addr data, u_char type, u_char tos, u_int16_t cost) - nastav informaciu o linke
static int lsa_link_ptop_set (struct stream *s, struct ospf_interface *oi) - nastav popis P2P linky
static int lsa_link_broadcast_set (struct stream *s, struct ospf_interface *oi) - opis broadcast linku
static int lsa_link_loopback_set (struct stream *s, struct ospf_interface *oi) - zrejme to iste pre loopback
static int lsa_link_virtuallink_set (struct stream *s, struct ospf_interface *oi) - to iste pre virtual linku