Add a function is decode the sinfo_flags of struct sctp_sndrcvinfo.
This commit is contained in:
parent
5f7b9ff2e3
commit
1e6455d870
@ -21,6 +21,7 @@ MAN= sysdecode.3 \
|
||||
sysdecode_ioctlname.3 \
|
||||
sysdecode_mask.3 \
|
||||
sysdecode_quotactl_cmd.3 \
|
||||
sysdecode_sctp_sinfo_flags.3 \
|
||||
sysdecode_sigcode.3 \
|
||||
sysdecode_sockopt_name.3 \
|
||||
sysdecode_socket_protocol.3 \
|
||||
|
@ -1165,3 +1165,31 @@ sysdecode_sctp_pr_policy(int policy)
|
||||
|
||||
return (lookup_value(sctpprpolicy, policy));
|
||||
}
|
||||
|
||||
static struct name_table sctpsinfoflags[] = {
|
||||
X(SCTP_EOF) X(SCTP_ABORT) X(SCTP_UNORDERED) X(SCTP_ADDR_OVER)
|
||||
X(SCTP_SENDALL) X(SCTP_EOR) X(SCTP_SACK_IMMEDIATELY) XEND
|
||||
};
|
||||
|
||||
void
|
||||
sysdecode_sctp_sinfo_flags(FILE *fp, int sinfo_flags)
|
||||
{
|
||||
const char *temp;
|
||||
int rem;
|
||||
bool printed;
|
||||
|
||||
printed = print_mask_0(fp, sctpsinfoflags, sinfo_flags, &rem);
|
||||
if (rem & ~SCTP_PR_SCTP_ALL) {
|
||||
fprintf(fp, "%s%#x", printed ? "|" : "", rem & ~SCTP_PR_SCTP_ALL);
|
||||
printed = true;
|
||||
rem &= ~SCTP_PR_SCTP_ALL;
|
||||
}
|
||||
if (rem != 0) {
|
||||
temp = sysdecode_sctp_pr_policy(rem);
|
||||
if (temp != NULL) {
|
||||
fprintf(fp, "%s%s", printed ? "|" : "", temp);
|
||||
} else {
|
||||
fprintf(fp, "%s%#x", printed ? "|" : "", rem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd December 16, 2017
|
||||
.Dd January 14, 2018
|
||||
.Dt SYSDECODE 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -79,6 +79,7 @@ A placeholder for use when the ABI is not known.
|
||||
.Xr sysdecode_kevent 3 ,
|
||||
.Xr sysdecode_mask 3 ,
|
||||
.Xr sysdecode_quotactl_cmd 3 ,
|
||||
.Xr sysdecode_sctp_sinfo_flags 3 ,
|
||||
.Xr sysdecode_sigcode 3 ,
|
||||
.Xr sysdecode_socket_protocol 3 ,
|
||||
.Xr sysdecode_sockopt_name 3 ,
|
||||
|
@ -91,6 +91,7 @@ const char *sysdecode_rlimit(int _resource);
|
||||
const char *sysdecode_rtprio_function(int _function);
|
||||
const char *sysdecode_scheduler_policy(int _policy);
|
||||
const char *sysdecode_sctp_pr_policy(int _policy);
|
||||
void sysdecode_sctp_sinfo_flags(FILE *_fp, int _sinfo_flags);
|
||||
const char *sysdecode_semctl_cmd(int _cmd);
|
||||
bool sysdecode_semget_flags(FILE *_fp, int _flag, int *_rem);
|
||||
bool sysdecode_sendfile_flags(FILE *_fp, int _flags, int *_rem);
|
||||
|
@ -54,6 +54,7 @@
|
||||
.Nm sysdecode_rtprio_function ,
|
||||
.Nm sysdecode_scheduler_policy ,
|
||||
.Nm sysdecode_sctp_pr_policy ,
|
||||
.Nm sysdecode_sctp_sinfo_flags ,
|
||||
.Nm sysdecode_semctl_cmd ,
|
||||
.Nm sysdecode_shmctl_cmd ,
|
||||
.Nm sysdecode_shutdown_how ,
|
||||
|
55
lib/libsysdecode/sysdecode_sctp_sinfo_flags.3
Normal file
55
lib/libsysdecode/sysdecode_sctp_sinfo_flags.3
Normal file
@ -0,0 +1,55 @@
|
||||
.\"
|
||||
.\" Copyright (c) 2018 Michael Tuexen <tuexen@FreeBSD.org>
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd January 14, 2018
|
||||
.Dt sysdecode_sctp_sinfo_flags 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm sysdecode_sctp_sinfo_flags
|
||||
.Nd output textual description of the sinfo_flags field of struct sctp_sndrcvinfo
|
||||
.Sh LIBRARY
|
||||
.Lb libsysdecode
|
||||
.Sh SYNOPSIS
|
||||
.In sys/types.h
|
||||
.In stdbool.h
|
||||
.In stdio.h
|
||||
.In sysdecode.h
|
||||
.Ft void
|
||||
.Fn sysdecode_sctp_sinfo_flags "FILE *fp" "int sinfo_flags"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn sysdecode_sctp_sinfo_flags
|
||||
function outputs a textual description of the
|
||||
.Fa sinfo_flags
|
||||
member of a
|
||||
.Vt struct sctp_sndrcvinfo
|
||||
to the stream
|
||||
.Fa fp .
|
||||
In particular, the embedded PR-SCTP policies are handled.
|
||||
.Sh SEE ALSO
|
||||
.Xr sysdecode 3
|
||||
.Xr sysdecode_sctp_pr_policy 3
|
Loading…
Reference in New Issue
Block a user