MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sctp_generate_cause

Function sctp_generate_cause

freebsd/netinet/sctputil.c:4926–4951  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4924 */
4925
4926struct mbuf *
4927sctp_generate_cause(uint16_t code, char *info)
4928{
4929 struct mbuf *m;
4930 struct sctp_gen_error_cause *cause;
4931 size_t info_len;
4932 uint16_t len;
4933
4934 if ((code == 0) || (info == NULL)) {
4935 return (NULL);
4936 }
4937 info_len = strlen(info);
4938 if (info_len > (SCTP_MAX_CAUSE_LENGTH - sizeof(struct sctp_paramhdr))) {
4939 return (NULL);
4940 }
4941 len = (uint16_t)(sizeof(struct sctp_paramhdr) + info_len);
4942 m = sctp_get_mbuf_for_msg(len, 0, M_NOWAIT, 1, MT_DATA);
4943 if (m != NULL) {
4944 SCTP_BUF_LEN(m) = len;
4945 cause = mtod(m, struct sctp_gen_error_cause *);
4946 cause->code = htons(code);
4947 cause->length = htons(len);
4948 memcpy(cause->info, info, info_len);
4949 }
4950 return (m);
4951}
4952
4953struct mbuf *
4954sctp_generate_no_user_data_cause(uint32_t tsn)

Callers 15

sctp_send_initiate_ackFunction · 0.85
sctp_sendall_iteratorFunction · 0.85
sctp_lower_sosendFunction · 0.85
sctp_handle_initFunction · 0.85
sctp_process_init_ackFunction · 0.85
sctp_handle_init_ackFunction · 0.85
sctp_process_cookie_newFunction · 0.85
sctp_handle_cookie_echoFunction · 0.85
sctp_process_controlFunction · 0.85

Calls 2

sctp_get_mbuf_for_msgFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected