~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/ceph/msgr.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef CEPH_MSGR_H
  3 #define CEPH_MSGR_H
  4 
  5 /*
  6  * Data types for message passing layer used by Ceph.
  7  */
  8 
  9 #define CEPH_MON_PORT    6789  /* default monitor port */
 10 
 11 /*
 12  * tcp connection banner.  include a protocol version. and adjust
 13  * whenever the wire protocol changes.  try to keep this string length
 14  * constant.
 15  */
 16 #define CEPH_BANNER "ceph v027"
 17 #define CEPH_BANNER_LEN 9
 18 #define CEPH_BANNER_MAX_LEN 30
 19 
 20 
 21 /*
 22  * messenger V2 connection banner prefix.
 23  * The full banner string should have the form: "ceph v2\n<le16>"
 24  * the 2 bytes are the length of the remaining banner.
 25  */
 26 #define CEPH_BANNER_V2 "ceph v2\n"
 27 #define CEPH_BANNER_V2_LEN 8
 28 #define CEPH_BANNER_V2_PREFIX_LEN (CEPH_BANNER_V2_LEN + sizeof(__le16))
 29 
 30 /*
 31  * messenger V2 features
 32  */
 33 #define CEPH_MSGR2_INCARNATION_1 (0ull)
 34 
 35 #define DEFINE_MSGR2_FEATURE(bit, incarnation, name)               \
 36         static const uint64_t __maybe_unused CEPH_MSGR2_FEATURE_##name = (1ULL << bit); \
 37         static const uint64_t __maybe_unused CEPH_MSGR2_FEATUREMASK_##name =            \
 38                         (1ULL << bit | CEPH_MSGR2_INCARNATION_##incarnation);
 39 
 40 #define HAVE_MSGR2_FEATURE(x, name) \
 41         (((x) & (CEPH_MSGR2_FEATUREMASK_##name)) == (CEPH_MSGR2_FEATUREMASK_##name))
 42 
 43 DEFINE_MSGR2_FEATURE( 0, 1, REVISION_1)   // msgr2.1
 44 
 45 #define CEPH_MSGR2_SUPPORTED_FEATURES (CEPH_MSGR2_FEATURE_REVISION_1)
 46 
 47 #define CEPH_MSGR2_REQUIRED_FEATURES  (CEPH_MSGR2_FEATURE_REVISION_1)
 48 
 49 
 50 /*
 51  * Rollover-safe type and comparator for 32-bit sequence numbers.
 52  * Comparator returns -1, 0, or 1.
 53  */
 54 typedef __u32 ceph_seq_t;
 55 
 56 static inline __s32 ceph_seq_cmp(__u32 a, __u32 b)
 57 {
 58        return (__s32)a - (__s32)b;
 59 }
 60 
 61 
 62 /*
 63  * entity_name -- logical name for a process participating in the
 64  * network, e.g. 'mds0' or 'osd3'.
 65  */
 66 struct ceph_entity_name {
 67         __u8 type;      /* CEPH_ENTITY_TYPE_* */
 68         __le64 num;
 69 } __attribute__ ((packed));
 70 
 71 #define CEPH_ENTITY_TYPE_MON    0x01
 72 #define CEPH_ENTITY_TYPE_MDS    0x02
 73 #define CEPH_ENTITY_TYPE_OSD    0x04
 74 #define CEPH_ENTITY_TYPE_CLIENT 0x08
 75 #define CEPH_ENTITY_TYPE_AUTH   0x20
 76 
 77 #define CEPH_ENTITY_TYPE_ANY    0xFF
 78 
 79 extern const char *ceph_entity_type_name(int type);
 80 
 81 /*
 82  * entity_addr -- network address
 83  */
 84 struct ceph_entity_addr {
 85         __le32 type;  /* CEPH_ENTITY_ADDR_TYPE_* */
 86         __le32 nonce;  /* unique id for process (e.g. pid) */
 87         struct sockaddr_storage in_addr;
 88 } __attribute__ ((packed));
 89 
 90 static inline bool ceph_addr_equal_no_type(const struct ceph_entity_addr *lhs,
 91                                            const struct ceph_entity_addr *rhs)
 92 {
 93         return !memcmp(&lhs->in_addr, &rhs->in_addr, sizeof(lhs->in_addr)) &&
 94                lhs->nonce == rhs->nonce;
 95 }
 96 
 97 struct ceph_entity_inst {
 98         struct ceph_entity_name name;
 99         struct ceph_entity_addr addr;
100 } __attribute__ ((packed));
101 
102 
103 /* used by message exchange protocol */
104 #define CEPH_MSGR_TAG_READY         1  /* server->client: ready for messages */
105 #define CEPH_MSGR_TAG_RESETSESSION  2  /* server->client: reset, try again */
106 #define CEPH_MSGR_TAG_WAIT          3  /* server->client: wait for racing
107                                           incoming connection */
108 #define CEPH_MSGR_TAG_RETRY_SESSION 4  /* server->client + cseq: try again
109                                           with higher cseq */
110 #define CEPH_MSGR_TAG_RETRY_GLOBAL  5  /* server->client + gseq: try again
111                                           with higher gseq */
112 #define CEPH_MSGR_TAG_CLOSE         6  /* closing pipe */
113 #define CEPH_MSGR_TAG_MSG           7  /* message */
114 #define CEPH_MSGR_TAG_ACK           8  /* message ack */
115 #define CEPH_MSGR_TAG_KEEPALIVE     9  /* just a keepalive byte! */
116 #define CEPH_MSGR_TAG_BADPROTOVER   10 /* bad protocol version */
117 #define CEPH_MSGR_TAG_BADAUTHORIZER 11 /* bad authorizer */
118 #define CEPH_MSGR_TAG_FEATURES      12 /* insufficient features */
119 #define CEPH_MSGR_TAG_SEQ           13 /* 64-bit int follows with seen seq number */
120 #define CEPH_MSGR_TAG_KEEPALIVE2    14 /* keepalive2 byte + ceph_timespec */
121 #define CEPH_MSGR_TAG_KEEPALIVE2_ACK 15 /* keepalive2 reply */
122 #define CEPH_MSGR_TAG_CHALLENGE_AUTHORIZER 16  /* cephx v2 doing server challenge */
123 
124 /*
125  * connection negotiation
126  */
127 struct ceph_msg_connect {
128         __le64 features;     /* supported feature bits */
129         __le32 host_type;    /* CEPH_ENTITY_TYPE_* */
130         __le32 global_seq;   /* count connections initiated by this host */
131         __le32 connect_seq;  /* count connections initiated in this session */
132         __le32 protocol_version;
133         __le32 authorizer_protocol;
134         __le32 authorizer_len;
135         __u8  flags;         /* CEPH_MSG_CONNECT_* */
136 } __attribute__ ((packed));
137 
138 struct ceph_msg_connect_reply {
139         __u8 tag;
140         __le64 features;     /* feature bits for this session */
141         __le32 global_seq;
142         __le32 connect_seq;
143         __le32 protocol_version;
144         __le32 authorizer_len;
145         __u8 flags;
146 } __attribute__ ((packed));
147 
148 #define CEPH_MSG_CONNECT_LOSSY  1  /* messages i send may be safely dropped */
149 
150 
151 /*
152  * message header
153  */
154 struct ceph_msg_header_old {
155         __le64 seq;       /* message seq# for this session */
156         __le64 tid;       /* transaction id */
157         __le16 type;      /* message type */
158         __le16 priority;  /* priority.  higher value == higher priority */
159         __le16 version;   /* version of message encoding */
160 
161         __le32 front_len; /* bytes in main payload */
162         __le32 middle_len;/* bytes in middle payload */
163         __le32 data_len;  /* bytes of data payload */
164         __le16 data_off;  /* sender: include full offset;
165                              receiver: mask against ~PAGE_MASK */
166 
167         struct ceph_entity_inst src, orig_src;
168         __le32 reserved;
169         __le32 crc;       /* header crc32c */
170 } __attribute__ ((packed));
171 
172 struct ceph_msg_header {
173         __le64 seq;       /* message seq# for this session */
174         __le64 tid;       /* transaction id */
175         __le16 type;      /* message type */
176         __le16 priority;  /* priority.  higher value == higher priority */
177         __le16 version;   /* version of message encoding */
178 
179         __le32 front_len; /* bytes in main payload */
180         __le32 middle_len;/* bytes in middle payload */
181         __le32 data_len;  /* bytes of data payload */
182         __le16 data_off;  /* sender: include full offset;
183                              receiver: mask against ~PAGE_MASK */
184 
185         struct ceph_entity_name src;
186         __le16 compat_version;
187         __le16 reserved;
188         __le32 crc;       /* header crc32c */
189 } __attribute__ ((packed));
190 
191 struct ceph_msg_header2 {
192         __le64 seq;       /* message seq# for this session */
193         __le64 tid;       /* transaction id */
194         __le16 type;      /* message type */
195         __le16 priority;  /* priority.  higher value == higher priority */
196         __le16 version;   /* version of message encoding */
197 
198         __le32 data_pre_padding_len;
199         __le16 data_off;  /* sender: include full offset;
200                              receiver: mask against ~PAGE_MASK */
201 
202         __le64 ack_seq;
203         __u8 flags;
204         /* oldest code we think can decode this.  unknown if zero. */
205         __le16 compat_version;
206         __le16 reserved;
207 } __attribute__ ((packed));
208 
209 #define CEPH_MSG_PRIO_LOW     64
210 #define CEPH_MSG_PRIO_DEFAULT 127
211 #define CEPH_MSG_PRIO_HIGH    196
212 #define CEPH_MSG_PRIO_HIGHEST 255
213 
214 /*
215  * follows data payload
216  */
217 struct ceph_msg_footer_old {
218         __le32 front_crc, middle_crc, data_crc;
219         __u8 flags;
220 } __attribute__ ((packed));
221 
222 struct ceph_msg_footer {
223         __le32 front_crc, middle_crc, data_crc;
224         // sig holds the 64 bits of the digital signature for the message PLR
225         __le64  sig;
226         __u8 flags;
227 } __attribute__ ((packed));
228 
229 #define CEPH_MSG_FOOTER_COMPLETE  (1<<0)   /* msg wasn't aborted */
230 #define CEPH_MSG_FOOTER_NOCRC     (1<<1)   /* no data crc */
231 #define CEPH_MSG_FOOTER_SIGNED    (1<<2)   /* msg was signed */
232 
233 
234 #endif
235 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php