• Home
  • Raw
  • Download

Lines Matching refs:msgb

39 static inline void msgb_init(struct msgbuf *msgb, u8 *ptr, size_t cap)  in msgb_init()  argument
41 msgb->begin = ptr; in msgb_init()
42 msgb->end = ptr + cap; in msgb_init()
43 msgb->ptr = ptr; in msgb_init()
50 static inline size_t msgb_bytes_used(const struct msgbuf *msgb) in msgb_bytes_used() argument
52 return msgb->ptr - msgb->begin; in msgb_bytes_used()
55 static inline void __msgb_push_u8(struct msgbuf *msgb, u8 value) in __msgb_push_u8() argument
57 *msgb->ptr = value; in __msgb_push_u8()
58 msgb->ptr += sizeof(u8); in __msgb_push_u8()
61 static inline void __msgb_push_u16(struct msgbuf *msgb, u16 value) in __msgb_push_u16() argument
63 put_unaligned_le16(value, msgb->ptr); in __msgb_push_u16()
64 msgb->ptr += sizeof(u16); in __msgb_push_u16()
72 static inline void msgb_push_u16(struct msgbuf *msgb, u16 value) in msgb_push_u16() argument
74 if (WARN_ON(msgb->ptr + sizeof(u16) > msgb->end)) in msgb_push_u16()
77 __msgb_push_u16(msgb, value); in msgb_push_u16()
84 static inline void msgb_push_syn(struct msgbuf *msgb) in msgb_push_syn() argument
86 msgb_push_u16(msgb, SSH_MSG_SYN); in msgb_push_syn()
95 static inline void msgb_push_buf(struct msgbuf *msgb, const u8 *buf, size_t len) in msgb_push_buf() argument
97 msgb->ptr = memcpy(msgb->ptr, buf, len) + len; in msgb_push_buf()
106 static inline void msgb_push_crc(struct msgbuf *msgb, const u8 *buf, size_t len) in msgb_push_crc() argument
108 msgb_push_u16(msgb, ssh_crc(buf, len)); in msgb_push_crc()
118 static inline void msgb_push_frame(struct msgbuf *msgb, u8 ty, u16 len, u8 seq) in msgb_push_frame() argument
120 u8 *const begin = msgb->ptr; in msgb_push_frame()
122 if (WARN_ON(msgb->ptr + sizeof(struct ssh_frame) > msgb->end)) in msgb_push_frame()
125 __msgb_push_u8(msgb, ty); /* Frame type. */ in msgb_push_frame()
126 __msgb_push_u16(msgb, len); /* Frame payload length. */ in msgb_push_frame()
127 __msgb_push_u8(msgb, seq); /* Frame sequence ID. */ in msgb_push_frame()
129 msgb_push_crc(msgb, begin, msgb->ptr - begin); in msgb_push_frame()
137 static inline void msgb_push_ack(struct msgbuf *msgb, u8 seq) in msgb_push_ack() argument
140 msgb_push_syn(msgb); in msgb_push_ack()
143 msgb_push_frame(msgb, SSH_FRAME_TYPE_ACK, 0x00, seq); in msgb_push_ack()
146 msgb_push_crc(msgb, msgb->ptr, 0); in msgb_push_ack()
153 static inline void msgb_push_nak(struct msgbuf *msgb) in msgb_push_nak() argument
156 msgb_push_syn(msgb); in msgb_push_nak()
159 msgb_push_frame(msgb, SSH_FRAME_TYPE_NAK, 0x00, 0x00); in msgb_push_nak()
162 msgb_push_crc(msgb, msgb->ptr, 0); in msgb_push_nak()
172 static inline void msgb_push_cmd(struct msgbuf *msgb, u8 seq, u16 rqid, in msgb_push_cmd() argument
179 msgb_push_syn(msgb); in msgb_push_cmd()
182 msgb_push_frame(msgb, type, sizeof(struct ssh_command) + rqst->length, seq); in msgb_push_cmd()
185 if (WARN_ON(msgb->ptr + sizeof(struct ssh_command) > msgb->end)) in msgb_push_cmd()
188 cmd = msgb->ptr; in msgb_push_cmd()
190 __msgb_push_u8(msgb, SSH_PLD_TYPE_CMD); /* Payload type. */ in msgb_push_cmd()
191 __msgb_push_u8(msgb, rqst->target_category); /* Target category. */ in msgb_push_cmd()
192 __msgb_push_u8(msgb, rqst->target_id); /* Target ID (out). */ in msgb_push_cmd()
193 __msgb_push_u8(msgb, 0x00); /* Target ID (in). */ in msgb_push_cmd()
194 __msgb_push_u8(msgb, rqst->instance_id); /* Instance ID. */ in msgb_push_cmd()
195 __msgb_push_u16(msgb, rqid); /* Request ID. */ in msgb_push_cmd()
196 __msgb_push_u8(msgb, rqst->command_id); /* Command ID. */ in msgb_push_cmd()
199 msgb_push_buf(msgb, rqst->payload, rqst->length); in msgb_push_cmd()
202 msgb_push_crc(msgb, cmd, msgb->ptr - cmd); in msgb_push_cmd()