diff options
Diffstat (limited to 'net/tipc/msg.h')
-rw-r--r-- | net/tipc/msg.h | 161 |
1 files changed, 54 insertions, 107 deletions
diff --git a/net/tipc/msg.h b/net/tipc/msg.h index de02339fc175..8452454731fa 100644 --- a/net/tipc/msg.h +++ b/net/tipc/msg.h | |||
@@ -39,41 +39,24 @@ | |||
39 | 39 | ||
40 | #include "bearer.h" | 40 | #include "bearer.h" |
41 | 41 | ||
42 | /* | ||
43 | * Constants and routines used to read and write TIPC payload message headers | ||
44 | * | ||
45 | * Note: Some items are also used with TIPC internal message headers | ||
46 | */ | ||
47 | |||
42 | #define TIPC_VERSION 2 | 48 | #define TIPC_VERSION 2 |
43 | 49 | ||
44 | /* | 50 | /* |
45 | * TIPC user data message header format, version 2: | 51 | * Payload message users are defined in TIPC's public API: |
46 | * | 52 | * - TIPC_LOW_IMPORTANCE |
47 | * | 53 | * - TIPC_MEDIUM_IMPORTANCE |
48 | * 1 0 9 8 7 6 5 4|3 2 1 0 9 8 7 6|5 4 3 2 1 0 9 8|7 6 5 4 3 2 1 0 | 54 | * - TIPC_HIGH_IMPORTANCE |
49 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 55 | * - TIPC_CRITICAL_IMPORTANCE |
50 | * w0:|vers | user |hdr sz |n|d|s|-| message size | | 56 | */ |
51 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 57 | |
52 | * w1:|mstyp| error |rer cnt|lsc|opt p| broadcast ack no | | 58 | /* |
53 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 59 | * Payload message types |
54 | * w2:| link level ack no | broadcast/link level seq no | | ||
55 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
56 | * w3:| previous node | | ||
57 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
58 | * w4:| originating port | | ||
59 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
60 | * w5:| destination port | | ||
61 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
62 | * w6:| originating node | | ||
63 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
64 | * w7:| destination node | | ||
65 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
66 | * w8:| name type / transport sequence number | | ||
67 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
68 | * w9:| name instance/multicast lower bound | | ||
69 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
70 | * wA:| multicast upper bound | | ||
71 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
72 | * / / | ||
73 | * \ options \ | ||
74 | * / / | ||
75 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
76 | * | ||
77 | */ | 60 | */ |
78 | 61 | ||
79 | #define TIPC_CONN_MSG 0 | 62 | #define TIPC_CONN_MSG 0 |
@@ -81,6 +64,9 @@ | |||
81 | #define TIPC_NAMED_MSG 2 | 64 | #define TIPC_NAMED_MSG 2 |
82 | #define TIPC_DIRECT_MSG 3 | 65 | #define TIPC_DIRECT_MSG 3 |
83 | 66 | ||
67 | /* | ||
68 | * Message header sizes | ||
69 | */ | ||
84 | 70 | ||
85 | #define SHORT_H_SIZE 24 /* Connected, in-cluster messages */ | 71 | #define SHORT_H_SIZE 24 /* Connected, in-cluster messages */ |
86 | #define DIR_MSG_H_SIZE 32 /* Directly addressed messages */ | 72 | #define DIR_MSG_H_SIZE 32 /* Directly addressed messages */ |
@@ -473,40 +459,11 @@ static inline struct tipc_msg *msg_get_wrapped(struct tipc_msg *m) | |||
473 | 459 | ||
474 | 460 | ||
475 | /* | 461 | /* |
476 | TIPC internal message header format, version 2 | 462 | * Constants and routines used to read and write TIPC internal message headers |
477 | 463 | */ | |
478 | 1 0 9 8 7 6 5 4|3 2 1 0 9 8 7 6|5 4 3 2 1 0 9 8|7 6 5 4 3 2 1 0 | ||
479 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
480 | w0:|vers |msg usr|hdr sz |n|resrv| packet size | | ||
481 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
482 | w1:|m typ| sequence gap | broadcast ack no | | ||
483 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
484 | w2:| link level ack no/bc_gap_from | seq no / bcast_gap_to | | ||
485 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
486 | w3:| previous node | | ||
487 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
488 | w4:| next sent broadcast/fragm no | next sent pkt/ fragm msg no | | ||
489 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
490 | w5:| session no |rsv=0|r|berid|link prio|netpl|p| | ||
491 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
492 | w6:| originating node | | ||
493 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
494 | w7:| destination node | | ||
495 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
496 | w8:| transport sequence number | | ||
497 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
498 | w9:| msg count / bcast tag | link tolerance | | ||
499 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
500 | \ \ | ||
501 | / User Specific Data / | ||
502 | \ \ | ||
503 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ||
504 | |||
505 | NB: CONN_MANAGER use data message format. LINK_CONFIG has own format. | ||
506 | */ | ||
507 | 464 | ||
508 | /* | 465 | /* |
509 | * Internal users | 466 | * Internal message users |
510 | */ | 467 | */ |
511 | 468 | ||
512 | #define BCAST_PROTOCOL 5 | 469 | #define BCAST_PROTOCOL 5 |
@@ -520,7 +477,7 @@ static inline struct tipc_msg *msg_get_wrapped(struct tipc_msg *m) | |||
520 | #define LINK_CONFIG 13 | 477 | #define LINK_CONFIG 13 |
521 | 478 | ||
522 | /* | 479 | /* |
523 | * Connection management protocol messages | 480 | * Connection management protocol message types |
524 | */ | 481 | */ |
525 | 482 | ||
526 | #define CONN_PROBE 0 | 483 | #define CONN_PROBE 0 |
@@ -528,12 +485,41 @@ static inline struct tipc_msg *msg_get_wrapped(struct tipc_msg *m) | |||
528 | #define CONN_ACK 2 | 485 | #define CONN_ACK 2 |
529 | 486 | ||
530 | /* | 487 | /* |
531 | * Name distributor messages | 488 | * Name distributor message types |
532 | */ | 489 | */ |
533 | 490 | ||
534 | #define PUBLICATION 0 | 491 | #define PUBLICATION 0 |
535 | #define WITHDRAWAL 1 | 492 | #define WITHDRAWAL 1 |
536 | 493 | ||
494 | /* | ||
495 | * Segmentation message types | ||
496 | */ | ||
497 | |||
498 | #define FIRST_FRAGMENT 0 | ||
499 | #define FRAGMENT 1 | ||
500 | #define LAST_FRAGMENT 2 | ||
501 | |||
502 | /* | ||
503 | * Link management protocol message types | ||
504 | */ | ||
505 | |||
506 | #define STATE_MSG 0 | ||
507 | #define RESET_MSG 1 | ||
508 | #define ACTIVATE_MSG 2 | ||
509 | |||
510 | /* | ||
511 | * Changeover tunnel message types | ||
512 | */ | ||
513 | #define DUPLICATE_MSG 0 | ||
514 | #define ORIGINAL_MSG 1 | ||
515 | |||
516 | /* | ||
517 | * Config protocol message types | ||
518 | */ | ||
519 | |||
520 | #define DSC_REQ_MSG 0 | ||
521 | #define DSC_RESP_MSG 1 | ||
522 | |||
537 | 523 | ||
538 | /* | 524 | /* |
539 | * Word 1 | 525 | * Word 1 |
@@ -761,50 +747,11 @@ static inline void msg_set_link_tolerance(struct tipc_msg *m, u32 n) | |||
761 | msg_set_bits(m, 9, 0, 0xffff, n); | 747 | msg_set_bits(m, 9, 0, 0xffff, n); |
762 | } | 748 | } |
763 | 749 | ||
764 | /* | ||
765 | * Segmentation message types | ||
766 | */ | ||
767 | |||
768 | #define FIRST_FRAGMENT 0 | ||
769 | #define FRAGMENT 1 | ||
770 | #define LAST_FRAGMENT 2 | ||
771 | |||
772 | /* | ||
773 | * Link management protocol message types | ||
774 | */ | ||
775 | |||
776 | #define STATE_MSG 0 | ||
777 | #define RESET_MSG 1 | ||
778 | #define ACTIVATE_MSG 2 | ||
779 | |||
780 | /* | ||
781 | * Changeover tunnel message types | ||
782 | */ | ||
783 | #define DUPLICATE_MSG 0 | ||
784 | #define ORIGINAL_MSG 1 | ||
785 | |||
786 | /* | ||
787 | * Routing table message types | ||
788 | */ | ||
789 | #define EXT_ROUTING_TABLE 0 | ||
790 | #define LOCAL_ROUTING_TABLE 1 /* obsoleted */ | ||
791 | #define SLAVE_ROUTING_TABLE 2 | ||
792 | #define ROUTE_ADDITION 3 | ||
793 | #define ROUTE_REMOVAL 4 | ||
794 | |||
795 | /* | ||
796 | * Config protocol message types | ||
797 | */ | ||
798 | |||
799 | #define DSC_REQ_MSG 0 | ||
800 | #define DSC_RESP_MSG 1 | ||
801 | |||
802 | u32 tipc_msg_tot_importance(struct tipc_msg *m); | 750 | u32 tipc_msg_tot_importance(struct tipc_msg *m); |
803 | void tipc_msg_init(struct tipc_msg *m, u32 user, u32 type, | 751 | void tipc_msg_init(struct tipc_msg *m, u32 user, u32 type, |
804 | u32 hsize, u32 destnode); | 752 | u32 hsize, u32 destnode); |
805 | int tipc_msg_calc_data_size(struct iovec const *msg_sect, u32 num_sect); | 753 | int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect, |
806 | int tipc_msg_build(struct tipc_msg *hdr, | 754 | u32 num_sect, unsigned int total_len, |
807 | struct iovec const *msg_sect, u32 num_sect, | ||
808 | int max_size, int usrmem, struct sk_buff **buf); | 755 | int max_size, int usrmem, struct sk_buff **buf); |
809 | 756 | ||
810 | static inline void msg_set_media_addr(struct tipc_msg *m, struct tipc_media_addr *a) | 757 | static inline void msg_set_media_addr(struct tipc_msg *m, struct tipc_media_addr *a) |