Revision ef5081af proto/bgp/bgp.h
proto/bgp/bgp.h | ||
---|---|---|
20 | 20 |
#include "lib/hash.h" |
21 | 21 |
#include "lib/socket.h" |
22 | 22 |
|
23 |
#include "map.h" |
|
24 |
|
|
23 | 25 |
struct linpool; |
24 | 26 |
struct eattr; |
25 | 27 |
|
... | ... | |
214 | 216 |
timer *connect_timer; |
215 | 217 |
timer *hold_timer; |
216 | 218 |
timer *keepalive_timer; |
219 |
|
|
220 |
/* My personal timers */ |
|
221 |
timer *mrai_timer; |
|
222 |
|
|
217 | 223 |
event *tx_ev; |
218 | 224 |
u32 packets_to_send; /* Bitmap of packet types to be sent */ |
219 | 225 |
u32 channels_to_send; /* Bitmap of channels with packets to be sent */ |
... | ... | |
263 | 269 |
u8 last_error_class; /* Error class of last error */ |
264 | 270 |
u32 last_error_code; /* Error code of last error. BGP protocol errors |
265 | 271 |
are encoded as (bgp_err_code << 16 | bgp_err_subcode) */ |
272 |
unsigned int number_of_update_sent; |
|
273 |
|
|
274 |
//TODO insert variables in the protocol and not in general |
|
266 | 275 |
}; |
267 | 276 |
|
268 | 277 |
struct bgp_channel { |
... | ... | |
442 | 451 |
struct rte_source *bgp_find_source(struct bgp_proto *p, u32 path_id); |
443 | 452 |
struct rte_source *bgp_get_source(struct bgp_proto *p, u32 path_id); |
444 | 453 |
|
445 |
|
|
454 |
//Aggiunta a manina |
|
455 |
//Potrebbe essere utile in alcune situaizoni per avere un recap del protocollo |
|
456 |
void bgp_show_proto_info_mine(struct bgp_proto *P); |
|
446 | 457 |
|
447 | 458 |
#ifdef LOCAL_DEBUG |
448 | 459 |
#define BGP_FORCE_DEBUG 1 |
... | ... | |
471 | 482 |
bgp_set_attr_u32(ea_list **to, struct linpool *pool, uint code, uint flags, u32 val) |
472 | 483 |
{ bgp_set_attr(to, pool, code, flags, (uintptr_t) val); } |
473 | 484 |
|
485 |
eattr * |
|
486 |
bgp_set_attr_load(ea_list **attrs, struct linpool *pool, uint code, uint flags, uintptr_t val); |
|
487 |
|
|
488 |
static inline void |
|
489 |
bgp_set_attr_load_u32(ea_list **to, struct linpool *pool, uint code, uint flags, double val) |
|
490 |
{ bgp_set_attr_load(to, pool, code, flags, (uintptr_t) val); } |
|
491 |
|
|
474 | 492 |
static inline void |
475 | 493 |
bgp_set_attr_ptr(ea_list **to, struct linpool *pool, uint code, uint flags, struct adata *val) |
476 | 494 |
{ bgp_set_attr(to, pool, code, flags, (uintptr_t) val); } |
... | ... | |
509 | 527 |
int bgp_get_attr(struct eattr *e, byte *buf, int buflen); |
510 | 528 |
void bgp_get_route_info(struct rte *, byte *buf, struct ea_list *attrs); |
511 | 529 |
|
530 |
/* attrs.c */ //TODO all this functions was static and not in the .h |
|
531 |
ea_list *bgp_update_attrs(struct bgp_proto *p, struct bgp_channel *c, rte *e, ea_list *attrs0, struct linpool *pool); |
|
532 |
struct bgp_bucket *bgp_get_bucket(struct bgp_channel *c, ea_list *new); |
|
533 |
struct bgp_prefix *bgp_get_prefix(struct bgp_channel *c, net_addr *net, u32 path_id); |
|
512 | 534 |
|
513 | 535 |
/* packets.c */ |
514 | 536 |
|
... | ... | |
559 | 581 |
#define BA_AS4_AGGREGATOR 0x12 /* RFC 6793 */ |
560 | 582 |
#define BA_LARGE_COMMUNITY 0x20 /* RFC 8092 */ |
561 | 583 |
|
584 |
#define BA_LOAD_OUT 0x22 |
|
585 |
#define BA_AS_NH_LIST 0x23 |
|
586 |
#define BA_AS_LOAD 0x24 |
|
587 |
|
|
588 |
//TODO refactor position of this functions |
|
589 |
void |
|
590 |
statoAttualeDellaMappa(void); |
|
591 |
void |
|
592 |
statoAttualeDellaMappaMinimal(void); |
|
593 |
void |
|
594 |
updateNHmap(int); |
|
595 |
|
|
596 |
void initRTmap(void); |
|
597 |
|
|
598 |
/* |
|
599 |
* Punto ad utilizzare una mappa delle destinazioni |
|
600 |
* Chiave della mappa: net_addr_ip4 in modo da identificare univocamente una destinazione |
|
601 |
* d -> identifica la chiave ed è anche elemento interno in modo da poterlo usare se necessario |
|
602 |
* m -> identificata la metrica, essenzialmente in bgp non ci interessa per mantenere una sola metrica |
|
603 |
* NH-> Lista dei next hop per raggiungere la destinazione, è l'AS_PATH |
|
604 |
* loadin -> mappa per i previus hop ed i loro contributi, in sostanza quelli a cui manderò la rotta, con relativo contributo |
|
605 |
* load -> centralità di d conosciuta dal nodo |
|
606 |
*/ |
|
607 |
|
|
608 |
typedef struct { |
|
609 |
net_addr *d; |
|
610 |
int interno; //0 = interno, 1 = esterno |
|
611 |
map_int_t NH; |
|
612 |
map_float_t loadin; |
|
613 |
float load; |
|
614 |
//Needed for the rt_notify |
|
615 |
struct proto *P; |
|
616 |
struct channel *C; |
|
617 |
net *n; |
|
618 |
rte *rtElem; |
|
619 |
ea_list *ea; |
|
620 |
int primaVolta; |
|
621 |
} RTable; |
|
622 |
|
|
623 |
typedef struct { |
|
624 |
u32 remote_as; |
|
625 |
} remoteAS; |
|
626 |
|
|
627 |
typedef map_t(remoteAS) RemoteAS_map_t; |
|
628 |
|
|
629 |
typedef struct { |
|
630 |
float load; |
|
631 |
int metrica; |
|
632 |
int changed; |
|
633 |
RemoteAS_map_t remoteMap; |
|
634 |
} ASLoad; |
|
635 |
|
|
636 |
//TODO insert this tables in the protocol |
|
637 |
typedef map_t(RTable) RTable_map_t; |
|
638 |
typedef map_t(ASLoad) ASLoad_map_t; |
|
639 |
|
|
640 |
map_int_t ExternalDestinationMap; |
|
641 |
RTable_map_t RTmap; |
|
642 |
ASLoad_map_t ASLoad_map; |
|
643 |
|
|
644 |
//TODO put somewhere else this definition |
|
645 |
RTable initRTableElement(net_addr*, int, int); |
|
646 |
|
|
647 |
//TODO check each single variable if is needed or could be replaced or already taken into account by the protcol, |
|
648 |
// the needed one needs to be inserted into the protocol class |
|
649 |
int withdraw_checker; |
|
650 |
int rilevatoLoop; |
|
651 |
int nhKey; |
|
652 |
int ASRicezione; |
|
653 |
int sonoIlNH; |
|
654 |
int numeroNHarrivati; |
|
655 |
float loadOutRilevato; |
|
656 |
float loadComplessivo; |
|
657 |
char cKey[12]; |
|
658 |
char nhCKey[12]; |
|
659 |
int NhVecchio; |
|
660 |
int esportoDestinazioni; |
|
661 |
char ASLocale[12]; |
|
662 |
float loadOut; |
|
663 |
|
|
664 |
unsigned int total_number_of_update_sent; |
|
665 |
|
|
562 | 666 |
/* Bird's private internal BGP attributes */ |
563 | 667 |
#define BA_MPLS_LABEL_STACK 0xfe /* MPLS label stack transfer attribute */ |
564 | 668 |
|
Also available in: Unified diff