1.蓝牙相关工具和库
This commit is contained in:
parent
c671d5050a
commit
068a8db64b
836
code/application/source/sf_app/tools/blue/bin/autopoint
Executable file
836
code/application/source/sf_app/tools/blue/bin/autopoint
Executable file
|
@ -0,0 +1,836 @@
|
|||
#! /bin/sh
|
||||
#
|
||||
# Copyright (C) 2002-2023 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# This file is meant for authors, maintainers, co-maintainers or installers
|
||||
# of packages which are internationalized with the help of GNU gettext. For
|
||||
# further information how to use it consult the GNU gettext manual.
|
||||
|
||||
progname=$0
|
||||
package=gettext-tools
|
||||
version=0.22
|
||||
archive_version=0.22
|
||||
|
||||
# Set variables
|
||||
# - gettext_datadir directory where the data files are stored.
|
||||
prefix="/home/payton/blue"
|
||||
datarootdir="${prefix}/share"
|
||||
: ${gettext_datadir="${datarootdir}/gettext"}
|
||||
: ${AUTOM4TE=autom4te}
|
||||
|
||||
# func_tmpdir
|
||||
# creates a temporary directory.
|
||||
# Sets variable
|
||||
# - tmp pathname of freshly created temporary directory
|
||||
func_tmpdir ()
|
||||
{
|
||||
# Use the environment variable TMPDIR, falling back to /tmp. This allows
|
||||
# users to specify a different temporary directory, for example, if their
|
||||
# /tmp is filled up or too small.
|
||||
: ${TMPDIR=/tmp}
|
||||
{
|
||||
# Use the mktemp program if available. If not available, hide the error
|
||||
# message.
|
||||
tmp=`(umask 077 && mktemp -d "$TMPDIR/gtXXXXXX") 2>/dev/null` &&
|
||||
test -n "$tmp" && test -d "$tmp"
|
||||
} ||
|
||||
{
|
||||
# Use a simple mkdir command. It is guaranteed to fail if the directory
|
||||
# already exists. $RANDOM is bash specific and expands to empty in shells
|
||||
# other than bash, ksh and zsh. Its use does not increase security;
|
||||
# rather, it minimizes the probability of failure in a very cluttered /tmp
|
||||
# directory.
|
||||
tmp=$TMPDIR/gt$$-$RANDOM
|
||||
(umask 077 && mkdir "$tmp")
|
||||
} ||
|
||||
{
|
||||
echo "$0: cannot create a temporary directory in $TMPDIR" >&2
|
||||
{ (exit 1); exit 1; }
|
||||
}
|
||||
}
|
||||
|
||||
# Support for relocatability.
|
||||
func_find_curr_installdir ()
|
||||
{
|
||||
# Determine curr_installdir, even taking into account symlinks.
|
||||
curr_executable="$0"
|
||||
case "$curr_executable" in
|
||||
*/* | *\\*) ;;
|
||||
*) # Need to look in the PATH.
|
||||
save_IFS="$IFS"; IFS="${PATH_SEPARATOR=':'}"
|
||||
for dir in $PATH; do
|
||||
IFS="$save_IFS"
|
||||
test -z "$dir" && dir=.
|
||||
for exec_ext in ''; do
|
||||
if test -f "$dir/$curr_executable$exec_ext"; then
|
||||
curr_executable="$dir/$curr_executable$exec_ext"
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS="$save_IFS"
|
||||
;;
|
||||
esac
|
||||
# Make absolute.
|
||||
case "$curr_executable" in
|
||||
/* | ?:/* | ?:\\*) ;;
|
||||
*) curr_executable=`pwd`/"$curr_executable" ;;
|
||||
esac
|
||||
# Resolve symlinks.
|
||||
sed_dirname='s,/[^/]*$,,'
|
||||
sed_linkdest='s,^.* -> \(.*\),\1,p'
|
||||
while : ; do
|
||||
lsline=`LC_ALL=C ls -l "$curr_executable"`
|
||||
case "$lsline" in
|
||||
*" -> "*)
|
||||
linkdest=`echo "$lsline" | sed -n -e "$sed_linkdest"`
|
||||
case "$linkdest" in
|
||||
/* | ?:/* | ?:\\*) curr_executable="$linkdest" ;;
|
||||
*) curr_executable=`echo "$curr_executable" | sed -e "$sed_dirname"`/"$linkdest" ;;
|
||||
esac ;;
|
||||
*) break ;;
|
||||
esac
|
||||
done
|
||||
curr_installdir=`echo "$curr_executable" | sed -e 's,/[^/]*$,,'`
|
||||
# Canonicalize.
|
||||
curr_installdir=`cd "$curr_installdir" && pwd`
|
||||
}
|
||||
func_find_prefixes ()
|
||||
{
|
||||
# Compute the original/current installation prefixes by stripping the
|
||||
# trailing directories off the original/current installation directories.
|
||||
orig_installprefix="$orig_installdir"
|
||||
curr_installprefix="$curr_installdir"
|
||||
while true; do
|
||||
orig_last=`echo "$orig_installprefix" | sed -n -e 's,^.*/\([^/]*\)$,\1,p'`
|
||||
curr_last=`echo "$curr_installprefix" | sed -n -e 's,^.*/\([^/]*\)$,\1,p'`
|
||||
if test -z "$orig_last" || test -z "$curr_last"; then
|
||||
break
|
||||
fi
|
||||
if test "$orig_last" != "$curr_last"; then
|
||||
break
|
||||
fi
|
||||
orig_installprefix=`echo "$orig_installprefix" | sed -e 's,/[^/]*$,,'`
|
||||
curr_installprefix=`echo "$curr_installprefix" | sed -e 's,/[^/]*$,,'`
|
||||
done
|
||||
}
|
||||
if test "no" = yes; then
|
||||
exec_prefix="${prefix}"
|
||||
bindir="${exec_prefix}/bin"
|
||||
orig_installdir="$bindir" # see Makefile.am's *_SCRIPTS variables
|
||||
func_find_curr_installdir # determine curr_installdir
|
||||
func_find_prefixes
|
||||
# Relocate the directory variables that we use.
|
||||
gettext_datadir=`echo "$gettext_datadir/" | sed -e "s%^${orig_installprefix}/%${curr_installprefix}/%" | sed -e 's,/$,,'`
|
||||
fi
|
||||
|
||||
# func_trace_autoconf macro configure.ac
|
||||
# traces an Autoconf macro call and outputs the arguments to stdout,
|
||||
# using autom4te.
|
||||
func_trace_autoconf ()
|
||||
{
|
||||
echo '\
|
||||
dnl replace macros which may abort autom4te with a no-op variant
|
||||
m4_pushdef([m4_assert])
|
||||
m4_pushdef([m4_fatal])
|
||||
m4_pushdef([m4_warn])
|
||||
m4_pushdef([m4_errprintn])
|
||||
m4_pushdef([m4_exit])
|
||||
m4_pushdef([m4_include])
|
||||
m4_pushdef([m4_esyscmd])
|
||||
' \
|
||||
| "$AUTOM4TE" --no-cache --language=Autoconf-without-aclocal-m4 \
|
||||
--trace="$1":\$% - "$2" 2>/dev/null
|
||||
}
|
||||
|
||||
# func_trace_sed macro configure.ac
|
||||
# traces an Autoconf macro call and outputs the arguments to stdout,
|
||||
# using sed.
|
||||
func_trace_sed ()
|
||||
{
|
||||
sed_extract_arguments='
|
||||
s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,;
|
||||
/'"$1"'(/ {
|
||||
ta
|
||||
:a
|
||||
s/)/)/
|
||||
tb
|
||||
s/\\$//
|
||||
N
|
||||
ba
|
||||
:b
|
||||
s,^.*'"$1"'([[ ]*\([^]"$`\\)]*\).*$,\1,p
|
||||
}
|
||||
d'
|
||||
sed -e "$sed_extract_arguments" "$2"
|
||||
}
|
||||
|
||||
# func_usage
|
||||
# outputs to stdout the --help usage message.
|
||||
func_usage ()
|
||||
{
|
||||
echo "\
|
||||
Usage: autopoint [OPTION]...
|
||||
|
||||
Copies standard gettext infrastructure files into a source package.
|
||||
|
||||
Options:
|
||||
--help print this help and exit
|
||||
--version print version information and exit
|
||||
-f, --force force overwriting of files that already exist
|
||||
-n, --dry-run print modifications but don't perform them"
|
||||
# echo "\
|
||||
# -V version copy the infrastructure of the specified gettext version
|
||||
# (dangerous)"
|
||||
echo "
|
||||
Report bugs in the bug tracker at <https://savannah.gnu.org/projects/gettext>
|
||||
or by email to <bug-gettext@gnu.org>."
|
||||
}
|
||||
|
||||
# func_version include_config_details
|
||||
# outputs to stdout the --version message.
|
||||
# Inputs:
|
||||
# - include_config_details true or false
|
||||
func_version ()
|
||||
{
|
||||
echo "$progname (GNU $package) $version"
|
||||
if $1; then
|
||||
echo "This binary is configured to use a versions archive in dirxz format."
|
||||
echo
|
||||
fi
|
||||
echo "Copyright (C) 2002-2023 Free Software Foundation, Inc.
|
||||
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law."
|
||||
echo "Written by" "Bruno Haible"
|
||||
}
|
||||
|
||||
# func_fatal_error message
|
||||
# outputs to stderr a fatal error message, and terminates the program.
|
||||
func_fatal_error ()
|
||||
{
|
||||
echo "autopoint: *** $1" 1>&2
|
||||
echo "autopoint: *** Stop." 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Nuisances.
|
||||
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
|
||||
|
||||
# Unset more variables known to interfere with behavior of common tools.
|
||||
CLICOLOR_FORCE= GREP_OPTIONS=
|
||||
unset CLICOLOR_FORCE GREP_OPTIONS
|
||||
|
||||
# Command-line option processing.
|
||||
# Removes the OPTIONS from the arguments. Sets the variables:
|
||||
# - force yes if --force was given, empty otherwise
|
||||
# - ver gettext version if -V was given, empty otherwise
|
||||
# - doit false if --dry-run was given, : otherwise
|
||||
{
|
||||
force=
|
||||
ver=
|
||||
doit=:
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-n | --dry-run | --dry-ru | --dry-r | --dry- | --dry | --dr | --d )
|
||||
shift
|
||||
doit=false ;;
|
||||
-f | --force | --forc | --for | --fo | --f )
|
||||
shift
|
||||
force=yes ;;
|
||||
--help | --hel | --he | --h )
|
||||
func_usage; exit 0 ;;
|
||||
# -V ) # Some people put a space between -V and the version number.
|
||||
# shift
|
||||
# if test $# = 0; then
|
||||
# func_usage 1>&2
|
||||
# exit 1
|
||||
# fi
|
||||
# ver=$1;
|
||||
# shift ;;
|
||||
# -V*) # Some people omit the space between -V and the version number.
|
||||
# ver=`echo "X$1" | sed -e 's/^X-V//'`
|
||||
# shift ;;
|
||||
--version-without-config )
|
||||
# Print version output without build dependent details.
|
||||
func_version false
|
||||
exit 0 ;;
|
||||
--version | --versio | --versi | --vers | --ver | --ve | --v )
|
||||
func_version true
|
||||
exit 0 ;;
|
||||
-- ) # Stop option prcessing
|
||||
shift; break ;;
|
||||
-* )
|
||||
echo "autopoint: unknown option $1" 1>&2
|
||||
echo "Try 'autopoint --help' for more information." 1>&2
|
||||
exit 1 ;;
|
||||
* )
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
# Command-line argument processing.
|
||||
# Analyzes the remaining arguments.
|
||||
{
|
||||
if test $# -gt 0; then
|
||||
func_usage 1>&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
srcdir=`pwd`
|
||||
# The current directory is now $srcdir.
|
||||
|
||||
# Check integrity of package: A configure.in/ac must be present. Sets variable
|
||||
# - configure_in name of configure.in/ac file.
|
||||
if test -f configure.ac; then
|
||||
configure_in=configure.ac
|
||||
else
|
||||
if test -f configure.in; then
|
||||
configure_in=configure.in
|
||||
else
|
||||
# KDE specific convention: configure.in.in
|
||||
if test -f configure.in.in; then
|
||||
configure_in=configure.in.in
|
||||
else
|
||||
func_fatal_error "Missing configure.ac or configure.in, please cd to your package first."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Select the method for Autoconf macro tracing. func_trace_autoconf
|
||||
# is more accurate than func_trace_sed, but it only works with
|
||||
# autoconf >= 2.69.
|
||||
if echo "AC_PREREQ([2.69])" \
|
||||
| "$AUTOM4TE" --no-cache --language=Autoconf-without-aclocal-m4 - 2>&1; then
|
||||
func_trace=func_trace_autoconf
|
||||
else
|
||||
func_trace=func_trace_sed
|
||||
fi
|
||||
|
||||
# func_version_prereq required_version version
|
||||
# compares the required version and the latest archive version.
|
||||
func_version_prereq ()
|
||||
{
|
||||
req="$1"
|
||||
ver="$2"
|
||||
echo "m4_if(m4_version_compare([$ver], [$req]), [-1], [m4_exit([1])])" \
|
||||
| "$AUTOM4TE" --language=M4sugar >/dev/null
|
||||
}
|
||||
|
||||
# If AM_GNU_GETTEXT_REQUIRE_VERSION is used and archive_version is newer than
|
||||
# that, use archive_version.
|
||||
xreq=`func_trace_sed AM_GNU_GETTEXT_REQUIRE_VERSION "$configure_in"`
|
||||
|
||||
# Need to use func_trace_sed instead of $func_trace, since
|
||||
# AM_GNU_GETTEXT_VERSION is not a standard Autoconf trace.
|
||||
xver=`func_trace_sed AM_GNU_GETTEXT_VERSION "$configure_in"`
|
||||
|
||||
# Prefer AM_GNU_GETTEXT_REQUIRE_VERSION over AM_GNU_GETTEXT_VERSION if both are
|
||||
# specified.
|
||||
if test -n "$xreq" && test -n "$xver"; then
|
||||
echo "autopoint: using AM_GNU_GETTEXT_REQUIRE_VERSION instead of AM_GNU_GETTEXT_VERSION"
|
||||
fi
|
||||
|
||||
if test -n "$xreq"; then
|
||||
if func_version_prereq "$xreq" "$archive_version"; then
|
||||
ver="$archive_version"
|
||||
else
|
||||
func_fatal_error "gettext version $xreq or newer is required"
|
||||
fi
|
||||
else
|
||||
if test -z "$xver" && test -f intl/VERSION; then
|
||||
xver=`cat intl/VERSION | LC_ALL=C sed -n -e 's/^.*gettext-\([-+_.0-9A-Za-z]*\).*$/\1/p'`
|
||||
fi
|
||||
|
||||
# Check whether the -V option and the version number in configure.in match.
|
||||
# At least one of the two must be given. If both are given, they must agree.
|
||||
|
||||
if test -n "$xver"; then
|
||||
if test -n "$ver"; then
|
||||
if test "X$ver" != "X$xver"; then
|
||||
func_fatal_error "Version mismatch: specified -V $ver but the package uses gettext version $xver"
|
||||
fi
|
||||
else
|
||||
ver="$xver"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$ver"; then
|
||||
func_fatal_error "Missing version: please specify in $configure_in through a line 'AM_GNU_GETTEXT_VERSION(x.yy.zz)' the gettext version the package is using"
|
||||
fi
|
||||
|
||||
# Check whether the version number is supported.
|
||||
case "$ver" in
|
||||
0.10.35 | 0.10.36 | 0.10.37 | 0.10.38 | 0.10.39 | 0.10.40 | \
|
||||
0.11 | 0.11.1 | 0.11.2 | 0.11.3 | 0.11.4 | 0.11.5 | \
|
||||
0.12 | 0.12.1 | \
|
||||
0.13 | 0.13.1 | \
|
||||
0.14 | 0.14.1 | 0.14.2 | 0.14.3 | 0.14.4 | 0.14.5 | 0.14.6 | \
|
||||
0.15 | \
|
||||
0.16 | 0.16.1 | \
|
||||
0.17 | \
|
||||
0.18 | 0.18.1 | 0.18.2 | 0.18.3 | \
|
||||
0.19 | 0.19.1 | 0.19.2 | 0.19.3 | 0.19.4 | 0.19.5 | 0.19.6 | 0.19.7 | 0.19.8 | \
|
||||
0.20 | 0.20.2 | \
|
||||
0.21 | 0.21.1 | \
|
||||
0.22 )
|
||||
;;
|
||||
*)
|
||||
func_fatal_error "The AM_GNU_GETTEXT_VERSION declaration in your $configure_in
|
||||
file requires the infrastructure from gettext-$ver but this version
|
||||
is older. Please upgrade to gettext-$ver or newer."
|
||||
;;
|
||||
esac
|
||||
|
||||
# Check in which directory config.rpath, mkinstalldirs etc. belong.
|
||||
auxdir=`"$func_trace" AC_CONFIG_AUX_DIR "$configure_in"`
|
||||
if test -n "$auxdir"; then
|
||||
auxdir="$auxdir/"
|
||||
fi
|
||||
|
||||
# Check in which directory the *.m4 macros belong.
|
||||
macrodirs=`"$func_trace" AC_CONFIG_MACRO_DIR_TRACE "$configure_in"`
|
||||
if test -z "$macrodirs"; then
|
||||
macrodirs=`"$func_trace" AC_CONFIG_MACRO_DIR "$configure_in"`
|
||||
fi
|
||||
for arg in $macrodirs; do
|
||||
m4dir="$arg"
|
||||
break
|
||||
done
|
||||
|
||||
if test -z "$m4dir" && test -f Makefile.am; then
|
||||
# A package using automake.
|
||||
# Extract the macro directory name from Makefile.am.
|
||||
aclocal_amflags=`grep '^ACLOCAL_AMFLAGS[ ]*=' Makefile.am | sed -e 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/'`
|
||||
m4dir_is_next=
|
||||
for arg in $aclocal_amflags; do
|
||||
if test -n "$m4dir_is_next"; then
|
||||
m4dir="$arg"
|
||||
break
|
||||
else
|
||||
if test "X$arg" = "X-I"; then
|
||||
m4dir_is_next=yes
|
||||
else
|
||||
m4dir_is_next=
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if test -z "$m4dir"; then
|
||||
m4dir=m4
|
||||
fi
|
||||
|
||||
# Check whether to omit the intl/ directory.
|
||||
omitintl=
|
||||
# Need to use func_trace_sed instead of $func_trace, since
|
||||
# AM_GNU_GETTEXT is not a standard Autoconf trace.
|
||||
xargs=`func_trace_sed AM_GNU_GETTEXT "$configure_in"`
|
||||
save_IFS="$IFS"; IFS=:
|
||||
for arg in $xargs; do
|
||||
if test 'external' = "$arg"; then
|
||||
omitintl=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS="$save_IFS"
|
||||
|
||||
if test -z "$omitintl"; then
|
||||
case "$ver" in
|
||||
0.1[0-9] | 0.1[0-9].* ) ;;
|
||||
*) func_fatal_error "AM_GNU_GETTEXT without 'external' argument is no longer supported in version $ver" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Check in which directory or directories the po/* infrastructure belongs.
|
||||
configfiles=`"$func_trace" AC_CONFIG_FILES "$configure_in"`
|
||||
# PO directories have a Makefile.in generated from Makefile.in.in.
|
||||
# Treat a directory as a PO directory if and only if it has a
|
||||
# POTFILES.in file. This allows packages to have multiple PO
|
||||
# directories under different names or in different locations.
|
||||
sed_remove_Makefile_in='s,/Makefile\.in$,,'
|
||||
podirs=`for f in $configfiles; do case "$f" in */Makefile.in) echo $f;; esac; done | sed -e "$sed_remove_Makefile_in"`
|
||||
if test -z "$podirs"; then
|
||||
# If we cannot get the list of PO directories from configure.ac, assume the
|
||||
# common default.
|
||||
podirs="po"
|
||||
fi
|
||||
|
||||
# Set up a temporary checkout directory.
|
||||
# Set variables
|
||||
# - work_dir directory containing the temporary checkout
|
||||
work_dir=tmpwrk$$
|
||||
mkdir "$work_dir" || {
|
||||
if test -d "$work_dir"; then
|
||||
func_fatal_error "directory $work_dir already exists"
|
||||
else
|
||||
func_fatal_error "cannot create directory $work_dir"
|
||||
fi
|
||||
}
|
||||
|
||||
# We support three archive formats.
|
||||
#
|
||||
# Format | Size (KiB) for gettext-0.17 | Extra tools needed |
|
||||
# -------+-----------------------------+--------------------+
|
||||
# dir | 3000 | -- |
|
||||
# cvs | 356 | cvs |
|
||||
# git | 484 | git |
|
||||
# -------+-----------------------------+--------------------+
|
||||
|
||||
case "dirxz" in
|
||||
dir*)
|
||||
# The archive of different versions is very large (unless xz compression is
|
||||
# used), but using it does not require special tools.
|
||||
case "dirxz" in
|
||||
dirgz) gzip -d -c < "$gettext_datadir/archive.dir.tar.gz" ;;
|
||||
dirbz2) bzip2 -d -c < "$gettext_datadir/archive.dir.tar.bz2" ;;
|
||||
dirxz) xz -d -c < "$gettext_datadir/archive.dir.tar.xz" ;;
|
||||
esac \
|
||||
| (cd "$work_dir" && tar xf - "gettext-$ver")
|
||||
if test `find "$work_dir" -type f -print | wc -l` = 0; then
|
||||
rm -rf "$work_dir"
|
||||
func_fatal_error "infrastructure files for version $ver not found; this is autopoint from GNU $package $version"
|
||||
fi
|
||||
mv "$work_dir/gettext-$ver" "$work_dir/archive"
|
||||
;;
|
||||
|
||||
cvs)
|
||||
# We distributed the many different versions of the files in a CVS
|
||||
# repository. This guaranteed a good compression rate:
|
||||
#
|
||||
# Including version size in KB of
|
||||
# "du autopoint-files/archive"
|
||||
# 0.10.35 240
|
||||
# 0.10.36 428
|
||||
# 0.10.37 436
|
||||
# 0.10.38 488
|
||||
# 0.10.39 500
|
||||
# 0.10.40 528
|
||||
# 0.11 720
|
||||
# 0.11.1 740
|
||||
# 0.11.2 748
|
||||
# 0.11.3 804
|
||||
# 0.11.4 864
|
||||
# 0.11.5 880
|
||||
# 0.12 1032
|
||||
# 0.12.1 1032
|
||||
# 0.13 1220
|
||||
# 0.13.1 1236
|
||||
# 0.14 1296
|
||||
# 0.14.1 1300
|
||||
# 0.14.2 1420
|
||||
# 0.14.3 1428
|
||||
# 0.14.4 1464
|
||||
# 0.14.5 1508
|
||||
# 0.14.6 1580
|
||||
# 0.15 1760
|
||||
# 0.16 1808
|
||||
# 0.16.1 1812
|
||||
# 0.17 2128
|
||||
# 0.18 2656
|
||||
#
|
||||
# The requirement that the user must have the CVS program available is not
|
||||
# a severe restrictions, because most of the people who use autopoint are
|
||||
# users of CVS.
|
||||
#
|
||||
# But the CVS format is now deprecated, because "cvs init" does not work in
|
||||
# all circumstances
|
||||
# (see <https://lists.gnu.org/archive/html/bug-cvs/2010-05/msg00003.html>)
|
||||
# and we are not allowed to distribute the cvs infrastructure files
|
||||
# ourselves
|
||||
# (see <https://lists.gnu.org/archive/html/bug-cvs/2010-06/msg00011.html>).
|
||||
#
|
||||
# Check availability of the CVS program.
|
||||
(cvs -v) >/dev/null 2>/dev/null || func_fatal_error "cvs program not found"
|
||||
|
||||
# Set up a temporary CVS repository.
|
||||
# We need the temporary CVS repository because any checkout needs write
|
||||
# access to the CVSROOT/history file, so it cannot be under $gettext_datadir.
|
||||
# We need the temporary checkout directory because when --force was not
|
||||
# given, we need to compare the existing files with the checked out ones.
|
||||
# Set variables
|
||||
# - cvs_dir directory containing the temporary repository
|
||||
cvs_dir=tmpcvs$$
|
||||
# Use an umask of 077, to avoid attacks that work by overwriting files in
|
||||
# the "$CVSROOT"/CVSROOT directory.
|
||||
(umask 077 && mkdir "$cvs_dir") || {
|
||||
if test -d "$cvs_dir"; then
|
||||
func_fatal_error "directory $cvs_dir already exists"
|
||||
else
|
||||
func_fatal_error "cannot create directory $cvs_dir"
|
||||
fi
|
||||
}
|
||||
CVSROOT="$srcdir/$cvs_dir"
|
||||
unset CVS_CLIENT_LOG
|
||||
unset CVS_CLIENT_PORT
|
||||
unset CVS_IGNORE_REMOTE_ROOT
|
||||
unset CVS_LOCAL_BRANCH_NUM
|
||||
unset CVS_NOBASES
|
||||
unset CVS_PASSFILE
|
||||
unset CVS_PASSWORD
|
||||
unset CVS_PROXY_PORT
|
||||
unset CVS_RCMD_PORT
|
||||
unset CVS_RSH
|
||||
unset CVS_SERVER
|
||||
unset CVS_SERVER_SLEEP
|
||||
CVS_SIGN_COMMITS=
|
||||
export CVS_SIGN_COMMITS
|
||||
unset CVS_SSH
|
||||
unset CVS_VERIFY_CHECKOUTS
|
||||
unset CVS_VERIFY_TEMPLATE
|
||||
unset CVSIGNORE
|
||||
unset CVSREAD
|
||||
unset CVSREADONLYFS
|
||||
unset CVSUMASK
|
||||
unset CVSWRAPPERS
|
||||
|
||||
# Need to pass -d "$CVSROOT", because there may be a CVS directory in the
|
||||
# current directory.
|
||||
cvs -d "$CVSROOT" init
|
||||
gzip -d -c < "$gettext_datadir/archive.cvs.tar.gz" | (cd "$cvs_dir" && tar xf -)
|
||||
|
||||
cd "$work_dir"
|
||||
cvsver=gettext-`echo "$ver" | sed -e 's/\./_/g'`
|
||||
(cvs -d "$CVSROOT" checkout -r"$cvsver" archive > /dev/null) 2>&1 | grep -v '^cvs checkout: Updating'
|
||||
find archive -name CVS -type d -print | xargs rm -rf
|
||||
cd ..
|
||||
rm -rf "$cvs_dir"
|
||||
# Check that really all CVS directories are gone, otherwise we would overwrite
|
||||
# the contents of the user's CVS directories.
|
||||
if test `find $work_dir/archive -name CVS -type d -print | wc -l` != 0; then
|
||||
rm -rf "$work_dir"
|
||||
func_fatal_error "failed to remove all CVS subdirectories"
|
||||
fi
|
||||
if test `find $work_dir/archive -type f -print | wc -l` = 0; then
|
||||
rm -rf "$work_dir"
|
||||
func_fatal_error "infrastructure files for version $ver not found; this is autopoint from GNU $package $version"
|
||||
fi
|
||||
;;
|
||||
|
||||
git)
|
||||
# Check availability of the git program.
|
||||
(git --version) >/dev/null 2>/dev/null || func_fatal_error "git program not found"
|
||||
mkdir "$work_dir/archive"
|
||||
gzip -d -c < "$gettext_datadir/archive.git.tar.gz" | (cd "$work_dir/archive" && tar xf -)
|
||||
(unset GIT_CONFIG
|
||||
unset XDG_CONFIG_HOME
|
||||
unset HOME
|
||||
GIT_CONFIG_NOSYSTEM=1; export GIT_CONFIG_NOSYSTEM
|
||||
cd "$work_dir/archive" && git checkout -q "gettext-$ver"
|
||||
) || {
|
||||
rm -rf "$work_dir"
|
||||
func_fatal_error "infrastructure files for version $ver not found; this is autopoint from GNU $package $version"
|
||||
}
|
||||
(cd "$work_dir/archive" && rm -rf .git .gitignore)
|
||||
;;
|
||||
esac
|
||||
|
||||
# func_destfile file
|
||||
# determines the destination file, relative to the package's top level
|
||||
# directory, for a given file name, relative to archive.
|
||||
# Sets variables
|
||||
# - destfile relative destination file name, or
|
||||
# empty if the file shall be omitted
|
||||
# - sharedowner yes if the file is not only owned by GNU gettext but may
|
||||
# be installed by automake or other tools, otherwise empty
|
||||
# - allpodirs yes if the file is to be installed in every dir in $podirs
|
||||
func_destfile ()
|
||||
{
|
||||
# There are five categories of files:
|
||||
# ABOUT-NLS -> top level directory
|
||||
# config.rpath mkinstalldirs -> $auxdir
|
||||
# m4/* -> $m4dir/
|
||||
# intl/* -> intl/
|
||||
# po/* ->
|
||||
sharedowner=
|
||||
allpodirs=
|
||||
case `echo "$1" | sed -e 's,[^/]*$,,'` in
|
||||
"" )
|
||||
case "$1" in
|
||||
config.rpath ) destfile="$auxdir$1" ;;
|
||||
mkinstalldirs ) destfile="$auxdir$1" sharedowner=yes ;;
|
||||
* ) destfile="$1" ;;
|
||||
esac
|
||||
;;
|
||||
m4/ ) destfile=`echo "$1" | sed -e "s,^m4/,$m4dir/,"` ;;
|
||||
intl/ ) if test -n "$omitintl"; then destfile=""; else destfile="$1"; fi ;;
|
||||
po/ ) destfile=`echo "$1" | sed -e "s,^po/,,"` allpodirs=yes ;;
|
||||
* ) destfile="$1" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# func_compare existingfile gettextfile
|
||||
# compares the existing file and the file from gettext, and decides whether the
|
||||
# existing file should be overwritten with the file from gettext. Returns 0 if
|
||||
# it should be overwritten, or 1 if it should be skipped.
|
||||
sed_extract_serial='s/^#.* serial \([^ ]*\).*/\1/p
|
||||
1q'
|
||||
func_compare ()
|
||||
{
|
||||
if cmp -s "$1" "$2"; then
|
||||
false
|
||||
else
|
||||
case "$2" in
|
||||
*.m4)
|
||||
# For interoperability with gnulib. gnulib often has newer versions of
|
||||
# the *.m4 files than the latest gettext release. Don't overwrite a
|
||||
# newer version from gnulib with an older version from the gettext
|
||||
# release. The version can be retrieved from the first line, which
|
||||
# looks like this: # file.m4 serial NN ...
|
||||
existing_serial=`sed -n -e "$sed_extract_serial" < "$1"`
|
||||
gettext_serial=`sed -n -e "$sed_extract_serial" < "$2"`
|
||||
if test -n "$existing_serial" && test -n "$gettext_serial" \
|
||||
&& test "$existing_serial" -ge "$gettext_serial" 2> /dev/null; then
|
||||
false
|
||||
else
|
||||
true
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
true
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
# If some files have been locally modified and we have not been requested
|
||||
# to overwrite them, then bail out. This is better than leaving a source
|
||||
# package around where half of the files are locally modified and half are
|
||||
# original - too great risk of version mismatch.
|
||||
if test -z "$force"; then
|
||||
mismatch=
|
||||
func_tmpdir
|
||||
mismatchfile="$tmp"/autopoint.diff
|
||||
for file in `find "$work_dir/archive" -type f -print | sed -e "s,^$work_dir/archive/,," | LC_ALL=C sort`; do
|
||||
func_destfile "$file"
|
||||
if test -n "$destfile"; then
|
||||
func_compare_to_destfile ()
|
||||
{
|
||||
finaldestfile="$1"
|
||||
if test -f "$finaldestfile"; then
|
||||
if func_compare "$finaldestfile" "$work_dir/archive/$file"; then
|
||||
if test -n "$sharedowner"; then
|
||||
echo "autopoint: warning: File $finaldestfile has been locally modified." 1>&2
|
||||
else
|
||||
echo "autopoint: File $finaldestfile has been locally modified." 1>&2
|
||||
mismatch=yes
|
||||
diff -c "$work_dir/archive/$file" "$finaldestfile" | sed -e "1s,$work_dir/archive/,," >> "$mismatchfile"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
if test -n "$allpodirs"; then
|
||||
for dir in $podirs; do
|
||||
func_compare_to_destfile "$dir/$destfile"
|
||||
done
|
||||
else
|
||||
func_compare_to_destfile "$destfile"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if test -n "$mismatch"; then
|
||||
rm -rf "$work_dir"
|
||||
func_fatal_error "Some files have been locally modified. Not overwriting them because --force has not been specified. For your convenience, you find the local modifications in the file '$mismatchfile'."
|
||||
fi
|
||||
rm -rf "$tmp"
|
||||
fi
|
||||
|
||||
# func_mkdir_for to
|
||||
# ensures the directory that would the given file exists.
|
||||
# 'to' is a relative pathname, relative to the current directory.
|
||||
func_mkdir_for ()
|
||||
{
|
||||
base=`echo "$1" | sed -e 's,/[^/]*$,,'`
|
||||
if test "X$base" != "X$1" && test -n "$base"; then
|
||||
func_mkdir_for "$base"
|
||||
# Recompute base. It was clobbered by the recursive call.
|
||||
base=`echo "$1" | sed -e 's,/[^/]*$,,'`
|
||||
test -d "$base" || { echo "Creating directory $base"; mkdir "$base"; }
|
||||
fi
|
||||
}
|
||||
|
||||
# func_copy from to
|
||||
# copies a file.
|
||||
# 'from' is a relative pathname, relative to the current directory.
|
||||
# 'to' is a relative pathname, relative to the current directory.
|
||||
func_copy ()
|
||||
{
|
||||
if $doit; then
|
||||
func_mkdir_for "$2"
|
||||
rm -f "$2"
|
||||
echo "Copying file $2"
|
||||
cp "$1" "$2"
|
||||
else
|
||||
echo "Copy file $2"
|
||||
fi
|
||||
}
|
||||
|
||||
# func_backup to
|
||||
# makes a backup of a file that is about to be overwritten or replaced.
|
||||
# 'to' is a relative pathname, relative to the current directory.
|
||||
func_backup ()
|
||||
{
|
||||
if $doit; then
|
||||
if test -f "$1"; then
|
||||
rm -f "$1~"
|
||||
cp -p "$1" "$1~"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Now copy the files.
|
||||
for file in `find "$work_dir/archive" -type f -print | sed -e "s,^$work_dir/archive/,," | LC_ALL=C sort`; do
|
||||
func_destfile "$file"
|
||||
if test -n "$destfile"; then
|
||||
func_copy_to_destfile ()
|
||||
{
|
||||
finaldestfile="$1"
|
||||
mustcopy=
|
||||
if test -f "$finaldestfile"; then
|
||||
if func_compare "$finaldestfile" "$work_dir/archive/$file"; then
|
||||
if test -n "$force"; then
|
||||
# Overwrite locally modified file.
|
||||
mustcopy=yes
|
||||
fi
|
||||
# If --force is not specified, don't overwrite locally modified files
|
||||
# for which GNU gettext is a shared owner.
|
||||
fi
|
||||
else
|
||||
mustcopy=yes
|
||||
fi
|
||||
if test -n "$mustcopy"; then
|
||||
func_backup "$finaldestfile"
|
||||
func_copy "$work_dir/archive/$file" "$finaldestfile"
|
||||
fi
|
||||
}
|
||||
if test -n "$allpodirs"; then
|
||||
for dir in $podirs; do
|
||||
func_copy_to_destfile "$dir/$destfile"
|
||||
done
|
||||
else
|
||||
func_copy_to_destfile "$destfile"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# That's it.
|
||||
rm -rf "$work_dir"
|
||||
exit 0
|
BIN
code/application/source/sf_app/tools/blue/bin/bluemoon
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/bluemoon
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/bluetoothctl
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/bluetoothctl
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/btattach
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/btattach
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/btmon
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/btmon
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/dbus-cleanup-sockets
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/dbus-cleanup-sockets
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/dbus-daemon
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/dbus-daemon
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/dbus-launch
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/dbus-launch
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/dbus-monitor
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/dbus-monitor
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/dbus-run-session
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/dbus-run-session
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/dbus-send
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/dbus-send
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/dbus-test-tool
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/dbus-test-tool
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/dbus-update-activation-environment
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/dbus-update-activation-environment
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/dbus-uuidgen
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/dbus-uuidgen
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/envsubst
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/envsubst
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/gapplication
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/gapplication
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/gdbus
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/gdbus
Executable file
Binary file not shown.
55
code/application/source/sf_app/tools/blue/bin/gdbus-codegen
Executable file
55
code/application/source/sf_app/tools/blue/bin/gdbus-codegen
Executable file
|
@ -0,0 +1,55 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
# GDBus - GLib D-Bus Library
|
||||
#
|
||||
# Copyright (C) 2008-2011 Red Hat, Inc.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General
|
||||
# Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Author: David Zeuthen <davidz@redhat.com>
|
||||
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
srcdir = os.getenv('UNINSTALLED_GLIB_SRCDIR', None)
|
||||
filedir = os.path.dirname(__file__)
|
||||
|
||||
if srcdir is not None:
|
||||
path = os.path.join(srcdir, 'gio', 'gdbus-2.0')
|
||||
elif os.path.basename(filedir) == 'bin':
|
||||
# Make the prefix containing gdbus-codegen 'relocatable' at runtime by
|
||||
# adding /some/prefix/bin/../share/glib-2.0 to the python path
|
||||
path = os.path.join(filedir, '..', 'share', 'glib-2.0')
|
||||
else:
|
||||
# Assume that the modules we need are in the current directory and add the
|
||||
# parent directory to the python path.
|
||||
path = os.path.join(filedir, '..')
|
||||
|
||||
# Canonicalize, then do further testing
|
||||
path = os.path.abspath(path)
|
||||
|
||||
# If the above path detection failed, use the hard-coded datadir. This can
|
||||
# happen when, for instance, bindir and datadir are not in the same prefix or
|
||||
# on Windows where we cannot make any guarantees about the directory structure.
|
||||
#
|
||||
# In these cases our installation cannot be relocatable, but at least we should
|
||||
# be able to find the codegen module.
|
||||
if not os.path.isfile(os.path.join(path, 'codegen', 'codegen_main.py')):
|
||||
path = os.path.join('/home/payton/blue/share', 'glib-2.0')
|
||||
|
||||
sys.path.insert(0, path)
|
||||
from codegen import codegen_main
|
||||
|
||||
sys.exit(codegen_main.codegen_main())
|
BIN
code/application/source/sf_app/tools/blue/bin/gettext
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/gettext
Executable file
Binary file not shown.
135
code/application/source/sf_app/tools/blue/bin/gettext.sh
Executable file
135
code/application/source/sf_app/tools/blue/bin/gettext.sh
Executable file
|
@ -0,0 +1,135 @@
|
|||
#! /bin/sh
|
||||
#
|
||||
# Copyright (C) 2003, 2005-2007, 2011, 2018-2023 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# Find a way to echo strings without interpreting backslash.
|
||||
if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then
|
||||
echo='echo'
|
||||
else
|
||||
if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then
|
||||
echo='printf %s\n'
|
||||
else
|
||||
echo_func () {
|
||||
cat <<EOT
|
||||
$*
|
||||
EOT
|
||||
}
|
||||
echo='echo_func'
|
||||
fi
|
||||
fi
|
||||
|
||||
# This script is primarily a shell function library. In order for
|
||||
# ". gettext.sh" to find it, we install it in $PREFIX/bin (that is usually
|
||||
# contained in $PATH), rather than in some other location such as
|
||||
# $PREFIX/share/sh-scripts or $PREFIX/share/gettext. In order to not violate
|
||||
# the Filesystem Hierarchy Standard when doing so, this script is executable.
|
||||
# Therefore it needs to support the standard --help and --version.
|
||||
if test -z "${ZSH_VERSION+set}"; then
|
||||
# zsh is not POSIX compliant: By default, while ". gettext.sh" is executed,
|
||||
# it sets $0 to "gettext.sh", defeating the purpose of this test. But
|
||||
# fortunately we know that when running under zsh, this script is always
|
||||
# being sourced, not executed, because hardly anyone is crazy enough to
|
||||
# install zsh as /bin/sh.
|
||||
case "$0" in
|
||||
gettext.sh | */gettext.sh | *\\gettext.sh)
|
||||
progname=$0
|
||||
package=gettext-runtime
|
||||
version=0.22
|
||||
# func_usage
|
||||
# outputs to stdout the --help usage message.
|
||||
func_usage ()
|
||||
{
|
||||
echo "GNU gettext shell script function library version $version"
|
||||
echo "Usage: . gettext.sh"
|
||||
}
|
||||
# func_version
|
||||
# outputs to stdout the --version message.
|
||||
func_version ()
|
||||
{
|
||||
echo "$progname (GNU $package) $version"
|
||||
echo "Copyright (C) 2003-2023 Free Software Foundation, Inc.
|
||||
License GPLv2+: GNU GPL version 2 or later <https://gnu.org/licenses/gpl.html>
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law."
|
||||
echo "Written by" "Bruno Haible"
|
||||
}
|
||||
if test $# = 1; then
|
||||
case "$1" in
|
||||
--help | --hel | --he | --h )
|
||||
func_usage; exit 0 ;;
|
||||
--version | --versio | --versi | --vers | --ver | --ve | --v )
|
||||
func_version; exit 0 ;;
|
||||
esac
|
||||
fi
|
||||
func_usage 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# eval_gettext MSGID
|
||||
# looks up the translation of MSGID and substitutes shell variables in the
|
||||
# result.
|
||||
eval_gettext () {
|
||||
gettext "$1" | (export PATH `envsubst --variables "$1"`; envsubst "$1")
|
||||
}
|
||||
|
||||
# eval_ngettext MSGID MSGID-PLURAL COUNT
|
||||
# looks up the translation of MSGID / MSGID-PLURAL for COUNT and substitutes
|
||||
# shell variables in the result.
|
||||
eval_ngettext () {
|
||||
ngettext "$1" "$2" "$3" | (export PATH `envsubst --variables "$1 $2"`; envsubst "$1 $2")
|
||||
}
|
||||
|
||||
# eval_pgettext MSGCTXT MSGID
|
||||
# looks up the translation of MSGID in the context MSGCTXT and substitutes
|
||||
# shell variables in the result.
|
||||
eval_pgettext () {
|
||||
gettext --context="$1" "$2" | (export PATH `envsubst --variables "$2"`; envsubst "$2")
|
||||
}
|
||||
|
||||
# eval_npgettext MSGCTXT MSGID MSGID-PLURAL COUNT
|
||||
# looks up the translation of MSGID / MSGID-PLURAL for COUNT in the context
|
||||
# MSGCTXT and substitutes shell variables in the result.
|
||||
eval_npgettext () {
|
||||
ngettext --context="$1" "$2" "$3" "$4" | (export PATH `envsubst --variables "$2 $3"`; envsubst "$2 $3")
|
||||
}
|
||||
|
||||
# Note: This use of envsubst is much safer than using the shell built-in 'eval'
|
||||
# would be.
|
||||
# 1) The security problem with Chinese translations that happen to use a
|
||||
# character such as \xe0\x60 is avoided.
|
||||
# 2) The security problem with malevolent translators who put in command lists
|
||||
# like "$(...)" or "`...`" is avoided.
|
||||
# 3) The translations can only refer to shell variables that are already
|
||||
# mentioned in MSGID or MSGID-PLURAL.
|
||||
#
|
||||
# Note: "export PATH" above is a dummy; this is for the case when
|
||||
# `envsubst --variables ...` returns nothing.
|
||||
#
|
||||
# Note: In eval_ngettext above, "$1 $2" means a string whose variables set is
|
||||
# the union of the variables set of "$1" and "$2".
|
||||
#
|
||||
# Note: The minimal use of backquote above ensures that trailing newlines are
|
||||
# not dropped, not from the gettext invocation and not from the value of any
|
||||
# shell variable.
|
||||
#
|
||||
# Note: Field splitting on the `envsubst --variables ...` result is desired,
|
||||
# since envsubst outputs the variables, separated by newlines. Pathname
|
||||
# wildcard expansion or tilde expansion has no effect here, since the words
|
||||
# output by "envsubst --variables ..." consist solely of alphanumeric
|
||||
# characters and underscore.
|
1313
code/application/source/sf_app/tools/blue/bin/gettextize
Executable file
1313
code/application/source/sf_app/tools/blue/bin/gettextize
Executable file
File diff suppressed because it is too large
Load Diff
BIN
code/application/source/sf_app/tools/blue/bin/gio
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/gio
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/gio-querymodules
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/gio-querymodules
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/glib-compile-resources
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/glib-compile-resources
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/glib-compile-schemas
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/glib-compile-schemas
Executable file
Binary file not shown.
1080
code/application/source/sf_app/tools/blue/bin/glib-genmarshal
Executable file
1080
code/application/source/sf_app/tools/blue/bin/glib-genmarshal
Executable file
File diff suppressed because it is too large
Load Diff
189
code/application/source/sf_app/tools/blue/bin/glib-gettextize
Executable file
189
code/application/source/sf_app/tools/blue/bin/glib-gettextize
Executable file
|
@ -0,0 +1,189 @@
|
|||
#! /bin/sh
|
||||
#
|
||||
# Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# - Modified in October 2001 by jacob berkman <jacob@ximian.com> to
|
||||
# work with glib's Makefile.in.in and po2tbl.sed.in, to not copy in
|
||||
# intl/, and to not add ChangeLog entries to po/ChangeLog
|
||||
|
||||
# This file is meant for authors or maintainers which want to
|
||||
# internationalize their package with the help of GNU gettext. For
|
||||
# further information how to use it consult the GNU gettext manual.
|
||||
|
||||
echo=echo
|
||||
progname=$0
|
||||
force=0
|
||||
configstatus=0
|
||||
origdir=`pwd`
|
||||
usage="\
|
||||
Usage: glib-gettextize [OPTION]... [package-dir]
|
||||
--help print this help and exit
|
||||
--version print version information and exit
|
||||
-c, --copy copy files instead of making symlinks
|
||||
-f, --force force writing of new files even if old exist
|
||||
Report bugs to https://gitlab.gnome.org/GNOME/glib/issues/new."
|
||||
package=glib
|
||||
version=2.77.3
|
||||
try_ln_s=:
|
||||
|
||||
# Directory where the sources are stored.
|
||||
prefix=/home/payton/blue
|
||||
case `uname` in
|
||||
MINGW32*)
|
||||
prefix="`dirname $0`/.."
|
||||
;;
|
||||
esac
|
||||
|
||||
datarootdir=/home/payton/blue/share
|
||||
datadir=/home/payton/blue/share
|
||||
|
||||
gettext_dir=$datadir/glib-2.0/gettext
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-c | --copy | --c* )
|
||||
shift
|
||||
try_ln_s=false ;;
|
||||
-f | --force | --f* )
|
||||
shift
|
||||
force=1 ;;
|
||||
-r | --run | --r* )
|
||||
shift
|
||||
configstatus=1 ;;
|
||||
--help | --h* )
|
||||
$echo "$usage"; exit 0 ;;
|
||||
--version | --v* )
|
||||
echo "$progname (GNU $package) $version"
|
||||
$echo "Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
$echo "Written by" "Ulrich Drepper"
|
||||
exit 0 ;;
|
||||
-- ) # Stop option processing
|
||||
shift; break ;;
|
||||
-* )
|
||||
$echo "glib-gettextize: unknown option $1"
|
||||
$echo "Try \`glib-gettextize --help' for more information."; exit 1 ;;
|
||||
* )
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test $# -gt 1; then
|
||||
$echo "$usage"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Fill in the command line options value.
|
||||
if test $# -eq 1; then
|
||||
srcdir=$1
|
||||
if cd "$srcdir"; then
|
||||
srcdir=`pwd`
|
||||
else
|
||||
$echo "Cannot change directory to \`$srcdir'"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
srcdir=$origdir
|
||||
fi
|
||||
|
||||
test -f configure.in || test -f configure.ac || {
|
||||
$echo "Missing configure.in or configure.ac, please cd to your package first."
|
||||
exit 1
|
||||
}
|
||||
|
||||
configure_in=NONE
|
||||
if test -f configure.in; then
|
||||
configure_in=configure.in
|
||||
else
|
||||
if test -f configure.ac; then
|
||||
configure_in=configure.ac
|
||||
fi
|
||||
fi
|
||||
# Check in which directory config.rpath, mkinstalldirs etc. belong.
|
||||
auxdir=`cat "$configure_in" | grep '^AC_CONFIG_AUX_DIR' | sed -n -e 's/AC_CONFIG_AUX_DIR(\([^()]*\))/\1/p' | sed -e 's/^\[\(.*\)\]$/\1/' | sed -e 1q`
|
||||
if test -n "$auxdir"; then
|
||||
auxdir="$auxdir/"
|
||||
fi
|
||||
|
||||
if test -f po/Makefile.in.in && test $force -eq 0; then
|
||||
$echo "\
|
||||
po/Makefile.in.in exists: use option -f if you really want to delete it."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
test -d po || {
|
||||
$echo "Creating po/ subdirectory"
|
||||
mkdir po || {
|
||||
$echo "failed to create po/ subdirectory"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
# For simplicity we changed to the gettext source directory.
|
||||
cd $gettext_dir || {
|
||||
$echo "gettext source directory '${gettext_dir}' doesn't exist"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Now copy all files. Take care for the destination directories.
|
||||
for file in *; do
|
||||
case $file in
|
||||
intl | po)
|
||||
;;
|
||||
mkinstalldirs)
|
||||
rm -f "$srcdir/$auxdir$file"
|
||||
($try_ln_s && ln -s $gettext_dir/$file "$srcdir/$auxdir$file" && $echo "Symlinking file $file") 2>/dev/null ||
|
||||
{ $echo "Copying file $file"; cp $file "$srcdir/$auxdir$file"; }
|
||||
;;
|
||||
*)
|
||||
rm -f "$srcdir/$file"
|
||||
($try_ln_s && ln -s $gettext_dir/$file "$srcdir/$file" && $echo "Symlinking file $file") 2>/dev/null ||
|
||||
{ $echo "Copying file $file"; cp $file "$srcdir/$file"; }
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Copy files to po/ subdirectory.
|
||||
cd po
|
||||
for file in *; do
|
||||
rm -f "$srcdir/po/$file"
|
||||
($try_ln_s && ln -s $gettext_dir/po/$file "$srcdir/po/$file" && $echo "Symlinking file po/$file") 2>/dev/null ||
|
||||
{ $echo "Copying file po/$file"; cp $file "$srcdir/po/$file"; }
|
||||
done
|
||||
if test -f "$srcdir/po/cat-id-tbl.c"; then
|
||||
$echo "Removing po/cat-id-tbl.c"
|
||||
rm -f "$srcdir/po/cat-id-tbl.c"
|
||||
fi
|
||||
if test -f "$srcdir/po/stamp-cat-id"; then
|
||||
$echo "Removing po/stamp-cat-id"
|
||||
rm -f "$srcdir/po/stamp-cat-id"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Please add the files"
|
||||
echo " codeset.m4 gettext.m4 glibc21.m4 iconv.m4 isc-posix.m4 lcmessage.m4"
|
||||
echo " progtest.m4"
|
||||
echo "from the $datadir/aclocal directory to your autoconf macro directory"
|
||||
echo "or directly to your aclocal.m4 file."
|
||||
echo "You will also need config.guess and config.sub, which you can get from"
|
||||
echo "ftp://ftp.gnu.org/pub/gnu/config/."
|
||||
echo
|
||||
|
||||
exit 0
|
810
code/application/source/sf_app/tools/blue/bin/glib-mkenums
Executable file
810
code/application/source/sf_app/tools/blue/bin/glib-mkenums
Executable file
|
@ -0,0 +1,810 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
# If the code below looks horrible and unpythonic, do not panic.
|
||||
#
|
||||
# It is.
|
||||
#
|
||||
# This is a manual conversion from the original Perl script to
|
||||
# Python. Improvements are welcome.
|
||||
#
|
||||
from __future__ import print_function, unicode_literals
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import tempfile
|
||||
import io
|
||||
import errno
|
||||
import codecs
|
||||
import locale
|
||||
|
||||
# Non-english locale systems might complain to unrecognized character
|
||||
sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding='utf-8')
|
||||
|
||||
VERSION_STR = '''glib-mkenums version 2.77.3
|
||||
glib-mkenums comes with ABSOLUTELY NO WARRANTY.
|
||||
You may redistribute copies of glib-mkenums under the terms of
|
||||
the GNU General Public License which can be found in the
|
||||
GLib source package. Sources, examples and contact
|
||||
information are available at http://www.gtk.org'''
|
||||
|
||||
# pylint: disable=too-few-public-methods
|
||||
class Color:
|
||||
'''ANSI Terminal colors'''
|
||||
GREEN = '\033[1;32m'
|
||||
BLUE = '\033[1;34m'
|
||||
YELLOW = '\033[1;33m'
|
||||
RED = '\033[1;31m'
|
||||
END = '\033[0m'
|
||||
|
||||
|
||||
def print_color(msg, color=Color.END, prefix='MESSAGE'):
|
||||
'''Print a string with a color prefix'''
|
||||
if os.isatty(sys.stderr.fileno()):
|
||||
real_prefix = '{start}{prefix}{end}'.format(start=color, prefix=prefix, end=Color.END)
|
||||
else:
|
||||
real_prefix = prefix
|
||||
print('{prefix}: {msg}'.format(prefix=real_prefix, msg=msg), file=sys.stderr)
|
||||
|
||||
|
||||
def print_error(msg):
|
||||
'''Print an error, and terminate'''
|
||||
print_color(msg, color=Color.RED, prefix='ERROR')
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def print_warning(msg, fatal=False):
|
||||
'''Print a warning, and optionally terminate'''
|
||||
if fatal:
|
||||
color = Color.RED
|
||||
prefix = 'ERROR'
|
||||
else:
|
||||
color = Color.YELLOW
|
||||
prefix = 'WARNING'
|
||||
print_color(msg, color, prefix)
|
||||
if fatal:
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def print_info(msg):
|
||||
'''Print a message'''
|
||||
print_color(msg, color=Color.GREEN, prefix='INFO')
|
||||
|
||||
|
||||
def get_rspfile_args(rspfile):
|
||||
'''
|
||||
Response files are useful on Windows where there is a command-line character
|
||||
limit of 8191 because when passing sources as arguments to glib-mkenums this
|
||||
limit can be exceeded in large codebases.
|
||||
|
||||
There is no specification for response files and each tool that supports it
|
||||
generally writes them out in slightly different ways, but some sources are:
|
||||
https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-response-files
|
||||
https://docs.microsoft.com/en-us/windows/desktop/midl/the-response-file-command
|
||||
'''
|
||||
import shlex
|
||||
if not os.path.isfile(rspfile):
|
||||
sys.exit('Response file {!r} does not exist'.format(rspfile))
|
||||
try:
|
||||
with open(rspfile, 'r') as f:
|
||||
cmdline = f.read()
|
||||
except OSError as e:
|
||||
sys.exit('Response file {!r} could not be read: {}'
|
||||
.format(rspfile, e.strerror))
|
||||
return shlex.split(cmdline)
|
||||
|
||||
|
||||
def write_output(output):
|
||||
global output_stream
|
||||
print(output, file=output_stream)
|
||||
|
||||
|
||||
# Python 2 defaults to ASCII in case stdout is redirected.
|
||||
# This should make it match Python 3, which uses the locale encoding.
|
||||
if sys.stdout.encoding is None:
|
||||
output_stream = codecs.getwriter(
|
||||
locale.getpreferredencoding())(sys.stdout)
|
||||
else:
|
||||
output_stream = sys.stdout
|
||||
|
||||
|
||||
# Some source files aren't UTF-8 and the old perl version didn't care.
|
||||
# Replace invalid data with a replacement character to keep things working.
|
||||
# https://bugzilla.gnome.org/show_bug.cgi?id=785113#c20
|
||||
def replace_and_warn(err):
|
||||
# 7 characters of context either side of the offending character
|
||||
print_warning('UnicodeWarning: {} at {} ({})'.format(
|
||||
err.reason, err.start,
|
||||
err.object[err.start - 7:err.end + 7]))
|
||||
return ('?', err.end)
|
||||
|
||||
codecs.register_error('replace_and_warn', replace_and_warn)
|
||||
|
||||
|
||||
# glib-mkenums.py
|
||||
# Information about the current enumeration
|
||||
flags = None # Is enumeration a bitmask?
|
||||
option_underscore_name = '' # Overridden underscore variant of the enum name
|
||||
# for example to fix the cases we don't get the
|
||||
# mixed-case -> underscorized transform right.
|
||||
option_lowercase_name = '' # DEPRECATED. A lower case name to use as part
|
||||
# of the *_get_type() function, instead of the
|
||||
# one that we guess. For instance, when an enum
|
||||
# uses abnormal capitalization and we can not
|
||||
# guess where to put the underscores.
|
||||
option_since = '' # User provided version info for the enum.
|
||||
seenbitshift = 0 # Have we seen bitshift operators?
|
||||
seenprivate = False # Have we seen a private option?
|
||||
enum_prefix = None # Prefix for this enumeration
|
||||
enumname = '' # Name for this enumeration
|
||||
enumshort = '' # $enumname without prefix
|
||||
enumname_prefix = '' # prefix of $enumname
|
||||
enumindex = 0 # Global enum counter
|
||||
firstenum = 1 # Is this the first enumeration per file?
|
||||
entries = [] # [ name, val ] for each entry
|
||||
c_namespace = {} # C symbols namespace.
|
||||
|
||||
output = '' # Filename to write result into
|
||||
|
||||
def parse_trigraph(opts):
|
||||
result = {}
|
||||
for opt in re.findall(r'(?:[^\s,"]|"(?:\\.|[^"])*")+', opts):
|
||||
opt = re.sub(r'^\s*', '', opt)
|
||||
opt = re.sub(r'\s*$', '', opt)
|
||||
m = re.search(r'(\w+)(?:=(.+))?', opt)
|
||||
assert m is not None
|
||||
groups = m.groups()
|
||||
key = groups[0]
|
||||
if len(groups) > 1:
|
||||
val = groups[1]
|
||||
else:
|
||||
val = 1
|
||||
result[key] = val.strip('"') if val is not None else None
|
||||
return result
|
||||
|
||||
def parse_entries(file, file_name):
|
||||
global entries, enumindex, enumname, seenbitshift, seenprivate, flags
|
||||
looking_for_name = False
|
||||
|
||||
while True:
|
||||
line = file.readline()
|
||||
if not line:
|
||||
break
|
||||
|
||||
line = line.strip()
|
||||
|
||||
# read lines until we have no open comments
|
||||
while re.search(r'/\*([^*]|\*(?!/))*$', line):
|
||||
line += file.readline()
|
||||
|
||||
# strip comments w/o options
|
||||
line = re.sub(r'''/\*(?!<)
|
||||
([^*]+|\*(?!/))*
|
||||
\*/''', '', line, flags=re.X)
|
||||
|
||||
line = line.rstrip()
|
||||
|
||||
# skip empty lines
|
||||
if len(line.strip()) == 0:
|
||||
continue
|
||||
|
||||
if looking_for_name:
|
||||
m = re.match(r'\s*(\w+)', line)
|
||||
if m:
|
||||
enumname = m.group(1)
|
||||
return True
|
||||
|
||||
# Handle include files
|
||||
m = re.match(r'\#include\s*<([^>]*)>', line)
|
||||
if m:
|
||||
newfilename = os.path.join("..", m.group(1))
|
||||
newfile = io.open(newfilename, encoding="utf-8",
|
||||
errors="replace_and_warn")
|
||||
|
||||
if not parse_entries(newfile, newfilename):
|
||||
return False
|
||||
else:
|
||||
continue
|
||||
|
||||
m = re.match(r'\s*\}\s*(\w+)', line)
|
||||
if m:
|
||||
enumname = m.group(1)
|
||||
enumindex += 1
|
||||
return 1
|
||||
|
||||
m = re.match(r'\s*\}', line)
|
||||
if m:
|
||||
enumindex += 1
|
||||
looking_for_name = True
|
||||
continue
|
||||
|
||||
m = re.match(r'''\s*
|
||||
(\w+)\s* # name
|
||||
(\s+[A-Z]+_(?:AVAILABLE|DEPRECATED)_ENUMERATOR_IN_[0-9_]+(?:_FOR\s*\(\s*\w+\s*\))?\s*)? # availability
|
||||
(?:=( # value
|
||||
\s*\w+\s*\(.*\)\s* # macro with multiple args
|
||||
| # OR
|
||||
(?:[^,/]|/(?!\*))* # anything but a comma or comment
|
||||
))?,?\s*
|
||||
(?:/\*< # options
|
||||
(([^*]|\*(?!/))*)
|
||||
>\s*\*/)?,?
|
||||
\s*$''', line, flags=re.X)
|
||||
if m:
|
||||
groups = m.groups()
|
||||
name = groups[0]
|
||||
availability = None
|
||||
value = None
|
||||
options = None
|
||||
if len(groups) > 1:
|
||||
availability = groups[1]
|
||||
if len(groups) > 2:
|
||||
value = groups[2]
|
||||
if len(groups) > 3:
|
||||
options = groups[3]
|
||||
if flags is None and value is not None and '<<' in value:
|
||||
seenbitshift = 1
|
||||
|
||||
if options is not None:
|
||||
options = parse_trigraph(options)
|
||||
if 'skip' not in options:
|
||||
entries.append((name, value, seenprivate, options.get('nick')))
|
||||
else:
|
||||
entries.append((name, value, seenprivate))
|
||||
else:
|
||||
m = re.match(r'''\s*
|
||||
/\*< (([^*]|\*(?!/))*) >\s*\*/
|
||||
\s*$''', line, flags=re.X)
|
||||
if m:
|
||||
options = m.groups()[0]
|
||||
if options is not None:
|
||||
options = parse_trigraph(options)
|
||||
if 'private' in options:
|
||||
seenprivate = True
|
||||
continue
|
||||
if 'public' in options:
|
||||
seenprivate = False
|
||||
continue
|
||||
if re.match(r's*\#', line):
|
||||
pass
|
||||
else:
|
||||
print_warning('Failed to parse "{}" in {}'.format(line, file_name))
|
||||
return False
|
||||
|
||||
help_epilog = '''Production text substitutions:
|
||||
\u0040EnumName\u0040 PrefixTheXEnum
|
||||
\u0040enum_name\u0040 prefix_the_xenum
|
||||
\u0040ENUMNAME\u0040 PREFIX_THE_XENUM
|
||||
\u0040ENUMSHORT\u0040 THE_XENUM
|
||||
\u0040ENUMPREFIX\u0040 PREFIX
|
||||
\u0040enumsince\u0040 the user-provided since value given
|
||||
\u0040VALUENAME\u0040 PREFIX_THE_XVALUE
|
||||
\u0040valuenick\u0040 the-xvalue
|
||||
\u0040valuenum\u0040 the integer value (limited support, Since: 2.26)
|
||||
\u0040type\u0040 either enum or flags
|
||||
\u0040Type\u0040 either Enum or Flags
|
||||
\u0040TYPE\u0040 either ENUM or FLAGS
|
||||
\u0040filename\u0040 name of current input file
|
||||
\u0040basename\u0040 base name of the current input file (Since: 2.22)
|
||||
'''
|
||||
|
||||
|
||||
# production variables:
|
||||
idprefix = "" # "G", "Gtk", etc
|
||||
symprefix = "" # "g", "gtk", etc, if not just lc($idprefix)
|
||||
fhead = "" # output file header
|
||||
fprod = "" # per input file production
|
||||
ftail = "" # output file trailer
|
||||
eprod = "" # per enum text (produced prior to value itarations)
|
||||
vhead = "" # value header, produced before iterating over enum values
|
||||
vprod = "" # value text, produced for each enum value
|
||||
vtail = "" # value tail, produced after iterating over enum values
|
||||
comment_tmpl = "" # comment template
|
||||
|
||||
def read_template_file(file):
|
||||
global idprefix, symprefix, fhead, fprod, ftail, eprod, vhead, vprod, vtail, comment_tmpl
|
||||
tmpl = {'file-header': fhead,
|
||||
'file-production': fprod,
|
||||
'file-tail': ftail,
|
||||
'enumeration-production': eprod,
|
||||
'value-header': vhead,
|
||||
'value-production': vprod,
|
||||
'value-tail': vtail,
|
||||
'comment': comment_tmpl,
|
||||
}
|
||||
in_ = 'junk'
|
||||
|
||||
ifile = io.open(file, encoding="utf-8", errors="replace_and_warn")
|
||||
for line in ifile:
|
||||
m = re.match(r'\/\*\*\*\s+(BEGIN|END)\s+([\w-]+)\s+\*\*\*\/', line)
|
||||
if m:
|
||||
if in_ == 'junk' and m.group(1) == 'BEGIN' and m.group(2) in tmpl:
|
||||
in_ = m.group(2)
|
||||
continue
|
||||
elif in_ == m.group(2) and m.group(1) == 'END' and m.group(2) in tmpl:
|
||||
in_ = 'junk'
|
||||
continue
|
||||
else:
|
||||
sys.exit("Malformed template file " + file)
|
||||
|
||||
if in_ != 'junk':
|
||||
tmpl[in_] += line
|
||||
|
||||
if in_ != 'junk':
|
||||
sys.exit("Malformed template file " + file)
|
||||
|
||||
fhead = tmpl['file-header']
|
||||
fprod = tmpl['file-production']
|
||||
ftail = tmpl['file-tail']
|
||||
eprod = tmpl['enumeration-production']
|
||||
vhead = tmpl['value-header']
|
||||
vprod = tmpl['value-production']
|
||||
vtail = tmpl['value-tail']
|
||||
comment_tmpl = tmpl['comment']
|
||||
|
||||
parser = argparse.ArgumentParser(epilog=help_epilog,
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
|
||||
parser.add_argument('--identifier-prefix', default='', dest='idprefix',
|
||||
help='Identifier prefix')
|
||||
parser.add_argument('--symbol-prefix', default='', dest='symprefix',
|
||||
help='Symbol prefix')
|
||||
parser.add_argument('--fhead', default=[], dest='fhead', action='append',
|
||||
help='Output file header')
|
||||
parser.add_argument('--ftail', default=[], dest='ftail', action='append',
|
||||
help='Output file footer')
|
||||
parser.add_argument('--fprod', default=[], dest='fprod', action='append',
|
||||
help='Put out TEXT every time a new input file is being processed.')
|
||||
parser.add_argument('--eprod', default=[], dest='eprod', action='append',
|
||||
help='Per enum text, produced prior to value iterations')
|
||||
parser.add_argument('--vhead', default=[], dest='vhead', action='append',
|
||||
help='Value header, produced before iterating over enum values')
|
||||
parser.add_argument('--vprod', default=[], dest='vprod', action='append',
|
||||
help='Value text, produced for each enum value.')
|
||||
parser.add_argument('--vtail', default=[], dest='vtail', action='append',
|
||||
help='Value tail, produced after iterating over enum values')
|
||||
parser.add_argument('--comments', default='', dest='comment_tmpl',
|
||||
help='Comment structure')
|
||||
parser.add_argument('--template', default='', dest='template',
|
||||
help='Template file')
|
||||
parser.add_argument('--output', default=None, dest='output')
|
||||
parser.add_argument('--version', '-v', default=False, action='store_true', dest='version',
|
||||
help='Print version information')
|
||||
parser.add_argument('args', nargs='*',
|
||||
help='One or more input files, or a single argument @rspfile_path '
|
||||
'pointing to a file that contains the actual arguments')
|
||||
|
||||
# Support reading an rspfile of the form @filename which contains the args
|
||||
# to be parsed
|
||||
if len(sys.argv) == 2 and sys.argv[1].startswith('@'):
|
||||
args = get_rspfile_args(sys.argv[1][1:])
|
||||
else:
|
||||
args = sys.argv[1:]
|
||||
|
||||
options = parser.parse_args(args)
|
||||
|
||||
if options.version:
|
||||
print(VERSION_STR)
|
||||
sys.exit(0)
|
||||
|
||||
def unescape_cmdline_args(arg):
|
||||
arg = arg.replace('\\n', '\n')
|
||||
arg = arg.replace('\\r', '\r')
|
||||
return arg.replace('\\t', '\t')
|
||||
|
||||
if options.template != '':
|
||||
read_template_file(options.template)
|
||||
|
||||
idprefix += options.idprefix
|
||||
symprefix += options.symprefix
|
||||
|
||||
# This is a hack to maintain some semblance of backward compatibility with
|
||||
# the old, Perl-based glib-mkenums. The old tool had an implicit ordering
|
||||
# on the arguments and templates; each argument was parsed in order, and
|
||||
# all the strings appended. This allowed developers to write:
|
||||
#
|
||||
# glib-mkenums \
|
||||
# --fhead ... \
|
||||
# --template a-template-file.c.in \
|
||||
# --ftail ...
|
||||
#
|
||||
# And have the fhead be prepended to the file-head stanza in the template,
|
||||
# as well as the ftail be appended to the file-tail stanza in the template.
|
||||
# Short of throwing away ArgumentParser and going over sys.argv[] element
|
||||
# by element, we can simulate that behaviour by ensuring some ordering in
|
||||
# how we build the template strings:
|
||||
#
|
||||
# - the head stanzas are always prepended to the template
|
||||
# - the prod stanzas are always appended to the template
|
||||
# - the tail stanzas are always appended to the template
|
||||
#
|
||||
# Within each instance of the command line argument, we append each value
|
||||
# to the array in the order in which it appears on the command line.
|
||||
fhead = ''.join([unescape_cmdline_args(x) for x in options.fhead]) + fhead
|
||||
vhead = ''.join([unescape_cmdline_args(x) for x in options.vhead]) + vhead
|
||||
|
||||
fprod += ''.join([unescape_cmdline_args(x) for x in options.fprod])
|
||||
eprod += ''.join([unescape_cmdline_args(x) for x in options.eprod])
|
||||
vprod += ''.join([unescape_cmdline_args(x) for x in options.vprod])
|
||||
|
||||
ftail = ftail + ''.join([unescape_cmdline_args(x) for x in options.ftail])
|
||||
vtail = vtail + ''.join([unescape_cmdline_args(x) for x in options.vtail])
|
||||
|
||||
if options.comment_tmpl != '':
|
||||
comment_tmpl = unescape_cmdline_args(options.comment_tmpl)
|
||||
elif comment_tmpl == "":
|
||||
# default to C-style comments
|
||||
comment_tmpl = "/* \u0040comment\u0040 */"
|
||||
|
||||
output = options.output
|
||||
|
||||
if output is not None:
|
||||
(out_dir, out_fn) = os.path.split(options.output)
|
||||
out_suffix = '_' + os.path.splitext(out_fn)[1]
|
||||
if out_dir == '':
|
||||
out_dir = '.'
|
||||
fd, filename = tempfile.mkstemp(dir=out_dir)
|
||||
os.close(fd)
|
||||
tmpfile = io.open(filename, "w", encoding="utf-8")
|
||||
output_stream = tmpfile
|
||||
else:
|
||||
tmpfile = None
|
||||
|
||||
# put auto-generation comment
|
||||
comment = comment_tmpl.replace('\u0040comment\u0040',
|
||||
'This file is generated by glib-mkenums, do '
|
||||
'not modify it. This code is licensed under '
|
||||
'the same license as the containing project. '
|
||||
'Note that it links to GLib, so must comply '
|
||||
'with the LGPL linking clauses.')
|
||||
write_output("\n" + comment + '\n')
|
||||
|
||||
def replace_specials(prod):
|
||||
prod = prod.replace(r'\\a', r'\a')
|
||||
prod = prod.replace(r'\\b', r'\b')
|
||||
prod = prod.replace(r'\\t', r'\t')
|
||||
prod = prod.replace(r'\\n', r'\n')
|
||||
prod = prod.replace(r'\\f', r'\f')
|
||||
prod = prod.replace(r'\\r', r'\r')
|
||||
prod = prod.rstrip()
|
||||
return prod
|
||||
|
||||
|
||||
def warn_if_filename_basename_used(section, prod):
|
||||
for substitution in ('\u0040filename\u0040',
|
||||
'\u0040basename\u0040'):
|
||||
if substitution in prod:
|
||||
print_warning('{} used in {} section.'.format(substitution,
|
||||
section))
|
||||
|
||||
if len(fhead) > 0:
|
||||
prod = fhead
|
||||
warn_if_filename_basename_used('file-header', prod)
|
||||
prod = replace_specials(prod)
|
||||
write_output(prod)
|
||||
|
||||
def process_file(curfilename):
|
||||
global entries, flags, seenbitshift, seenprivate, enum_prefix, c_namespace
|
||||
firstenum = True
|
||||
|
||||
try:
|
||||
curfile = io.open(curfilename, encoding="utf-8",
|
||||
errors="replace_and_warn")
|
||||
except IOError as e:
|
||||
if e.errno == errno.ENOENT:
|
||||
print_warning('No file "{}" found.'.format(curfilename))
|
||||
return
|
||||
raise
|
||||
|
||||
while True:
|
||||
line = curfile.readline()
|
||||
if not line:
|
||||
break
|
||||
|
||||
line = line.strip()
|
||||
|
||||
# read lines until we have no open comments
|
||||
while re.search(r'/\*([^*]|\*(?!/))*$', line):
|
||||
line += curfile.readline()
|
||||
|
||||
# strip comments w/o options
|
||||
line = re.sub(r'''/\*(?!<)
|
||||
([^*]+|\*(?!/))*
|
||||
\*/''', '', line)
|
||||
|
||||
# ignore forward declarations
|
||||
if re.match(r'\s*typedef\s+enum.*;', line):
|
||||
continue
|
||||
|
||||
m = re.match(r'''\s*typedef\s+enum\s*[_A-Za-z]*[_A-Za-z0-9]*\s*
|
||||
({)?\s*
|
||||
(?:/\*<
|
||||
(([^*]|\*(?!/))*)
|
||||
>\s*\*/)?
|
||||
\s*({)?''', line, flags=re.X)
|
||||
if m:
|
||||
groups = m.groups()
|
||||
if len(groups) >= 2 and groups[1] is not None:
|
||||
options = parse_trigraph(groups[1])
|
||||
if 'skip' in options:
|
||||
continue
|
||||
enum_prefix = options.get('prefix', None)
|
||||
flags = options.get('flags', None)
|
||||
if 'flags' in options:
|
||||
if flags is None:
|
||||
flags = 1
|
||||
else:
|
||||
flags = int(flags)
|
||||
option_lowercase_name = options.get('lowercase_name', None)
|
||||
option_underscore_name = options.get('underscore_name', None)
|
||||
option_since = options.get('since', None)
|
||||
else:
|
||||
enum_prefix = None
|
||||
flags = None
|
||||
option_lowercase_name = None
|
||||
option_underscore_name = None
|
||||
option_since = None
|
||||
|
||||
if option_lowercase_name is not None:
|
||||
if option_underscore_name is not None:
|
||||
print_warning("lowercase_name overridden with underscore_name")
|
||||
option_lowercase_name = None
|
||||
else:
|
||||
print_warning("lowercase_name is deprecated, use underscore_name")
|
||||
|
||||
# Didn't have trailing '{' look on next lines
|
||||
if groups[0] is None and (len(groups) < 4 or groups[3] is None):
|
||||
while True:
|
||||
line = curfile.readline()
|
||||
if not line:
|
||||
print_error("Syntax error when looking for opening { in enum")
|
||||
if re.match(r'\s*\{', line):
|
||||
break
|
||||
|
||||
seenbitshift = 0
|
||||
seenprivate = False
|
||||
entries = []
|
||||
|
||||
# Now parse the entries
|
||||
parse_entries(curfile, curfilename)
|
||||
|
||||
# figure out if this was a flags or enums enumeration
|
||||
if flags is None:
|
||||
flags = seenbitshift
|
||||
|
||||
# Autogenerate a prefix
|
||||
if enum_prefix is None:
|
||||
for entry in entries:
|
||||
if not entry[2] and (len(entry) < 4 or entry[3] is None):
|
||||
name = entry[0]
|
||||
if enum_prefix is not None:
|
||||
enum_prefix = os.path.commonprefix([name, enum_prefix])
|
||||
else:
|
||||
enum_prefix = name
|
||||
if enum_prefix is None:
|
||||
enum_prefix = ""
|
||||
else:
|
||||
# Trim so that it ends in an underscore
|
||||
enum_prefix = re.sub(r'_[^_]*$', '_', enum_prefix)
|
||||
else:
|
||||
# canonicalize user defined prefixes
|
||||
enum_prefix = enum_prefix.upper()
|
||||
enum_prefix = enum_prefix.replace('-', '_')
|
||||
enum_prefix = re.sub(r'(.*)([^_])$', r'\1\2_', enum_prefix)
|
||||
|
||||
fixed_entries = []
|
||||
for e in entries:
|
||||
name = e[0]
|
||||
num = e[1]
|
||||
private = e[2]
|
||||
if len(e) < 4 or e[3] is None:
|
||||
nick = re.sub(r'^' + enum_prefix, '', name)
|
||||
nick = nick.replace('_', '-').lower()
|
||||
e = (name, num, private, nick)
|
||||
fixed_entries.append(e)
|
||||
entries = fixed_entries
|
||||
|
||||
# Spit out the output
|
||||
if option_underscore_name is not None:
|
||||
enumlong = option_underscore_name.upper()
|
||||
enumsym = option_underscore_name.lower()
|
||||
enumshort = re.sub(r'^[A-Z][A-Z0-9]*_', '', enumlong)
|
||||
|
||||
enumname_prefix = re.sub('_' + enumshort + '$', '', enumlong)
|
||||
elif symprefix == '' and idprefix == '':
|
||||
# enumname is e.g. GMatchType
|
||||
enspace = re.sub(r'^([A-Z][a-z]*).*$', r'\1', enumname)
|
||||
|
||||
enumshort = re.sub(r'^[A-Z][a-z]*', '', enumname)
|
||||
enumshort = re.sub(r'([^A-Z])([A-Z])', r'\1_\2', enumshort)
|
||||
enumshort = re.sub(r'([A-Z][A-Z])([A-Z][0-9a-z])', r'\1_\2', enumshort)
|
||||
enumshort = enumshort.upper()
|
||||
|
||||
enumname_prefix = re.sub(r'^([A-Z][a-z]*).*$', r'\1', enumname).upper()
|
||||
|
||||
enumlong = enspace.upper() + "_" + enumshort
|
||||
enumsym = enspace.lower() + "_" + enumshort.lower()
|
||||
|
||||
if option_lowercase_name is not None:
|
||||
enumsym = option_lowercase_name
|
||||
else:
|
||||
enumshort = enumname
|
||||
if idprefix:
|
||||
enumshort = re.sub(r'^' + idprefix, '', enumshort)
|
||||
else:
|
||||
enumshort = re.sub(r'/^[A-Z][a-z]*', '', enumshort)
|
||||
|
||||
enumshort = re.sub(r'([^A-Z])([A-Z])', r'\1_\2', enumshort)
|
||||
enumshort = re.sub(r'([A-Z][A-Z])([A-Z][0-9a-z])', r'\1_\2', enumshort)
|
||||
enumshort = enumshort.upper()
|
||||
|
||||
if symprefix:
|
||||
enumname_prefix = symprefix.upper()
|
||||
else:
|
||||
enumname_prefix = idprefix.upper()
|
||||
|
||||
enumlong = enumname_prefix + "_" + enumshort
|
||||
enumsym = enumlong.lower()
|
||||
|
||||
if option_since is not None:
|
||||
enumsince = option_since
|
||||
else:
|
||||
enumsince = ""
|
||||
|
||||
if firstenum:
|
||||
firstenum = False
|
||||
|
||||
if len(fprod) > 0:
|
||||
prod = fprod
|
||||
base = os.path.basename(curfilename)
|
||||
|
||||
prod = prod.replace('\u0040filename\u0040', curfilename)
|
||||
prod = prod.replace('\u0040basename\u0040', base)
|
||||
prod = replace_specials(prod)
|
||||
|
||||
write_output(prod)
|
||||
|
||||
if len(eprod) > 0:
|
||||
prod = eprod
|
||||
|
||||
prod = prod.replace('\u0040enum_name\u0040', enumsym)
|
||||
prod = prod.replace('\u0040EnumName\u0040', enumname)
|
||||
prod = prod.replace('\u0040ENUMSHORT\u0040', enumshort)
|
||||
prod = prod.replace('\u0040ENUMNAME\u0040', enumlong)
|
||||
prod = prod.replace('\u0040ENUMPREFIX\u0040', enumname_prefix)
|
||||
prod = prod.replace('\u0040enumsince\u0040', enumsince)
|
||||
if flags:
|
||||
prod = prod.replace('\u0040type\u0040', 'flags')
|
||||
else:
|
||||
prod = prod.replace('\u0040type\u0040', 'enum')
|
||||
if flags:
|
||||
prod = prod.replace('\u0040Type\u0040', 'Flags')
|
||||
else:
|
||||
prod = prod.replace('\u0040Type\u0040', 'Enum')
|
||||
if flags:
|
||||
prod = prod.replace('\u0040TYPE\u0040', 'FLAGS')
|
||||
else:
|
||||
prod = prod.replace('\u0040TYPE\u0040', 'ENUM')
|
||||
prod = replace_specials(prod)
|
||||
write_output(prod)
|
||||
|
||||
if len(vhead) > 0:
|
||||
prod = vhead
|
||||
prod = prod.replace('\u0040enum_name\u0040', enumsym)
|
||||
prod = prod.replace('\u0040EnumName\u0040', enumname)
|
||||
prod = prod.replace('\u0040ENUMSHORT\u0040', enumshort)
|
||||
prod = prod.replace('\u0040ENUMNAME\u0040', enumlong)
|
||||
prod = prod.replace('\u0040ENUMPREFIX\u0040', enumname_prefix)
|
||||
prod = prod.replace('\u0040enumsince\u0040', enumsince)
|
||||
if flags:
|
||||
prod = prod.replace('\u0040type\u0040', 'flags')
|
||||
else:
|
||||
prod = prod.replace('\u0040type\u0040', 'enum')
|
||||
if flags:
|
||||
prod = prod.replace('\u0040Type\u0040', 'Flags')
|
||||
else:
|
||||
prod = prod.replace('\u0040Type\u0040', 'Enum')
|
||||
if flags:
|
||||
prod = prod.replace('\u0040TYPE\u0040', 'FLAGS')
|
||||
else:
|
||||
prod = prod.replace('\u0040TYPE\u0040', 'ENUM')
|
||||
prod = replace_specials(prod)
|
||||
write_output(prod)
|
||||
|
||||
if len(vprod) > 0:
|
||||
prod = vprod
|
||||
next_num = 0
|
||||
|
||||
prod = replace_specials(prod)
|
||||
for name, num, private, nick in entries:
|
||||
tmp_prod = prod
|
||||
|
||||
if '\u0040valuenum\u0040' in prod:
|
||||
# only attempt to eval the value if it is requested
|
||||
# this prevents us from throwing errors otherwise
|
||||
if num is not None:
|
||||
# use sandboxed evaluation as a reasonable
|
||||
# approximation to C constant folding
|
||||
inum = eval(num, {}, c_namespace)
|
||||
|
||||
# make sure it parsed to an integer
|
||||
if not isinstance(inum, int):
|
||||
sys.exit("Unable to parse enum value '%s'" % num)
|
||||
num = inum
|
||||
else:
|
||||
num = next_num
|
||||
|
||||
c_namespace[name] = num
|
||||
tmp_prod = tmp_prod.replace('\u0040valuenum\u0040', str(num))
|
||||
next_num = int(num) + 1
|
||||
|
||||
if private:
|
||||
continue
|
||||
|
||||
tmp_prod = tmp_prod.replace('\u0040VALUENAME\u0040', name)
|
||||
tmp_prod = tmp_prod.replace('\u0040valuenick\u0040', nick)
|
||||
if flags:
|
||||
tmp_prod = tmp_prod.replace('\u0040type\u0040', 'flags')
|
||||
else:
|
||||
tmp_prod = tmp_prod.replace('\u0040type\u0040', 'enum')
|
||||
if flags:
|
||||
tmp_prod = tmp_prod.replace('\u0040Type\u0040', 'Flags')
|
||||
else:
|
||||
tmp_prod = tmp_prod.replace('\u0040Type\u0040', 'Enum')
|
||||
if flags:
|
||||
tmp_prod = tmp_prod.replace('\u0040TYPE\u0040', 'FLAGS')
|
||||
else:
|
||||
tmp_prod = tmp_prod.replace('\u0040TYPE\u0040', 'ENUM')
|
||||
tmp_prod = tmp_prod.rstrip()
|
||||
|
||||
write_output(tmp_prod)
|
||||
|
||||
if len(vtail) > 0:
|
||||
prod = vtail
|
||||
prod = prod.replace('\u0040enum_name\u0040', enumsym)
|
||||
prod = prod.replace('\u0040EnumName\u0040', enumname)
|
||||
prod = prod.replace('\u0040ENUMSHORT\u0040', enumshort)
|
||||
prod = prod.replace('\u0040ENUMNAME\u0040', enumlong)
|
||||
prod = prod.replace('\u0040ENUMPREFIX\u0040', enumname_prefix)
|
||||
prod = prod.replace('\u0040enumsince\u0040', enumsince)
|
||||
if flags:
|
||||
prod = prod.replace('\u0040type\u0040', 'flags')
|
||||
else:
|
||||
prod = prod.replace('\u0040type\u0040', 'enum')
|
||||
if flags:
|
||||
prod = prod.replace('\u0040Type\u0040', 'Flags')
|
||||
else:
|
||||
prod = prod.replace('\u0040Type\u0040', 'Enum')
|
||||
if flags:
|
||||
prod = prod.replace('\u0040TYPE\u0040', 'FLAGS')
|
||||
else:
|
||||
prod = prod.replace('\u0040TYPE\u0040', 'ENUM')
|
||||
prod = replace_specials(prod)
|
||||
write_output(prod)
|
||||
|
||||
for fname in sorted(options.args):
|
||||
process_file(fname)
|
||||
|
||||
if len(ftail) > 0:
|
||||
prod = ftail
|
||||
warn_if_filename_basename_used('file-tail', prod)
|
||||
prod = replace_specials(prod)
|
||||
write_output(prod)
|
||||
|
||||
# put auto-generation comment
|
||||
comment = comment_tmpl
|
||||
comment = comment.replace('\u0040comment\u0040', 'Generated data ends here')
|
||||
write_output("\n" + comment + "\n")
|
||||
|
||||
if tmpfile is not None:
|
||||
tmpfilename = tmpfile.name
|
||||
tmpfile.close()
|
||||
|
||||
try:
|
||||
os.unlink(options.output)
|
||||
except OSError as error:
|
||||
if error.errno != errno.ENOENT:
|
||||
raise error
|
||||
|
||||
os.rename(tmpfilename, options.output)
|
BIN
code/application/source/sf_app/tools/blue/bin/gobject-query
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/gobject-query
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/gresource
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/gresource
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/gsettings
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/gsettings
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/gtester
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/gtester
Executable file
Binary file not shown.
498
code/application/source/sf_app/tools/blue/bin/gtester-report
Executable file
498
code/application/source/sf_app/tools/blue/bin/gtester-report
Executable file
|
@ -0,0 +1,498 @@
|
|||
#! /usr/bin/env python3
|
||||
# GLib Testing Framework Utility -*- Mode: python; -*-
|
||||
# Copyright (C) 2007 Imendio AB
|
||||
# Authors: Tim Janik
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Deprecated: Since GLib 2.62, gtester and gtester-report have been deprecated
|
||||
# in favour of TAP.
|
||||
|
||||
import datetime
|
||||
import optparse
|
||||
import sys, re, xml.dom.minidom
|
||||
|
||||
try:
|
||||
import subunit
|
||||
from subunit import iso8601
|
||||
from testtools.content import Content, ContentType
|
||||
mime_utf8 = ContentType('text', 'plain', {'charset': 'utf8'})
|
||||
except ImportError:
|
||||
subunit = None
|
||||
|
||||
|
||||
# xml utilities
|
||||
def find_child (node, child_name):
|
||||
for child in node.childNodes:
|
||||
if child.nodeName == child_name:
|
||||
return child
|
||||
return None
|
||||
def list_children (node, child_name):
|
||||
rlist = []
|
||||
for child in node.childNodes:
|
||||
if child.nodeName == child_name:
|
||||
rlist += [ child ]
|
||||
return rlist
|
||||
def find_node (node, name = None):
|
||||
if not node or node.nodeName == name or not name:
|
||||
return node
|
||||
for child in node.childNodes:
|
||||
c = find_node (child, name)
|
||||
if c:
|
||||
return c
|
||||
return None
|
||||
def node_as_text (node, name = None):
|
||||
if name:
|
||||
node = find_node (node, name)
|
||||
txt = ''
|
||||
if node:
|
||||
if node.nodeValue:
|
||||
txt += node.nodeValue
|
||||
for child in node.childNodes:
|
||||
txt += node_as_text (child)
|
||||
return txt
|
||||
def attribute_as_text (node, aname, node_name = None):
|
||||
node = find_node (node, node_name)
|
||||
if not node:
|
||||
return ''
|
||||
attr = node.attributes.get (aname, '')
|
||||
if hasattr (attr, 'value'):
|
||||
return attr.value
|
||||
return ''
|
||||
|
||||
# HTML utilities
|
||||
def html_indent_string (n):
|
||||
uncollapsible_space = ' ' # HTML won't compress alternating sequences of ' ' and ' '
|
||||
string = ''
|
||||
for i in range (0, int((n + 1) / 2)):
|
||||
string += uncollapsible_space
|
||||
return string
|
||||
|
||||
# TestBinary object, instantiated per test binary in the log file
|
||||
class TestBinary:
|
||||
def __init__ (self, name):
|
||||
self.name = name
|
||||
self.testcases = []
|
||||
self.duration = 0
|
||||
self.success_cases = 0
|
||||
self.skipped_cases = 0
|
||||
self.file = '???'
|
||||
self.random_seed = ''
|
||||
|
||||
# base class to handle processing/traversion of XML nodes
|
||||
class TreeProcess:
|
||||
def __init__ (self):
|
||||
self.nest_level = 0
|
||||
def trampoline (self, node):
|
||||
name = node.nodeName
|
||||
if name == '#text':
|
||||
self.handle_text (node)
|
||||
else:
|
||||
try: method = getattr (self, 'handle_' + re.sub ('[^a-zA-Z0-9]', '_', name))
|
||||
except: method = None
|
||||
if method:
|
||||
return method (node)
|
||||
else:
|
||||
return self.process_recursive (name, node)
|
||||
def process_recursive (self, node_name, node):
|
||||
self.process_children (node)
|
||||
def process_children (self, node):
|
||||
self.nest_level += 1
|
||||
for child in node.childNodes:
|
||||
self.trampoline (child)
|
||||
self.nest_level += 1
|
||||
|
||||
# test report reader, this class collects some statistics and merges duplicate test binary runs
|
||||
class ReportReader (TreeProcess):
|
||||
def __init__ (self):
|
||||
TreeProcess.__init__ (self)
|
||||
self.binary_names = []
|
||||
self.binaries = {}
|
||||
self.last_binary = None
|
||||
self.info = {}
|
||||
def binary_list (self):
|
||||
lst = []
|
||||
for name in self.binary_names:
|
||||
lst += [ self.binaries[name] ]
|
||||
return lst
|
||||
def get_info (self):
|
||||
return self.info
|
||||
def handle_info (self, node):
|
||||
dn = find_child (node, 'package')
|
||||
self.info['package'] = node_as_text (dn)
|
||||
dn = find_child (node, 'version')
|
||||
self.info['version'] = node_as_text (dn)
|
||||
dn = find_child (node, 'revision')
|
||||
if dn is not None:
|
||||
self.info['revision'] = node_as_text (dn)
|
||||
def handle_testcase (self, node):
|
||||
self.last_binary.testcases += [ node ]
|
||||
result = attribute_as_text (node, 'result', 'status')
|
||||
if result == 'success':
|
||||
self.last_binary.success_cases += 1
|
||||
if bool (int (attribute_as_text (node, 'skipped') + '0')):
|
||||
self.last_binary.skipped_cases += 1
|
||||
def handle_text (self, node):
|
||||
pass
|
||||
def handle_testbinary (self, node):
|
||||
path = node.attributes.get ('path', None).value
|
||||
if self.binaries.get (path, -1) == -1:
|
||||
self.binaries[path] = TestBinary (path)
|
||||
self.binary_names += [ path ]
|
||||
self.last_binary = self.binaries[path]
|
||||
dn = find_child (node, 'duration')
|
||||
dur = node_as_text (dn)
|
||||
try: dur = float (dur)
|
||||
except: dur = 0
|
||||
if dur:
|
||||
self.last_binary.duration += dur
|
||||
bin = find_child (node, 'binary')
|
||||
if bin:
|
||||
self.last_binary.file = attribute_as_text (bin, 'file')
|
||||
rseed = find_child (node, 'random-seed')
|
||||
if rseed:
|
||||
self.last_binary.random_seed = node_as_text (rseed)
|
||||
self.process_children (node)
|
||||
|
||||
|
||||
class ReportWriter(object):
|
||||
"""Base class for reporting."""
|
||||
|
||||
def __init__(self, binary_list):
|
||||
self.binaries = binary_list
|
||||
|
||||
def _error_text(self, node):
|
||||
"""Get a string representing the error children of node."""
|
||||
rlist = list_children(node, 'error')
|
||||
txt = ''
|
||||
for enode in rlist:
|
||||
txt += node_as_text (enode)
|
||||
if txt and txt[-1] != '\n':
|
||||
txt += '\n'
|
||||
return txt
|
||||
|
||||
|
||||
class HTMLReportWriter(ReportWriter):
|
||||
# Javascript/CSS snippet to toggle element visibility
|
||||
cssjs = r'''
|
||||
<style type="text/css" media="screen">
|
||||
.VisibleSection { }
|
||||
.HiddenSection { display: none; }
|
||||
</style>
|
||||
<script language="javascript" type="text/javascript"><!--
|
||||
function toggle_display (parentid, tagtype, idmatch, keymatch) {
|
||||
ptag = document.getElementById (parentid);
|
||||
tags = ptag.getElementsByTagName (tagtype);
|
||||
for (var i = 0; i < tags.length; i++) {
|
||||
tag = tags[i];
|
||||
var key = tag.getAttribute ("keywords");
|
||||
if (tag.id.indexOf (idmatch) == 0 && key && key.match (keymatch)) {
|
||||
if (tag.className.indexOf ("HiddenSection") >= 0)
|
||||
tag.className = "VisibleSection";
|
||||
else
|
||||
tag.className = "HiddenSection";
|
||||
}
|
||||
}
|
||||
}
|
||||
message_array = Array();
|
||||
function view_testlog (wname, file, random_seed, tcase, msgtitle, msgid) {
|
||||
txt = message_array[msgid];
|
||||
var w = window.open ("", // URI
|
||||
wname,
|
||||
"resizable,scrollbars,status,width=790,height=400");
|
||||
var doc = w.document;
|
||||
doc.write ("<h2>File: " + file + "</h2>\n");
|
||||
doc.write ("<h3>Case: " + tcase + "</h3>\n");
|
||||
doc.write ("<strong>Random Seed:</strong> <code>" + random_seed + "</code> <br /><br />\n");
|
||||
doc.write ("<strong>" + msgtitle + "</strong><br />\n");
|
||||
doc.write ("<pre>");
|
||||
doc.write (txt);
|
||||
doc.write ("</pre>\n");
|
||||
doc.write ("<a href=\'javascript:window.close()\'>Close Window</a>\n");
|
||||
doc.close();
|
||||
}
|
||||
--></script>
|
||||
'''
|
||||
def __init__ (self, info, binary_list):
|
||||
ReportWriter.__init__(self, binary_list)
|
||||
self.info = info
|
||||
self.bcounter = 0
|
||||
self.tcounter = 0
|
||||
self.total_tcounter = 0
|
||||
self.total_fcounter = 0
|
||||
self.total_duration = 0
|
||||
self.indent_depth = 0
|
||||
self.lastchar = ''
|
||||
def oprint (self, message):
|
||||
sys.stdout.write (message)
|
||||
if message:
|
||||
self.lastchar = message[-1]
|
||||
def handle_info (self):
|
||||
if 'package' in self.info and 'version' in self.info:
|
||||
self.oprint ('<h3>Package: %(package)s, version: %(version)s</h3>\n' % self.info)
|
||||
if 'revision' in self.info:
|
||||
self.oprint ('<h5>Report generated from: %(revision)s</h5>\n' % self.info)
|
||||
def handle_text (self, node):
|
||||
self.oprint (node.nodeValue)
|
||||
def handle_testcase (self, node, binary):
|
||||
skipped = bool (int (attribute_as_text (node, 'skipped') + '0'))
|
||||
if skipped:
|
||||
return # skipped tests are uninteresting for HTML reports
|
||||
path = attribute_as_text (node, 'path')
|
||||
duration = node_as_text (node, 'duration')
|
||||
result = attribute_as_text (node, 'result', 'status')
|
||||
rcolor = {
|
||||
'success': 'bgcolor="lightgreen"',
|
||||
'failed': 'bgcolor="red"',
|
||||
}.get (result, '')
|
||||
if result != 'success':
|
||||
duration = '-' # ignore bogus durations
|
||||
self.oprint ('<tr id="b%u_t%u_" keywords="%s all" class="HiddenSection">\n' % (self.bcounter, self.tcounter, result))
|
||||
self.oprint ('<td>%s %s</td> <td align="right">%s</td> \n' % (html_indent_string (4), path, duration))
|
||||
perflist = list_children (node, 'performance')
|
||||
if result != 'success':
|
||||
txt = self._error_text(node)
|
||||
txt = re.sub (r'"', r'\\"', txt)
|
||||
txt = re.sub (r'\n', r'\\n', txt)
|
||||
txt = re.sub (r'&', r'&', txt)
|
||||
txt = re.sub (r'<', r'<', txt)
|
||||
self.oprint ('<script language="javascript" type="text/javascript">message_array["b%u_t%u_"] = "%s";</script>\n' % (self.bcounter, self.tcounter, txt))
|
||||
self.oprint ('<td align="center"><a href="javascript:view_testlog (\'%s\', \'%s\', \'%s\', \'%s\', \'Output:\', \'b%u_t%u_\')">Details</a></td>\n' %
|
||||
('TestResultWindow', binary.file, binary.random_seed, path, self.bcounter, self.tcounter))
|
||||
elif perflist:
|
||||
presults = []
|
||||
for perf in perflist:
|
||||
pmin = bool (int (attribute_as_text (perf, 'minimize')))
|
||||
pmax = bool (int (attribute_as_text (perf, 'maximize')))
|
||||
pval = float (attribute_as_text (perf, 'value'))
|
||||
txt = node_as_text (perf)
|
||||
txt = re.sub (r'&', r'&', txt)
|
||||
txt = re.sub (r'<', r'>', txt)
|
||||
txt = '<strong>Performance(' + (pmin and '<em>minimized</em>' or '<em>maximized</em>') + '):</strong> ' + txt.strip() + '<br />\n'
|
||||
txt = re.sub (r'"', r'\\"', txt)
|
||||
txt = re.sub (r'\n', r'\\n', txt)
|
||||
presults += [ (pval, txt) ]
|
||||
presults.sort()
|
||||
ptxt = ''.join ([e[1] for e in presults])
|
||||
self.oprint ('<script language="javascript" type="text/javascript">message_array["b%u_t%u_"] = "%s";</script>\n' % (self.bcounter, self.tcounter, ptxt))
|
||||
self.oprint ('<td align="center"><a href="javascript:view_testlog (\'%s\', \'%s\', \'%s\', \'%s\', \'Test Results:\', \'b%u_t%u_\')">Details</a></td>\n' %
|
||||
('TestResultWindow', binary.file, binary.random_seed, path, self.bcounter, self.tcounter))
|
||||
else:
|
||||
self.oprint ('<td align="center">-</td>\n')
|
||||
self.oprint ('<td align="right" %s>%s</td>\n' % (rcolor, result))
|
||||
self.oprint ('</tr>\n')
|
||||
self.tcounter += 1
|
||||
self.total_tcounter += 1
|
||||
self.total_fcounter += result != 'success'
|
||||
def handle_binary (self, binary):
|
||||
self.tcounter = 1
|
||||
self.bcounter += 1
|
||||
self.total_duration += binary.duration
|
||||
self.oprint ('<tr><td><strong>%s</strong></td><td align="right">%f</td> <td align="center">\n' % (binary.name, binary.duration))
|
||||
erlink, oklink = ('', '')
|
||||
real_cases = len (binary.testcases) - binary.skipped_cases
|
||||
if binary.success_cases < real_cases:
|
||||
erlink = 'href="javascript:toggle_display (\'ResultTable\', \'tr\', \'b%u_\', \'failed\')"' % self.bcounter
|
||||
if binary.success_cases:
|
||||
oklink = 'href="javascript:toggle_display (\'ResultTable\', \'tr\', \'b%u_\', \'success\')"' % self.bcounter
|
||||
if real_cases != 0:
|
||||
self.oprint ('<a %s>ER</a>\n' % erlink)
|
||||
self.oprint ('<a %s>OK</a>\n' % oklink)
|
||||
self.oprint ('</td>\n')
|
||||
perc = binary.success_cases * 100.0 / real_cases
|
||||
pcolor = {
|
||||
100 : 'bgcolor="lightgreen"',
|
||||
0 : 'bgcolor="red"',
|
||||
}.get (int (perc), 'bgcolor="yellow"')
|
||||
self.oprint ('<td align="right" %s>%.2f%%</td>\n' % (pcolor, perc))
|
||||
self.oprint ('</tr>\n')
|
||||
else:
|
||||
self.oprint ('Empty\n')
|
||||
self.oprint ('</td>\n')
|
||||
self.oprint ('</tr>\n')
|
||||
for tc in binary.testcases:
|
||||
self.handle_testcase (tc, binary)
|
||||
def handle_totals (self):
|
||||
self.oprint ('<tr>')
|
||||
self.oprint ('<td><strong>Totals:</strong> %u Binaries, %u Tests, %u Failed, %u Succeeded</td>' %
|
||||
(self.bcounter, self.total_tcounter, self.total_fcounter, self.total_tcounter - self.total_fcounter))
|
||||
self.oprint ('<td align="right">%f</td>\n' % self.total_duration)
|
||||
self.oprint ('<td align="center">-</td>\n')
|
||||
if self.total_tcounter != 0:
|
||||
perc = (self.total_tcounter - self.total_fcounter) * 100.0 / self.total_tcounter
|
||||
else:
|
||||
perc = 0.0
|
||||
pcolor = {
|
||||
100 : 'bgcolor="lightgreen"',
|
||||
0 : 'bgcolor="red"',
|
||||
}.get (int (perc), 'bgcolor="yellow"')
|
||||
self.oprint ('<td align="right" %s>%.2f%%</td>\n' % (pcolor, perc))
|
||||
self.oprint ('</tr>\n')
|
||||
def printout (self):
|
||||
self.oprint ('<html><head>\n')
|
||||
self.oprint ('<title>GTester Unit Test Report</title>\n')
|
||||
self.oprint (self.cssjs)
|
||||
self.oprint ('</head>\n')
|
||||
self.oprint ('<body>\n')
|
||||
self.oprint ('<h2>GTester Unit Test Report</h2>\n')
|
||||
self.handle_info ()
|
||||
self.oprint ('<p style="color:red;font-weight:bold"><blink>'
|
||||
'Deprecated: Since GLib 2.62, gtester and gtester-report are '
|
||||
'deprecated. Port to TAP.</blink></p>\n');
|
||||
self.oprint ('<table id="ResultTable" width="100%" border="1">\n<tr>\n')
|
||||
self.oprint ('<th>Program / Testcase </th>\n')
|
||||
self.oprint ('<th style="width:8em">Duration (sec)</th>\n')
|
||||
self.oprint ('<th style="width:5em">View</th>\n')
|
||||
self.oprint ('<th style="width:5em">Result</th>\n')
|
||||
self.oprint ('</tr>\n')
|
||||
for tb in self.binaries:
|
||||
self.handle_binary (tb)
|
||||
self.handle_totals()
|
||||
self.oprint ('</table>\n')
|
||||
self.oprint ('</body>\n')
|
||||
self.oprint ('</html>\n')
|
||||
|
||||
|
||||
class SubunitWriter(ReportWriter):
|
||||
"""Reporter to output a subunit stream."""
|
||||
|
||||
def printout(self):
|
||||
reporter = subunit.TestProtocolClient(sys.stdout)
|
||||
for binary in self.binaries:
|
||||
for tc in binary.testcases:
|
||||
test = GTestCase(tc, binary)
|
||||
test.run(reporter)
|
||||
|
||||
|
||||
class GTestCase(object):
|
||||
"""A representation of a gtester test result as a pyunit TestCase."""
|
||||
|
||||
def __init__(self, case, binary):
|
||||
"""Create a GTestCase for case 'case' from binary program 'binary'."""
|
||||
self._case = case
|
||||
self._binary = binary
|
||||
# the name of the case - e.g. /dbusmenu/glib/objects/menuitem/props_boolstr
|
||||
self._path = attribute_as_text(self._case, 'path')
|
||||
|
||||
def id(self):
|
||||
"""What test is this? Returns the gtester path for the testcase."""
|
||||
return self._path
|
||||
|
||||
def _get_details(self):
|
||||
"""Calculate a details dict for the test - attachments etc."""
|
||||
details = {}
|
||||
result = attribute_as_text(self._case, 'result', 'status')
|
||||
details['filename'] = Content(mime_utf8, lambda:[self._binary.file])
|
||||
details['random_seed'] = Content(mime_utf8,
|
||||
lambda:[self._binary.random_seed])
|
||||
if self._get_outcome() == 'addFailure':
|
||||
# Extract the error details. Skips have no details because its not
|
||||
# skip like unittest does, instead the runner just bypasses N test.
|
||||
txt = self._error_text(self._case)
|
||||
details['error'] = Content(mime_utf8, lambda:[txt])
|
||||
if self._get_outcome() == 'addSuccess':
|
||||
# Successful tests may have performance metrics.
|
||||
perflist = list_children(self._case, 'performance')
|
||||
if perflist:
|
||||
presults = []
|
||||
for perf in perflist:
|
||||
pmin = bool (int (attribute_as_text (perf, 'minimize')))
|
||||
pmax = bool (int (attribute_as_text (perf, 'maximize')))
|
||||
pval = float (attribute_as_text (perf, 'value'))
|
||||
txt = node_as_text (perf)
|
||||
txt = 'Performance(' + (pmin and 'minimized' or 'maximized'
|
||||
) + '): ' + txt.strip() + '\n'
|
||||
presults += [(pval, txt)]
|
||||
presults.sort()
|
||||
perf_details = [e[1] for e in presults]
|
||||
details['performance'] = Content(mime_utf8, lambda:perf_details)
|
||||
return details
|
||||
|
||||
def _get_outcome(self):
|
||||
if int(attribute_as_text(self._case, 'skipped') + '0'):
|
||||
return 'addSkip'
|
||||
outcome = attribute_as_text(self._case, 'result', 'status')
|
||||
if outcome == 'success':
|
||||
return 'addSuccess'
|
||||
else:
|
||||
return 'addFailure'
|
||||
|
||||
def run(self, result):
|
||||
time = datetime.datetime.utcnow().replace(tzinfo=iso8601.Utc())
|
||||
result.time(time)
|
||||
result.startTest(self)
|
||||
try:
|
||||
outcome = self._get_outcome()
|
||||
details = self._get_details()
|
||||
# Only provide a duration IFF outcome == 'addSuccess' - the main
|
||||
# parser claims bogus results otherwise: in that case emit time as
|
||||
# zero perhaps.
|
||||
if outcome == 'addSuccess':
|
||||
duration = float(node_as_text(self._case, 'duration'))
|
||||
duration = duration * 1000000
|
||||
timedelta = datetime.timedelta(0, 0, duration)
|
||||
time = time + timedelta
|
||||
result.time(time)
|
||||
getattr(result, outcome)(self, details=details)
|
||||
finally:
|
||||
result.stopTest(self)
|
||||
|
||||
|
||||
|
||||
# main program handling
|
||||
def parse_opts():
|
||||
"""Parse program options.
|
||||
|
||||
:return: An options object and the program arguments.
|
||||
"""
|
||||
parser = optparse.OptionParser()
|
||||
parser.version = '2.77.3'
|
||||
parser.usage = "%prog [OPTIONS] <gtester-log.xml>"
|
||||
parser.description = "Generate HTML reports from the XML log files generated by gtester."
|
||||
parser.epilog = "gtester-report (GLib utils) version %s."% (parser.version,)
|
||||
parser.add_option("-v", "--version", action="store_true", dest="version", default=False,
|
||||
help="Show program version.")
|
||||
parser.add_option("-s", "--subunit", action="store_true", dest="subunit", default=False,
|
||||
help="Output subunit [See https://launchpad.net/subunit/"
|
||||
" Needs python-subunit]")
|
||||
options, files = parser.parse_args()
|
||||
if options.version:
|
||||
print(parser.epilog)
|
||||
return None, None
|
||||
if len(files) != 1:
|
||||
parser.error("Must supply a log file to parse.")
|
||||
if options.subunit and subunit is None:
|
||||
parser.error("python-subunit is not installed.")
|
||||
return options, files
|
||||
|
||||
|
||||
def main():
|
||||
options, files = parse_opts()
|
||||
if options is None:
|
||||
return 0
|
||||
|
||||
print("Deprecated: Since GLib 2.62, gtester and gtester-report are "
|
||||
"deprecated. Port to TAP.", file=sys.stderr)
|
||||
|
||||
xd = xml.dom.minidom.parse (files[0])
|
||||
rr = ReportReader()
|
||||
rr.trampoline (xd)
|
||||
if not options.subunit:
|
||||
HTMLReportWriter(rr.get_info(), rr.binary_list()).printout()
|
||||
else:
|
||||
SubunitWriter(rr.get_info(), rr.binary_list()).printout()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
BIN
code/application/source/sf_app/tools/blue/bin/hex2hcd
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/hex2hcd
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/isotest
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/isotest
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/l2ping
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/l2ping
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/l2test
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/l2test
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/mpris-proxy
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/mpris-proxy
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/msgattrib
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/msgattrib
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/msgcat
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/msgcat
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/msgcmp
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/msgcmp
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/msgcomm
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/msgcomm
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/msgconv
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/msgconv
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/msgen
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/msgen
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/msgexec
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/msgexec
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/msgfilter
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/msgfilter
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/msgfmt
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/msgfmt
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/msggrep
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/msggrep
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/msginit
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/msginit
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/msgmerge
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/msgmerge
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/msgunfmt
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/msgunfmt
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/msguniq
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/msguniq
Executable file
Binary file not shown.
328
code/application/source/sf_app/tools/blue/bin/ncurses6-config
Executable file
328
code/application/source/sf_app/tools/blue/bin/ncurses6-config
Executable file
|
@ -0,0 +1,328 @@
|
|||
#!/bin/sh
|
||||
# $Id: ncurses-config.in,v 1.50 2021/08/07 21:36:14 tom Exp $
|
||||
##############################################################################
|
||||
# Copyright 2018-2020,2021 Thomas E. Dickey #
|
||||
# Copyright 2006-2015,2017 Free Software Foundation, Inc. #
|
||||
# #
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a #
|
||||
# copy of this software and associated documentation files (the "Software"), #
|
||||
# to deal in the Software without restriction, including without limitation #
|
||||
# the rights to use, copy, modify, merge, publish, distribute, distribute #
|
||||
# with modifications, sublicense, and/or sell copies of the Software, and to #
|
||||
# permit persons to whom the Software is furnished to do so, subject to the #
|
||||
# following conditions: #
|
||||
# #
|
||||
# The above copyright notice and this permission notice shall be included in #
|
||||
# all copies or substantial portions of the Software. #
|
||||
# #
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL #
|
||||
# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING #
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER #
|
||||
# DEALINGS IN THE SOFTWARE. #
|
||||
# #
|
||||
# Except as contained in this notice, the name(s) of the above copyright #
|
||||
# holders shall not be used in advertising or otherwise to promote the sale, #
|
||||
# use or other dealings in this Software without prior written #
|
||||
# authorization. #
|
||||
##############################################################################
|
||||
#
|
||||
# Author: Thomas E. Dickey, 2006-on
|
||||
|
||||
LANG=C; export LANG
|
||||
LANGUAGE=C; export LANGUAGE
|
||||
LC_ALL=C; export LC_ALL
|
||||
LC_CTYPE=C; export LC_CTYPE
|
||||
|
||||
prefix="/home/payton/blue"
|
||||
exec_prefix="${prefix}"
|
||||
|
||||
bindir="${exec_prefix}/bin"
|
||||
includedir="${prefix}/include"
|
||||
libdir="${exec_prefix}/lib"
|
||||
datarootdir="${prefix}/share"
|
||||
datadir="${datarootdir}"
|
||||
mandir="${datarootdir}/man"
|
||||
|
||||
THIS="ncurses"
|
||||
TINFO_LIB="ncurses"
|
||||
RPATH_LIST="${libdir}"
|
||||
|
||||
includesubdir="${prefix}/include/${THIS}"
|
||||
|
||||
# Ensure that RPATH_LIST contains only absolute pathnames, if it is nonempty.
|
||||
# We cannot filter it out within the build-process since the variable is used
|
||||
# in some special cases of installation using a relative path.
|
||||
if [ -n "$RPATH_LIST" ]
|
||||
then
|
||||
save_IFS="$IFS"
|
||||
IFS=':'
|
||||
filtered=
|
||||
for item in $RPATH_LIST
|
||||
do
|
||||
case "$item" in
|
||||
./*|../*|*/..|*/../*)
|
||||
;;
|
||||
*)
|
||||
[ -n "$filtered" ] && filtered="${filtered}:"
|
||||
filtered="${filtered}${item}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
IFS="$save_IFS"
|
||||
# if the result is empty, there is little we can do to fix it
|
||||
RPATH_LIST="$filtered"
|
||||
fi
|
||||
|
||||
# with --disable-overwrite, we installed into a subdirectory, but transformed
|
||||
# the headers to include like this:
|
||||
# <ncurses/curses.h>
|
||||
if [ xyes = xno ]; then
|
||||
case $includedir in
|
||||
$prefix/include/ncurses)
|
||||
includedir=`echo "$includedir" | sed -e 's,/[^/]*$,,'`
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
LIBS=""
|
||||
if [ "ncurses" = "ncurses" ]; then
|
||||
LIBS="-l${THIS} $LIBS"
|
||||
else
|
||||
LIBS="-l${THIS} -l${TINFO_LIB} $LIBS"
|
||||
fi
|
||||
|
||||
# Ignore -L options which do not correspond to an actual directory, or which
|
||||
# are standard library directories (i.e., the linker is supposed to search
|
||||
# those directories).
|
||||
#
|
||||
# There is no portable way to find the list of standard library directories.
|
||||
# Require a POSIX shell anyway, to keep this simple.
|
||||
lib_flags=
|
||||
for opt in -L$libdir $LIBS
|
||||
do
|
||||
case $opt in
|
||||
-specs*) # ignore linker specs-files which were used to build library
|
||||
continue
|
||||
;;
|
||||
-Wl,-z,*) # ignore flags used to manipulate shared image
|
||||
continue
|
||||
;;
|
||||
-Wl,--dynamic-linker*) # ignore ELF interpreter
|
||||
continue
|
||||
;;
|
||||
-L*)
|
||||
lib_check=`echo "x$opt" | sed -e 's/^.-L//'`
|
||||
[ -d "$lib_check" ] || continue
|
||||
case "$lib_check" in
|
||||
/usr/lib|/lib) # skip standard libdir
|
||||
if [ "$lib_check" = "$libdir" ]
|
||||
then
|
||||
lib_first=yes
|
||||
IFS_save="$IFS"
|
||||
IFS='|'
|
||||
LIBDIRS="/usr/lib|/lib"
|
||||
for lib_check in $LIBDIRS
|
||||
do
|
||||
if [ -d "$lib_check" ]
|
||||
then
|
||||
if [ "$lib_check" != "$libdir" ]
|
||||
then
|
||||
lib_first=no
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS="$IFS_save"
|
||||
[ $lib_first = yes ] && continue
|
||||
found=no
|
||||
for check in $lib_flags
|
||||
do
|
||||
if [ "x$check" = "x$opt" ]
|
||||
then
|
||||
found=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
[ $found = yes ] && continue
|
||||
:
|
||||
else
|
||||
continue
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
found=no
|
||||
for check in $lib_flags
|
||||
do
|
||||
if [ "x$check" = "x$opt" ]
|
||||
then
|
||||
found=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
[ $found = yes ] && continue
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
lib_flags="$lib_flags $opt"
|
||||
done
|
||||
|
||||
[ $# = 0 ] && exec /bin/sh $0 --error
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
# basic configuration
|
||||
--prefix)
|
||||
echo "$prefix"
|
||||
;;
|
||||
--exec-prefix)
|
||||
echo "$exec_prefix"
|
||||
;;
|
||||
# compile/link
|
||||
--cflags)
|
||||
INCS=" -D_GNU_SOURCE"
|
||||
if [ "xyes" = xno ]; then
|
||||
INCS="$INCS -I${includesubdir}"
|
||||
fi
|
||||
if [ "${includedir}" != /usr/include ]; then
|
||||
INCS="$INCS -I${includedir}"
|
||||
fi
|
||||
sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO
|
||||
$INCS
|
||||
ENDECHO
|
||||
;;
|
||||
--libs)
|
||||
OPTS=
|
||||
for opt in $lib_flags
|
||||
do
|
||||
[ -n "$OPTS" ] && OPTS="$OPTS "
|
||||
OPTS="${OPTS}${opt}"
|
||||
done
|
||||
printf "%s\n" "$OPTS"
|
||||
;;
|
||||
--libs-only-L)
|
||||
OPTS=
|
||||
for opt in $lib_flags
|
||||
do
|
||||
case "x$opt" in
|
||||
x-L*)
|
||||
[ -n "$OPTS" ] && OPTS="$OPTS "
|
||||
OPTS="${OPTS}${opt}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
printf "%s\n" "$OPTS"
|
||||
;;
|
||||
--libs-only-l)
|
||||
OPTS=
|
||||
for opt in $lib_flags
|
||||
do
|
||||
case "x$opt" in
|
||||
x-l*)
|
||||
[ -n "$OPTS" ] && OPTS="$OPTS "
|
||||
OPTS="${OPTS}${opt}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
printf "%s\n" "$OPTS"
|
||||
;;
|
||||
--libs-only-other)
|
||||
OPTS=
|
||||
for opt in $lib_flags
|
||||
do
|
||||
case "x$opt" in
|
||||
x-[lL]*)
|
||||
;;
|
||||
*)
|
||||
[ -n "$OPTS" ] && OPTS="$OPTS "
|
||||
OPTS="${OPTS}${opt}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
printf "%s\n" "$OPTS"
|
||||
;;
|
||||
# identification
|
||||
--version)
|
||||
echo "6.3.20211021"
|
||||
;;
|
||||
--abi-version)
|
||||
echo "6"
|
||||
;;
|
||||
--mouse-version)
|
||||
echo "2"
|
||||
;;
|
||||
# locations
|
||||
--bindir)
|
||||
echo "${bindir}"
|
||||
;;
|
||||
--datadir)
|
||||
echo "${datadir}"
|
||||
;;
|
||||
--includedir)
|
||||
INCS=
|
||||
if [ "xyes" = xno ]; then
|
||||
INCS="${includesubdir}"
|
||||
elif [ "${includedir}" != /usr/include ]; then
|
||||
INCS="${includedir}"
|
||||
fi
|
||||
echo $INCS
|
||||
;;
|
||||
--libdir)
|
||||
echo "${libdir}"
|
||||
;;
|
||||
--mandir)
|
||||
echo "${mandir}"
|
||||
;;
|
||||
--terminfo)
|
||||
echo "/home/payton/blue/share/terminfo"
|
||||
;;
|
||||
--terminfo-dirs)
|
||||
echo "/home/payton/blue/share/terminfo"
|
||||
;;
|
||||
--termpath)
|
||||
echo ""
|
||||
;;
|
||||
# general info
|
||||
--help)
|
||||
cat <<ENDHELP
|
||||
Usage: `basename $0` [options]
|
||||
|
||||
Options:
|
||||
--prefix echos the package-prefix of ${THIS}
|
||||
--exec-prefix echos the executable-prefix of ${THIS}
|
||||
|
||||
--cflags echos the C compiler flags needed to compile with ${THIS}
|
||||
--libs echos the libraries needed to link with ${THIS}
|
||||
|
||||
--libs-only-L echos -L linker options (search path) for ${THIS}
|
||||
--libs-only-l echos -l linker options (libraries) for ${THIS}
|
||||
--libs-only-other echos linker options other than -L/-l
|
||||
|
||||
--version echos the release+patchdate version of ${THIS}
|
||||
--abi-version echos the ABI version of ${THIS}
|
||||
--mouse-version echos the mouse-interface version of ${THIS}
|
||||
|
||||
--bindir echos the directory containing ${THIS} programs
|
||||
--datadir echos the directory containing ${THIS} data
|
||||
--includedir echos the directory containing ${THIS} header files
|
||||
--libdir echos the directory containing ${THIS} libraries
|
||||
--mandir echos the directory containing ${THIS} manpages
|
||||
--terminfo echos the \$TERMINFO terminfo database path
|
||||
--terminfo-dirs echos the \$TERMINFO_DIRS directory list
|
||||
--termpath echos the \$TERMPATH termcap list
|
||||
|
||||
--help prints this message
|
||||
ENDHELP
|
||||
;;
|
||||
--error|*)
|
||||
/bin/sh $0 --help 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
# vi:ts=4 sw=4
|
||||
# vile:shmode
|
BIN
code/application/source/sf_app/tools/blue/bin/ngettext
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/ngettext
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/pcre2grep
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/pcre2grep
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/rctest
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/rctest
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/recode-sr-latin
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/recode-sr-latin
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/xgettext
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/xgettext
Executable file
Binary file not shown.
BIN
code/application/source/sf_app/tools/blue/bin/xmlwf
Executable file
BIN
code/application/source/sf_app/tools/blue/bin/xmlwf
Executable file
Binary file not shown.
|
@ -0,0 +1,30 @@
|
|||
<!-- This configuration file specifies the required security policies
|
||||
for Bluetooth core daemon to work. -->
|
||||
|
||||
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||
<busconfig>
|
||||
|
||||
<!-- ../system.conf have denied everything, so we just punch some holes -->
|
||||
|
||||
<policy user="root">
|
||||
<allow own="org.bluez"/>
|
||||
<allow send_destination="org.bluez"/>
|
||||
<allow send_interface="org.bluez.AdvertisementMonitor1"/>
|
||||
<allow send_interface="org.bluez.Agent1"/>
|
||||
<allow send_interface="org.bluez.MediaEndpoint1"/>
|
||||
<allow send_interface="org.bluez.MediaPlayer1"/>
|
||||
<allow send_interface="org.bluez.Profile1"/>
|
||||
<allow send_interface="org.bluez.GattCharacteristic1"/>
|
||||
<allow send_interface="org.bluez.GattDescriptor1"/>
|
||||
<allow send_interface="org.bluez.LEAdvertisement1"/>
|
||||
<allow send_interface="org.freedesktop.DBus.ObjectManager"/>
|
||||
<allow send_interface="org.freedesktop.DBus.Properties"/>
|
||||
<allow send_interface="org.mpris.MediaPlayer2.Player"/>
|
||||
</policy>
|
||||
|
||||
<policy context="default">
|
||||
<allow send_destination="org.bluez"/>
|
||||
</policy>
|
||||
|
||||
</busconfig>
|
|
@ -0,0 +1,19 @@
|
|||
<!--
|
||||
This configuration file is no longer required and may be removed.
|
||||
|
||||
In older versions of dbus, this file defined the behaviour of the well-known
|
||||
session bus. That behaviour is now determined by
|
||||
/home/payton/blue/share/dbus-1/session.conf, which should not be edited.
|
||||
|
||||
For local configuration changes, create a file
|
||||
session-local.conf or files matching session.d/*.conf in the same directory
|
||||
as this one, with a <busconfig> element containing configuration directives.
|
||||
These directives can override D-Bus or OS defaults.
|
||||
|
||||
For upstream or distribution-wide defaults that can be overridden
|
||||
by a local sysadmin, create files matching
|
||||
/home/payton/blue/share/dbus-1/session.d/*.conf instead.
|
||||
-->
|
||||
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||
<busconfig></busconfig>
|
|
@ -0,0 +1,19 @@
|
|||
<!--
|
||||
This configuration file is no longer required and may be removed.
|
||||
|
||||
In older versions of dbus, this file defined the behaviour of the well-known
|
||||
system bus. That behaviour is now determined by
|
||||
/home/payton/blue/share/dbus-1/system.conf, which should not be edited.
|
||||
|
||||
For local configuration changes, create a file
|
||||
system-local.conf or files matching system.d/*.conf in the same directory
|
||||
as this one, with a <busconfig> element containing configuration directives.
|
||||
These directives can override D-Bus or OS defaults.
|
||||
|
||||
For upstream or distribution-wide defaults that can be overridden
|
||||
by a local sysadmin, create files matching
|
||||
/home/payton/blue/share/dbus-1/system.d/*.conf instead.
|
||||
-->
|
||||
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||
<busconfig></busconfig>
|
|
@ -0,0 +1,68 @@
|
|||
/* Class autosprintf - formatted output to an ostream.
|
||||
Copyright (C) 2002, 2012-2016 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _AUTOSPRINTF_H
|
||||
#define _AUTOSPRINTF_H
|
||||
|
||||
/* This feature is available in gcc versions 2.5 and later. */
|
||||
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
|
||||
# define _AUTOSPRINTF_ATTRIBUTE_FORMAT() /* empty */
|
||||
#else
|
||||
/* The __-protected variants of 'format' and 'printf' attributes
|
||||
are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
|
||||
# define _AUTOSPRINTF_ATTRIBUTE_FORMAT() \
|
||||
__attribute__ ((__format__ (__printf__, 2, 3)))
|
||||
# else
|
||||
# define _AUTOSPRINTF_ATTRIBUTE_FORMAT() \
|
||||
__attribute__ ((format (printf, 2, 3)))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
namespace gnu
|
||||
{
|
||||
/* A temporary object, usually allocated on the stack, representing
|
||||
the result of an asprintf() call. */
|
||||
class autosprintf
|
||||
{
|
||||
public:
|
||||
/* Constructor: takes a format string and the printf arguments. */
|
||||
autosprintf (const char *format, ...)
|
||||
_AUTOSPRINTF_ATTRIBUTE_FORMAT();
|
||||
/* Copy constructor. */
|
||||
autosprintf (const autosprintf& src);
|
||||
/* Assignment operator. */
|
||||
autosprintf& operator = (autosprintf temporary);
|
||||
/* Destructor: frees the temporarily allocated string. */
|
||||
~autosprintf ();
|
||||
/* Conversion to string. */
|
||||
operator char * () const;
|
||||
operator std::string () const;
|
||||
/* Output to an ostream. */
|
||||
friend inline std::ostream& operator<< (std::ostream& stream, const autosprintf& tmp)
|
||||
{
|
||||
stream << (tmp.str ? tmp.str : "(error in autosprintf)");
|
||||
return stream;
|
||||
}
|
||||
private:
|
||||
char *str;
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* _AUTOSPRINTF_H */
|
|
@ -0,0 +1,481 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/*
|
||||
*
|
||||
* BlueZ - Bluetooth protocol stack for Linux
|
||||
*
|
||||
* Copyright (C) 2000-2001 Qualcomm Incorporated
|
||||
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
|
||||
* Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __BLUETOOTH_H
|
||||
#define __BLUETOOTH_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <endian.h>
|
||||
#include <byteswap.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#ifndef AF_BLUETOOTH
|
||||
#define AF_BLUETOOTH 31
|
||||
#define PF_BLUETOOTH AF_BLUETOOTH
|
||||
#endif
|
||||
|
||||
#define BTPROTO_L2CAP 0
|
||||
#define BTPROTO_HCI 1
|
||||
#define BTPROTO_SCO 2
|
||||
#define BTPROTO_RFCOMM 3
|
||||
#define BTPROTO_BNEP 4
|
||||
#define BTPROTO_CMTP 5
|
||||
#define BTPROTO_HIDP 6
|
||||
#define BTPROTO_AVDTP 7
|
||||
#define BTPROTO_ISO 8
|
||||
|
||||
#define SOL_HCI 0
|
||||
#define SOL_L2CAP 6
|
||||
#define SOL_SCO 17
|
||||
#define SOL_RFCOMM 18
|
||||
|
||||
#ifndef SOL_BLUETOOTH
|
||||
#define SOL_BLUETOOTH 274
|
||||
#endif
|
||||
|
||||
#define BT_SECURITY 4
|
||||
struct bt_security {
|
||||
uint8_t level;
|
||||
uint8_t key_size;
|
||||
};
|
||||
#define BT_SECURITY_SDP 0
|
||||
#define BT_SECURITY_LOW 1
|
||||
#define BT_SECURITY_MEDIUM 2
|
||||
#define BT_SECURITY_HIGH 3
|
||||
#define BT_SECURITY_FIPS 4
|
||||
|
||||
#define BT_DEFER_SETUP 7
|
||||
|
||||
#define BT_FLUSHABLE 8
|
||||
|
||||
#define BT_FLUSHABLE_OFF 0
|
||||
#define BT_FLUSHABLE_ON 1
|
||||
|
||||
#define BT_POWER 9
|
||||
struct bt_power {
|
||||
uint8_t force_active;
|
||||
};
|
||||
#define BT_POWER_FORCE_ACTIVE_OFF 0
|
||||
#define BT_POWER_FORCE_ACTIVE_ON 1
|
||||
|
||||
#define BT_CHANNEL_POLICY 10
|
||||
|
||||
/* BR/EDR only (default policy)
|
||||
* AMP controllers cannot be used.
|
||||
* Channel move requests from the remote device are denied.
|
||||
* If the L2CAP channel is currently using AMP, move the channel to BR/EDR.
|
||||
*/
|
||||
#define BT_CHANNEL_POLICY_BREDR_ONLY 0
|
||||
|
||||
/* BR/EDR Preferred
|
||||
* Allow use of AMP controllers.
|
||||
* If the L2CAP channel is currently on AMP, move it to BR/EDR.
|
||||
* Channel move requests from the remote device are allowed.
|
||||
*/
|
||||
#define BT_CHANNEL_POLICY_BREDR_PREFERRED 1
|
||||
|
||||
/* AMP Preferred
|
||||
* Allow use of AMP controllers
|
||||
* If the L2CAP channel is currently on BR/EDR and AMP controller
|
||||
* resources are available, initiate a channel move to AMP.
|
||||
* Channel move requests from the remote device are allowed.
|
||||
* If the L2CAP socket has not been connected yet, try to create
|
||||
* and configure the channel directly on an AMP controller rather
|
||||
* than BR/EDR.
|
||||
*/
|
||||
#define BT_CHANNEL_POLICY_AMP_PREFERRED 2
|
||||
|
||||
#define BT_VOICE 11
|
||||
struct bt_voice {
|
||||
uint16_t setting;
|
||||
};
|
||||
|
||||
#define BT_SNDMTU 12
|
||||
#define BT_RCVMTU 13
|
||||
|
||||
#define BT_VOICE_TRANSPARENT 0x0003
|
||||
#define BT_VOICE_CVSD_16BIT 0x0060
|
||||
|
||||
#define BT_PHY 14
|
||||
|
||||
#define BT_PHY_BR_1M_1SLOT 0x00000001
|
||||
#define BT_PHY_BR_1M_3SLOT 0x00000002
|
||||
#define BT_PHY_BR_1M_5SLOT 0x00000004
|
||||
#define BT_PHY_EDR_2M_1SLOT 0x00000008
|
||||
#define BT_PHY_EDR_2M_3SLOT 0x00000010
|
||||
#define BT_PHY_EDR_2M_5SLOT 0x00000020
|
||||
#define BT_PHY_EDR_3M_1SLOT 0x00000040
|
||||
#define BT_PHY_EDR_3M_3SLOT 0x00000080
|
||||
#define BT_PHY_EDR_3M_5SLOT 0x00000100
|
||||
#define BT_PHY_LE_1M_TX 0x00000200
|
||||
#define BT_PHY_LE_1M_RX 0x00000400
|
||||
#define BT_PHY_LE_2M_TX 0x00000800
|
||||
#define BT_PHY_LE_2M_RX 0x00001000
|
||||
#define BT_PHY_LE_CODED_TX 0x00002000
|
||||
#define BT_PHY_LE_CODED_RX 0x00004000
|
||||
|
||||
#define BT_MODE 15
|
||||
|
||||
#define BT_MODE_BASIC 0x00
|
||||
#define BT_MODE_ERTM 0x01
|
||||
#define BT_MODE_STREAMING 0x02
|
||||
#define BT_MODE_LE_FLOWCTL 0x03
|
||||
#define BT_MODE_EXT_FLOWCTL 0x04
|
||||
|
||||
#define BT_PKT_STATUS 16
|
||||
|
||||
#define BT_SCM_PKT_STATUS 0x03
|
||||
|
||||
#define BT_ISO_QOS 17
|
||||
|
||||
#define BT_ISO_QOS_CIG_UNSET 0xff
|
||||
#define BT_ISO_QOS_CIS_UNSET 0xff
|
||||
|
||||
struct bt_iso_io_qos {
|
||||
uint32_t interval;
|
||||
uint16_t latency;
|
||||
uint16_t sdu;
|
||||
uint8_t phy;
|
||||
uint8_t rtn;
|
||||
};
|
||||
|
||||
struct bt_iso_qos {
|
||||
union {
|
||||
uint8_t cig;
|
||||
uint8_t big;
|
||||
};
|
||||
union {
|
||||
uint8_t cis;
|
||||
uint8_t bis;
|
||||
};
|
||||
union {
|
||||
uint8_t sca;
|
||||
uint8_t sync_interval;
|
||||
};
|
||||
uint8_t packing;
|
||||
uint8_t framing;
|
||||
struct bt_iso_io_qos in;
|
||||
struct bt_iso_io_qos out;
|
||||
};
|
||||
|
||||
#define BT_CODEC 19
|
||||
struct bt_codec {
|
||||
uint8_t id;
|
||||
uint16_t cid;
|
||||
uint16_t vid;
|
||||
uint8_t data_path_id;
|
||||
uint8_t num_caps;
|
||||
struct codec_caps {
|
||||
uint8_t len;
|
||||
uint8_t data[];
|
||||
} caps[];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct bt_codecs {
|
||||
uint8_t num_codecs;
|
||||
struct bt_codec codecs[];
|
||||
} __attribute__((packed));
|
||||
|
||||
|
||||
/* Connection and socket states */
|
||||
enum {
|
||||
BT_CONNECTED = 1, /* Equal to TCP_ESTABLISHED to make net code happy */
|
||||
BT_OPEN,
|
||||
BT_BOUND,
|
||||
BT_LISTEN,
|
||||
BT_CONNECT,
|
||||
BT_CONNECT2,
|
||||
BT_CONFIG,
|
||||
BT_DISCONN,
|
||||
BT_CLOSED
|
||||
};
|
||||
|
||||
#define BT_ISO_BASE 20
|
||||
|
||||
/* Byte order conversions */
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
#define htobs(d) (d)
|
||||
#define htobl(d) (d)
|
||||
#define htobll(d) (d)
|
||||
#define btohs(d) (d)
|
||||
#define btohl(d) (d)
|
||||
#define btohll(d) (d)
|
||||
#elif __BYTE_ORDER == __BIG_ENDIAN
|
||||
#define htobs(d) bswap_16(d)
|
||||
#define htobl(d) bswap_32(d)
|
||||
#define htobll(d) bswap_64(d)
|
||||
#define btohs(d) bswap_16(d)
|
||||
#define btohl(d) bswap_32(d)
|
||||
#define btohll(d) bswap_64(d)
|
||||
#else
|
||||
#error "Unknown byte order"
|
||||
#endif
|
||||
|
||||
/* Bluetooth unaligned access */
|
||||
#define bt_get_unaligned(ptr) \
|
||||
__extension__ ({ \
|
||||
struct __attribute__((packed)) { \
|
||||
__typeof__(*(ptr)) __v; \
|
||||
} *__p = (__typeof__(__p)) (ptr); \
|
||||
__p->__v; \
|
||||
})
|
||||
|
||||
#define bt_put_unaligned(val, ptr) \
|
||||
do { \
|
||||
struct __attribute__((packed)) { \
|
||||
__typeof__(*(ptr)) __v; \
|
||||
} *__p = (__typeof__(__p)) (ptr); \
|
||||
__p->__v = (val); \
|
||||
} while(0)
|
||||
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
static inline uint64_t bt_get_le64(const void *ptr)
|
||||
{
|
||||
return bt_get_unaligned((const uint64_t *) ptr);
|
||||
}
|
||||
|
||||
static inline uint64_t bt_get_be64(const void *ptr)
|
||||
{
|
||||
return bswap_64(bt_get_unaligned((const uint64_t *) ptr));
|
||||
}
|
||||
|
||||
static inline uint32_t bt_get_le32(const void *ptr)
|
||||
{
|
||||
return bt_get_unaligned((const uint32_t *) ptr);
|
||||
}
|
||||
|
||||
static inline uint32_t bt_get_be32(const void *ptr)
|
||||
{
|
||||
return bswap_32(bt_get_unaligned((const uint32_t *) ptr));
|
||||
}
|
||||
|
||||
static inline uint16_t bt_get_le16(const void *ptr)
|
||||
{
|
||||
return bt_get_unaligned((const uint16_t *) ptr);
|
||||
}
|
||||
|
||||
static inline uint16_t bt_get_be16(const void *ptr)
|
||||
{
|
||||
return bswap_16(bt_get_unaligned((const uint16_t *) ptr));
|
||||
}
|
||||
|
||||
static inline void bt_put_le64(uint64_t val, const void *ptr)
|
||||
{
|
||||
bt_put_unaligned(val, (uint64_t *) ptr);
|
||||
}
|
||||
|
||||
static inline void bt_put_be64(uint64_t val, const void *ptr)
|
||||
{
|
||||
bt_put_unaligned(bswap_64(val), (uint64_t *) ptr);
|
||||
}
|
||||
|
||||
static inline void bt_put_le32(uint32_t val, const void *ptr)
|
||||
{
|
||||
bt_put_unaligned(val, (uint32_t *) ptr);
|
||||
}
|
||||
|
||||
static inline void bt_put_be32(uint32_t val, const void *ptr)
|
||||
{
|
||||
bt_put_unaligned(bswap_32(val), (uint32_t *) ptr);
|
||||
}
|
||||
|
||||
static inline void bt_put_le16(uint16_t val, const void *ptr)
|
||||
{
|
||||
bt_put_unaligned(val, (uint16_t *) ptr);
|
||||
}
|
||||
|
||||
static inline void bt_put_be16(uint16_t val, const void *ptr)
|
||||
{
|
||||
bt_put_unaligned(bswap_16(val), (uint16_t *) ptr);
|
||||
}
|
||||
|
||||
#elif __BYTE_ORDER == __BIG_ENDIAN
|
||||
static inline uint64_t bt_get_le64(const void *ptr)
|
||||
{
|
||||
return bswap_64(bt_get_unaligned((const uint64_t *) ptr));
|
||||
}
|
||||
|
||||
static inline uint64_t bt_get_be64(const void *ptr)
|
||||
{
|
||||
return bt_get_unaligned((const uint64_t *) ptr);
|
||||
}
|
||||
|
||||
static inline uint32_t bt_get_le32(const void *ptr)
|
||||
{
|
||||
return bswap_32(bt_get_unaligned((const uint32_t *) ptr));
|
||||
}
|
||||
|
||||
static inline uint32_t bt_get_be32(const void *ptr)
|
||||
{
|
||||
return bt_get_unaligned((const uint32_t *) ptr);
|
||||
}
|
||||
|
||||
static inline uint16_t bt_get_le16(const void *ptr)
|
||||
{
|
||||
return bswap_16(bt_get_unaligned((const uint16_t *) ptr));
|
||||
}
|
||||
|
||||
static inline uint16_t bt_get_be16(const void *ptr)
|
||||
{
|
||||
return bt_get_unaligned((const uint16_t *) ptr);
|
||||
}
|
||||
|
||||
static inline void bt_put_le64(uint64_t val, const void *ptr)
|
||||
{
|
||||
bt_put_unaligned(bswap_64(val), (uint64_t *) ptr);
|
||||
}
|
||||
|
||||
static inline void bt_put_be64(uint64_t val, const void *ptr)
|
||||
{
|
||||
bt_put_unaligned(val, (uint64_t *) ptr);
|
||||
}
|
||||
|
||||
static inline void bt_put_le32(uint32_t val, const void *ptr)
|
||||
{
|
||||
bt_put_unaligned(bswap_32(val), (uint32_t *) ptr);
|
||||
}
|
||||
|
||||
static inline void bt_put_be32(uint32_t val, const void *ptr)
|
||||
{
|
||||
bt_put_unaligned(val, (uint32_t *) ptr);
|
||||
}
|
||||
|
||||
static inline void bt_put_le16(uint16_t val, const void *ptr)
|
||||
{
|
||||
bt_put_unaligned(bswap_16(val), (uint16_t *) ptr);
|
||||
}
|
||||
|
||||
static inline void bt_put_be16(uint16_t val, const void *ptr)
|
||||
{
|
||||
bt_put_unaligned(val, (uint16_t *) ptr);
|
||||
}
|
||||
#else
|
||||
#error "Unknown byte order"
|
||||
#endif
|
||||
|
||||
/* BD Address */
|
||||
typedef struct {
|
||||
uint8_t b[6];
|
||||
} __attribute__((packed)) bdaddr_t;
|
||||
|
||||
/* BD Address type */
|
||||
#define BDADDR_BREDR 0x00
|
||||
#define BDADDR_LE_PUBLIC 0x01
|
||||
#define BDADDR_LE_RANDOM 0x02
|
||||
|
||||
#define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}})
|
||||
#define BDADDR_ALL (&(bdaddr_t) {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}})
|
||||
#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}})
|
||||
|
||||
/* Copy, swap, convert BD Address */
|
||||
static inline int bacmp(const bdaddr_t *ba1, const bdaddr_t *ba2)
|
||||
{
|
||||
return memcmp(ba1, ba2, sizeof(bdaddr_t));
|
||||
}
|
||||
static inline void bacpy(bdaddr_t *dst, const bdaddr_t *src)
|
||||
{
|
||||
memcpy(dst, src, sizeof(bdaddr_t));
|
||||
}
|
||||
|
||||
void baswap(bdaddr_t *dst, const bdaddr_t *src);
|
||||
bdaddr_t *strtoba(const char *str);
|
||||
char *batostr(const bdaddr_t *ba);
|
||||
int ba2str(const bdaddr_t *ba, char *str);
|
||||
int ba2strlc(const bdaddr_t *ba, char *str);
|
||||
int str2ba(const char *str, bdaddr_t *ba);
|
||||
int ba2oui(const bdaddr_t *ba, char *oui);
|
||||
int bachk(const char *str);
|
||||
|
||||
int baprintf(const char *format, ...);
|
||||
int bafprintf(FILE *stream, const char *format, ...);
|
||||
int basprintf(char *str, const char *format, ...);
|
||||
int basnprintf(char *str, size_t size, const char *format, ...);
|
||||
|
||||
void *bt_malloc(size_t size);
|
||||
void *bt_malloc0(size_t size);
|
||||
void bt_free(void *ptr);
|
||||
|
||||
int bt_error(uint16_t code);
|
||||
const char *bt_compidtostr(int id);
|
||||
|
||||
typedef struct {
|
||||
uint8_t data[3];
|
||||
} uint24_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t data[16];
|
||||
} uint128_t;
|
||||
|
||||
static inline void bswap_128(const void *src, void *dst)
|
||||
{
|
||||
const uint8_t *s = (const uint8_t *) src;
|
||||
uint8_t *d = (uint8_t *) dst;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
d[15 - i] = s[i];
|
||||
}
|
||||
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
|
||||
#define ntoh64(x) (x)
|
||||
|
||||
static inline void ntoh128(const uint128_t *src, uint128_t *dst)
|
||||
{
|
||||
memcpy(dst, src, sizeof(uint128_t));
|
||||
}
|
||||
|
||||
static inline void btoh128(const uint128_t *src, uint128_t *dst)
|
||||
{
|
||||
bswap_128(src, dst);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static inline uint64_t ntoh64(uint64_t n)
|
||||
{
|
||||
uint64_t h;
|
||||
uint64_t tmp = ntohl(n & 0x00000000ffffffff);
|
||||
|
||||
h = ntohl(n >> 32);
|
||||
h |= tmp << 32;
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
static inline void ntoh128(const uint128_t *src, uint128_t *dst)
|
||||
{
|
||||
bswap_128(src, dst);
|
||||
}
|
||||
|
||||
static inline void btoh128(const uint128_t *src, uint128_t *dst)
|
||||
{
|
||||
memcpy(dst, src, sizeof(uint128_t));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define hton64(x) ntoh64(x)
|
||||
#define hton128(x, y) ntoh128(x, y)
|
||||
#define htob128(x, y) btoh128(x, y)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __BLUETOOTH_H */
|
|
@ -0,0 +1,149 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/*
|
||||
*
|
||||
* BlueZ - Bluetooth protocol stack for Linux
|
||||
*
|
||||
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
|
||||
* Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __BNEP_H
|
||||
#define __BNEP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bluetooth/bluetooth.h>
|
||||
|
||||
#ifndef ETH_ALEN
|
||||
#define ETH_ALEN 6 /* from <net/ethernet.h> */
|
||||
#endif
|
||||
|
||||
/* BNEP UUIDs */
|
||||
#define BNEP_BASE_UUID 0x0000000000001000800000805F9B34FB
|
||||
#define BNEP_UUID16 0x02
|
||||
#define BNEP_UUID32 0x04
|
||||
#define BNEP_UUID128 0x16
|
||||
|
||||
#define BNEP_SVC_PANU 0x1115
|
||||
#define BNEP_SVC_NAP 0x1116
|
||||
#define BNEP_SVC_GN 0x1117
|
||||
|
||||
/* BNEP packet types */
|
||||
#define BNEP_GENERAL 0x00
|
||||
#define BNEP_CONTROL 0x01
|
||||
#define BNEP_COMPRESSED 0x02
|
||||
#define BNEP_COMPRESSED_SRC_ONLY 0x03
|
||||
#define BNEP_COMPRESSED_DST_ONLY 0x04
|
||||
|
||||
/* BNEP control types */
|
||||
#define BNEP_CMD_NOT_UNDERSTOOD 0x00
|
||||
#define BNEP_SETUP_CONN_REQ 0x01
|
||||
#define BNEP_SETUP_CONN_RSP 0x02
|
||||
#define BNEP_FILTER_NET_TYPE_SET 0x03
|
||||
#define BNEP_FILTER_NET_TYPE_RSP 0x04
|
||||
#define BNEP_FILTER_MULT_ADDR_SET 0x05
|
||||
#define BNEP_FILTER_MULT_ADDR_RSP 0x06
|
||||
|
||||
/* BNEP response messages */
|
||||
#define BNEP_SUCCESS 0x00
|
||||
|
||||
#define BNEP_CONN_INVALID_DST 0x01
|
||||
#define BNEP_CONN_INVALID_SRC 0x02
|
||||
#define BNEP_CONN_INVALID_SVC 0x03
|
||||
#define BNEP_CONN_NOT_ALLOWED 0x04
|
||||
|
||||
#define BNEP_FILTER_UNSUPPORTED_REQ 0x01
|
||||
#define BNEP_FILTER_INVALID_RANGE 0x02
|
||||
#define BNEP_FILTER_INVALID_MCADDR 0x02
|
||||
#define BNEP_FILTER_LIMIT_REACHED 0x03
|
||||
#define BNEP_FILTER_DENIED_SECURITY 0x04
|
||||
|
||||
/* L2CAP settings */
|
||||
#define BNEP_MTU 1691
|
||||
#define BNEP_FLUSH_TO 0xffff
|
||||
#define BNEP_CONNECT_TO 15
|
||||
#define BNEP_FILTER_TO 15
|
||||
|
||||
#ifndef BNEP_PSM
|
||||
#define BNEP_PSM 0x0f
|
||||
#endif
|
||||
|
||||
/* BNEP headers */
|
||||
#define BNEP_TYPE_MASK 0x7f
|
||||
#define BNEP_EXT_HEADER 0x80
|
||||
|
||||
struct bnep_setup_conn_req {
|
||||
uint8_t type;
|
||||
uint8_t ctrl;
|
||||
uint8_t uuid_size;
|
||||
uint8_t service[0];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct bnep_set_filter_req {
|
||||
uint8_t type;
|
||||
uint8_t ctrl;
|
||||
uint16_t len;
|
||||
uint8_t list[0];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct bnep_ctrl_cmd_not_understood_cmd {
|
||||
uint8_t type;
|
||||
uint8_t ctrl;
|
||||
uint8_t unkn_ctrl;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct bnep_control_rsp {
|
||||
uint8_t type;
|
||||
uint8_t ctrl;
|
||||
uint16_t resp;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct bnep_ext_hdr {
|
||||
uint8_t type;
|
||||
uint8_t len;
|
||||
uint8_t data[0];
|
||||
} __attribute__((packed));
|
||||
|
||||
/* BNEP ioctl defines */
|
||||
#define BNEPCONNADD _IOW('B', 200, int)
|
||||
#define BNEPCONNDEL _IOW('B', 201, int)
|
||||
#define BNEPGETCONNLIST _IOR('B', 210, int)
|
||||
#define BNEPGETCONNINFO _IOR('B', 211, int)
|
||||
#define BNEPGETSUPPFEAT _IOR('B', 212, int)
|
||||
|
||||
#define BNEP_SETUP_RESPONSE 0
|
||||
|
||||
struct bnep_connadd_req {
|
||||
int sock; /* Connected socket */
|
||||
uint32_t flags;
|
||||
uint16_t role;
|
||||
char device[16]; /* Name of the Ethernet device */
|
||||
};
|
||||
|
||||
struct bnep_conndel_req {
|
||||
uint32_t flags;
|
||||
uint8_t dst[ETH_ALEN];
|
||||
};
|
||||
|
||||
struct bnep_conninfo {
|
||||
uint32_t flags;
|
||||
uint16_t role;
|
||||
uint16_t state;
|
||||
uint8_t dst[ETH_ALEN];
|
||||
char device[16];
|
||||
};
|
||||
|
||||
struct bnep_connlist_req {
|
||||
uint32_t cnum;
|
||||
struct bnep_conninfo *ci;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __BNEP_H */
|
|
@ -0,0 +1,56 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/*
|
||||
*
|
||||
* BlueZ - Bluetooth protocol stack for Linux
|
||||
*
|
||||
* Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __CMTP_H
|
||||
#define __CMTP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* CMTP defaults */
|
||||
#define CMTP_MINIMUM_MTU 152
|
||||
#define CMTP_DEFAULT_MTU 672
|
||||
|
||||
/* CMTP ioctl defines */
|
||||
#define CMTPCONNADD _IOW('C', 200, int)
|
||||
#define CMTPCONNDEL _IOW('C', 201, int)
|
||||
#define CMTPGETCONNLIST _IOR('C', 210, int)
|
||||
#define CMTPGETCONNINFO _IOR('C', 211, int)
|
||||
|
||||
#define CMTP_LOOPBACK 0
|
||||
|
||||
struct cmtp_connadd_req {
|
||||
int sock; /* Connected socket */
|
||||
uint32_t flags;
|
||||
};
|
||||
|
||||
struct cmtp_conndel_req {
|
||||
bdaddr_t bdaddr;
|
||||
uint32_t flags;
|
||||
};
|
||||
|
||||
struct cmtp_conninfo {
|
||||
bdaddr_t bdaddr;
|
||||
uint32_t flags;
|
||||
uint16_t state;
|
||||
int num;
|
||||
};
|
||||
|
||||
struct cmtp_connlist_req {
|
||||
uint32_t cnum;
|
||||
struct cmtp_conninfo *ci;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __CMTP_H */
|
2444
code/application/source/sf_app/tools/blue/include/bluetooth/hci.h
Normal file
2444
code/application/source/sf_app/tools/blue/include/bluetooth/hci.h
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,229 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/*
|
||||
*
|
||||
* BlueZ - Bluetooth protocol stack for Linux
|
||||
*
|
||||
* Copyright (C) 2000-2001 Qualcomm Incorporated
|
||||
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
|
||||
* Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __HCI_LIB_H
|
||||
#define __HCI_LIB_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct hci_request {
|
||||
uint16_t ogf;
|
||||
uint16_t ocf;
|
||||
int event;
|
||||
void *cparam;
|
||||
int clen;
|
||||
void *rparam;
|
||||
int rlen;
|
||||
};
|
||||
|
||||
struct hci_version {
|
||||
uint16_t manufacturer;
|
||||
uint8_t hci_ver;
|
||||
uint16_t hci_rev;
|
||||
uint8_t lmp_ver;
|
||||
uint16_t lmp_subver;
|
||||
};
|
||||
|
||||
int hci_open_dev(int dev_id);
|
||||
int hci_close_dev(int dd);
|
||||
int hci_send_cmd(int dd, uint16_t ogf, uint16_t ocf, uint8_t plen, void *param);
|
||||
int hci_send_req(int dd, struct hci_request *req, int timeout);
|
||||
|
||||
int hci_create_connection(int dd, const bdaddr_t *bdaddr, uint16_t ptype, uint16_t clkoffset, uint8_t rswitch, uint16_t *handle, int to);
|
||||
int hci_disconnect(int dd, uint16_t handle, uint8_t reason, int to);
|
||||
|
||||
int hci_inquiry(int dev_id, int len, int num_rsp, const uint8_t *lap, inquiry_info **ii, long flags);
|
||||
int hci_devinfo(int dev_id, struct hci_dev_info *di);
|
||||
int hci_devba(int dev_id, bdaddr_t *bdaddr);
|
||||
int hci_devid(const char *str);
|
||||
|
||||
int hci_read_local_name(int dd, int len, char *name, int to);
|
||||
int hci_write_local_name(int dd, const char *name, int to);
|
||||
int hci_read_remote_name(int dd, const bdaddr_t *bdaddr, int len, char *name, int to);
|
||||
int hci_read_remote_name_with_clock_offset(int dd, const bdaddr_t *bdaddr, uint8_t pscan_rep_mode, uint16_t clkoffset, int len, char *name, int to);
|
||||
int hci_read_remote_name_cancel(int dd, const bdaddr_t *bdaddr, int to);
|
||||
int hci_read_remote_version(int dd, uint16_t handle, struct hci_version *ver, int to);
|
||||
int hci_read_remote_features(int dd, uint16_t handle, uint8_t *features, int to);
|
||||
int hci_read_remote_ext_features(int dd, uint16_t handle, uint8_t page, uint8_t *max_page, uint8_t *features, int to);
|
||||
int hci_read_clock_offset(int dd, uint16_t handle, uint16_t *clkoffset, int to);
|
||||
int hci_read_local_version(int dd, struct hci_version *ver, int to);
|
||||
int hci_read_local_commands(int dd, uint8_t *commands, int to);
|
||||
int hci_read_local_features(int dd, uint8_t *features, int to);
|
||||
int hci_read_local_ext_features(int dd, uint8_t page, uint8_t *max_page, uint8_t *features, int to);
|
||||
int hci_read_bd_addr(int dd, bdaddr_t *bdaddr, int to);
|
||||
int hci_read_class_of_dev(int dd, uint8_t *cls, int to);
|
||||
int hci_write_class_of_dev(int dd, uint32_t cls, int to);
|
||||
int hci_read_voice_setting(int dd, uint16_t *vs, int to);
|
||||
int hci_write_voice_setting(int dd, uint16_t vs, int to);
|
||||
int hci_read_current_iac_lap(int dd, uint8_t *num_iac, uint8_t *lap, int to);
|
||||
int hci_write_current_iac_lap(int dd, uint8_t num_iac, uint8_t *lap, int to);
|
||||
int hci_read_stored_link_key(int dd, bdaddr_t *bdaddr, uint8_t all, int to);
|
||||
int hci_write_stored_link_key(int dd, bdaddr_t *bdaddr, uint8_t *key, int to);
|
||||
int hci_delete_stored_link_key(int dd, bdaddr_t *bdaddr, uint8_t all, int to);
|
||||
int hci_authenticate_link(int dd, uint16_t handle, int to);
|
||||
int hci_encrypt_link(int dd, uint16_t handle, uint8_t encrypt, int to);
|
||||
int hci_change_link_key(int dd, uint16_t handle, int to);
|
||||
int hci_switch_role(int dd, bdaddr_t *bdaddr, uint8_t role, int to);
|
||||
int hci_park_mode(int dd, uint16_t handle, uint16_t max_interval, uint16_t min_interval, int to);
|
||||
int hci_exit_park_mode(int dd, uint16_t handle, int to);
|
||||
int hci_read_inquiry_scan_type(int dd, uint8_t *type, int to);
|
||||
int hci_write_inquiry_scan_type(int dd, uint8_t type, int to);
|
||||
int hci_read_inquiry_mode(int dd, uint8_t *mode, int to);
|
||||
int hci_write_inquiry_mode(int dd, uint8_t mode, int to);
|
||||
int hci_read_afh_mode(int dd, uint8_t *mode, int to);
|
||||
int hci_write_afh_mode(int dd, uint8_t mode, int to);
|
||||
int hci_read_ext_inquiry_response(int dd, uint8_t *fec, uint8_t *data, int to);
|
||||
int hci_write_ext_inquiry_response(int dd, uint8_t fec, uint8_t *data, int to);
|
||||
int hci_read_simple_pairing_mode(int dd, uint8_t *mode, int to);
|
||||
int hci_write_simple_pairing_mode(int dd, uint8_t mode, int to);
|
||||
int hci_read_local_oob_data(int dd, uint8_t *hash, uint8_t *randomizer, int to);
|
||||
int hci_read_inq_response_tx_power_level(int dd, int8_t *level, int to);
|
||||
int hci_read_inquiry_transmit_power_level(int dd, int8_t *level, int to);
|
||||
int hci_write_inquiry_transmit_power_level(int dd, int8_t level, int to);
|
||||
int hci_read_transmit_power_level(int dd, uint16_t handle, uint8_t type, int8_t *level, int to);
|
||||
int hci_read_link_policy(int dd, uint16_t handle, uint16_t *policy, int to);
|
||||
int hci_write_link_policy(int dd, uint16_t handle, uint16_t policy, int to);
|
||||
int hci_read_link_supervision_timeout(int dd, uint16_t handle, uint16_t *timeout, int to);
|
||||
int hci_write_link_supervision_timeout(int dd, uint16_t handle, uint16_t timeout, int to);
|
||||
int hci_set_afh_classification(int dd, uint8_t *map, int to);
|
||||
int hci_read_link_quality(int dd, uint16_t handle, uint8_t *link_quality, int to);
|
||||
int hci_read_rssi(int dd, uint16_t handle, int8_t *rssi, int to);
|
||||
int hci_read_afh_map(int dd, uint16_t handle, uint8_t *mode, uint8_t *map, int to);
|
||||
int hci_read_clock(int dd, uint16_t handle, uint8_t which, uint32_t *clock, uint16_t *accuracy, int to);
|
||||
|
||||
int hci_le_set_scan_enable(int dev_id, uint8_t enable, uint8_t filter_dup, int to);
|
||||
int hci_le_set_scan_parameters(int dev_id, uint8_t type, uint16_t interval,
|
||||
uint16_t window, uint8_t own_type,
|
||||
uint8_t filter, int to);
|
||||
int hci_le_set_advertise_enable(int dev_id, uint8_t enable, int to);
|
||||
int hci_le_create_conn(int dd, uint16_t interval, uint16_t window,
|
||||
uint8_t initiator_filter, uint8_t peer_bdaddr_type,
|
||||
bdaddr_t peer_bdaddr, uint8_t own_bdaddr_type,
|
||||
uint16_t min_interval, uint16_t max_interval,
|
||||
uint16_t latency, uint16_t supervision_timeout,
|
||||
uint16_t min_ce_length, uint16_t max_ce_length,
|
||||
uint16_t *handle, int to);
|
||||
int hci_le_conn_update(int dd, uint16_t handle, uint16_t min_interval,
|
||||
uint16_t max_interval, uint16_t latency,
|
||||
uint16_t supervision_timeout, int to);
|
||||
int hci_le_add_white_list(int dd, const bdaddr_t *bdaddr, uint8_t type, int to);
|
||||
int hci_le_rm_white_list(int dd, const bdaddr_t *bdaddr, uint8_t type, int to);
|
||||
int hci_le_read_white_list_size(int dd, uint8_t *size, int to);
|
||||
int hci_le_clear_white_list(int dd, int to);
|
||||
int hci_le_add_resolving_list(int dd, const bdaddr_t *bdaddr, uint8_t type,
|
||||
uint8_t *peer_irk, uint8_t *local_irk, int to);
|
||||
int hci_le_rm_resolving_list(int dd, const bdaddr_t *bdaddr, uint8_t type, int to);
|
||||
int hci_le_clear_resolving_list(int dd, int to);
|
||||
int hci_le_read_resolving_list_size(int dd, uint8_t *size, int to);
|
||||
int hci_le_set_address_resolution_enable(int dev_id, uint8_t enable, int to);
|
||||
int hci_le_read_remote_features(int dd, uint16_t handle, uint8_t *features, int to);
|
||||
|
||||
int hci_for_each_dev(int flag, int(*func)(int dd, int dev_id, long arg), long arg);
|
||||
int hci_get_route(bdaddr_t *bdaddr);
|
||||
|
||||
char *hci_bustostr(int bus);
|
||||
char *hci_typetostr(int type);
|
||||
char *hci_dtypetostr(int type);
|
||||
char *hci_dflagstostr(uint32_t flags);
|
||||
char *hci_ptypetostr(unsigned int ptype);
|
||||
int hci_strtoptype(char *str, unsigned int *val);
|
||||
char *hci_scoptypetostr(unsigned int ptype);
|
||||
int hci_strtoscoptype(char *str, unsigned int *val);
|
||||
char *hci_lptostr(unsigned int ptype);
|
||||
int hci_strtolp(char *str, unsigned int *val);
|
||||
char *hci_lmtostr(unsigned int ptype);
|
||||
int hci_strtolm(char *str, unsigned int *val);
|
||||
|
||||
char *hci_cmdtostr(unsigned int cmd);
|
||||
char *hci_commandstostr(uint8_t *commands, char *pref, int width);
|
||||
|
||||
char *hci_vertostr(unsigned int ver);
|
||||
int hci_strtover(char *str, unsigned int *ver);
|
||||
char *lmp_vertostr(unsigned int ver);
|
||||
int lmp_strtover(char *str, unsigned int *ver);
|
||||
char *pal_vertostr(unsigned int ver);
|
||||
int pal_strtover(char *str, unsigned int *ver);
|
||||
|
||||
char *lmp_featurestostr(uint8_t *features, char *pref, int width);
|
||||
|
||||
static inline void hci_set_bit(int nr, void *addr)
|
||||
{
|
||||
*((uint32_t *) addr + (nr >> 5)) |= (1 << (nr & 31));
|
||||
}
|
||||
|
||||
static inline void hci_clear_bit(int nr, void *addr)
|
||||
{
|
||||
*((uint32_t *) addr + (nr >> 5)) &= ~(1 << (nr & 31));
|
||||
}
|
||||
|
||||
static inline int hci_test_bit(int nr, void *addr)
|
||||
{
|
||||
return *((uint32_t *) addr + (nr >> 5)) & (1 << (nr & 31));
|
||||
}
|
||||
|
||||
/* HCI filter tools */
|
||||
static inline void hci_filter_clear(struct hci_filter *f)
|
||||
{
|
||||
memset(f, 0, sizeof(*f));
|
||||
}
|
||||
static inline void hci_filter_set_ptype(int t, struct hci_filter *f)
|
||||
{
|
||||
hci_set_bit((t == HCI_VENDOR_PKT) ? 0 : (t & HCI_FLT_TYPE_BITS), &f->type_mask);
|
||||
}
|
||||
static inline void hci_filter_clear_ptype(int t, struct hci_filter *f)
|
||||
{
|
||||
hci_clear_bit((t == HCI_VENDOR_PKT) ? 0 : (t & HCI_FLT_TYPE_BITS), &f->type_mask);
|
||||
}
|
||||
static inline int hci_filter_test_ptype(int t, struct hci_filter *f)
|
||||
{
|
||||
return hci_test_bit((t == HCI_VENDOR_PKT) ? 0 : (t & HCI_FLT_TYPE_BITS), &f->type_mask);
|
||||
}
|
||||
static inline void hci_filter_all_ptypes(struct hci_filter *f)
|
||||
{
|
||||
memset((void *) &f->type_mask, 0xff, sizeof(f->type_mask));
|
||||
}
|
||||
static inline void hci_filter_set_event(int e, struct hci_filter *f)
|
||||
{
|
||||
hci_set_bit((e & HCI_FLT_EVENT_BITS), &f->event_mask);
|
||||
}
|
||||
static inline void hci_filter_clear_event(int e, struct hci_filter *f)
|
||||
{
|
||||
hci_clear_bit((e & HCI_FLT_EVENT_BITS), &f->event_mask);
|
||||
}
|
||||
static inline int hci_filter_test_event(int e, struct hci_filter *f)
|
||||
{
|
||||
return hci_test_bit((e & HCI_FLT_EVENT_BITS), &f->event_mask);
|
||||
}
|
||||
static inline void hci_filter_all_events(struct hci_filter *f)
|
||||
{
|
||||
memset((void *) f->event_mask, 0xff, sizeof(f->event_mask));
|
||||
}
|
||||
static inline void hci_filter_set_opcode(int opcode, struct hci_filter *f)
|
||||
{
|
||||
f->opcode = opcode;
|
||||
}
|
||||
static inline void hci_filter_clear_opcode(struct hci_filter *f)
|
||||
{
|
||||
f->opcode = 0;
|
||||
}
|
||||
static inline int hci_filter_test_opcode(int opcode, struct hci_filter *f)
|
||||
{
|
||||
return (f->opcode == opcode);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __HCI_LIB_H */
|
|
@ -0,0 +1,72 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/*
|
||||
*
|
||||
* BlueZ - Bluetooth protocol stack for Linux
|
||||
*
|
||||
* Copyright (C) 2003-2010 Marcel Holtmann <marcel@holtmann.org>
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __HIDP_H
|
||||
#define __HIDP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* HIDP defaults */
|
||||
#define HIDP_MINIMUM_MTU 48
|
||||
#define HIDP_DEFAULT_MTU 48
|
||||
|
||||
/* HIDP ioctl defines */
|
||||
#define HIDPCONNADD _IOW('H', 200, int)
|
||||
#define HIDPCONNDEL _IOW('H', 201, int)
|
||||
#define HIDPGETCONNLIST _IOR('H', 210, int)
|
||||
#define HIDPGETCONNINFO _IOR('H', 211, int)
|
||||
|
||||
#define HIDP_VIRTUAL_CABLE_UNPLUG 0
|
||||
#define HIDP_BOOT_PROTOCOL_MODE 1
|
||||
#define HIDP_BLUETOOTH_VENDOR_ID 9
|
||||
|
||||
struct hidp_connadd_req {
|
||||
int ctrl_sock; /* Connected control socket */
|
||||
int intr_sock; /* Connected interrupt socket */
|
||||
uint16_t parser; /* Parser version */
|
||||
uint16_t rd_size; /* Report descriptor size */
|
||||
uint8_t *rd_data; /* Report descriptor data */
|
||||
uint8_t country;
|
||||
uint8_t subclass;
|
||||
uint16_t vendor;
|
||||
uint16_t product;
|
||||
uint16_t version;
|
||||
uint32_t flags;
|
||||
uint32_t idle_to;
|
||||
char name[128]; /* Device name */
|
||||
};
|
||||
|
||||
struct hidp_conndel_req {
|
||||
bdaddr_t bdaddr;
|
||||
uint32_t flags;
|
||||
};
|
||||
|
||||
struct hidp_conninfo {
|
||||
bdaddr_t bdaddr;
|
||||
uint32_t flags;
|
||||
uint16_t state;
|
||||
uint16_t vendor;
|
||||
uint16_t product;
|
||||
uint16_t version;
|
||||
char name[128];
|
||||
};
|
||||
|
||||
struct hidp_connlist_req {
|
||||
uint32_t cnum;
|
||||
struct hidp_conninfo *ci;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __HIDP_H */
|
|
@ -0,0 +1,266 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/*
|
||||
*
|
||||
* BlueZ - Bluetooth protocol stack for Linux
|
||||
*
|
||||
* Copyright (C) 2000-2001 Qualcomm Incorporated
|
||||
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
|
||||
* Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
|
||||
* Copyright (c) 2012 Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __L2CAP_H
|
||||
#define __L2CAP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <sys/socket.h>
|
||||
|
||||
/* L2CAP defaults */
|
||||
#define L2CAP_DEFAULT_MTU 672
|
||||
#define L2CAP_DEFAULT_FLUSH_TO 0xFFFF
|
||||
|
||||
/* L2CAP socket address */
|
||||
struct sockaddr_l2 {
|
||||
sa_family_t l2_family;
|
||||
unsigned short l2_psm;
|
||||
bdaddr_t l2_bdaddr;
|
||||
unsigned short l2_cid;
|
||||
uint8_t l2_bdaddr_type;
|
||||
};
|
||||
|
||||
/* L2CAP socket options */
|
||||
#define L2CAP_OPTIONS 0x01
|
||||
struct l2cap_options {
|
||||
uint16_t omtu;
|
||||
uint16_t imtu;
|
||||
uint16_t flush_to;
|
||||
uint8_t mode;
|
||||
uint8_t fcs;
|
||||
uint8_t max_tx;
|
||||
uint16_t txwin_size;
|
||||
};
|
||||
|
||||
#define L2CAP_CONNINFO 0x02
|
||||
struct l2cap_conninfo {
|
||||
uint16_t hci_handle;
|
||||
uint8_t dev_class[3];
|
||||
};
|
||||
|
||||
#define L2CAP_LM 0x03
|
||||
#define L2CAP_LM_MASTER 0x0001
|
||||
#define L2CAP_LM_AUTH 0x0002
|
||||
#define L2CAP_LM_ENCRYPT 0x0004
|
||||
#define L2CAP_LM_TRUSTED 0x0008
|
||||
#define L2CAP_LM_RELIABLE 0x0010
|
||||
#define L2CAP_LM_SECURE 0x0020
|
||||
|
||||
/* L2CAP command codes */
|
||||
#define L2CAP_COMMAND_REJ 0x01
|
||||
#define L2CAP_CONN_REQ 0x02
|
||||
#define L2CAP_CONN_RSP 0x03
|
||||
#define L2CAP_CONF_REQ 0x04
|
||||
#define L2CAP_CONF_RSP 0x05
|
||||
#define L2CAP_DISCONN_REQ 0x06
|
||||
#define L2CAP_DISCONN_RSP 0x07
|
||||
#define L2CAP_ECHO_REQ 0x08
|
||||
#define L2CAP_ECHO_RSP 0x09
|
||||
#define L2CAP_INFO_REQ 0x0a
|
||||
#define L2CAP_INFO_RSP 0x0b
|
||||
#define L2CAP_CREATE_REQ 0x0c
|
||||
#define L2CAP_CREATE_RSP 0x0d
|
||||
#define L2CAP_MOVE_REQ 0x0e
|
||||
#define L2CAP_MOVE_RSP 0x0f
|
||||
#define L2CAP_MOVE_CFM 0x10
|
||||
#define L2CAP_MOVE_CFM_RSP 0x11
|
||||
|
||||
/* L2CAP extended feature mask */
|
||||
#define L2CAP_FEAT_FLOWCTL 0x00000001
|
||||
#define L2CAP_FEAT_RETRANS 0x00000002
|
||||
#define L2CAP_FEAT_BIDIR_QOS 0x00000004
|
||||
#define L2CAP_FEAT_ERTM 0x00000008
|
||||
#define L2CAP_FEAT_STREAMING 0x00000010
|
||||
#define L2CAP_FEAT_FCS 0x00000020
|
||||
#define L2CAP_FEAT_EXT_FLOW 0x00000040
|
||||
#define L2CAP_FEAT_FIXED_CHAN 0x00000080
|
||||
#define L2CAP_FEAT_EXT_WINDOW 0x00000100
|
||||
#define L2CAP_FEAT_UCD 0x00000200
|
||||
|
||||
/* L2CAP fixed channels */
|
||||
#define L2CAP_FC_L2CAP 0x02
|
||||
#define L2CAP_FC_CONNLESS 0x04
|
||||
#define L2CAP_FC_A2MP 0x08
|
||||
|
||||
/* L2CAP structures */
|
||||
typedef struct {
|
||||
uint16_t len;
|
||||
uint16_t cid;
|
||||
} __attribute__ ((packed)) l2cap_hdr;
|
||||
#define L2CAP_HDR_SIZE 4
|
||||
|
||||
typedef struct {
|
||||
uint8_t code;
|
||||
uint8_t ident;
|
||||
uint16_t len;
|
||||
} __attribute__ ((packed)) l2cap_cmd_hdr;
|
||||
#define L2CAP_CMD_HDR_SIZE 4
|
||||
|
||||
typedef struct {
|
||||
uint16_t reason;
|
||||
} __attribute__ ((packed)) l2cap_cmd_rej;
|
||||
#define L2CAP_CMD_REJ_SIZE 2
|
||||
|
||||
typedef struct {
|
||||
uint16_t psm;
|
||||
uint16_t scid;
|
||||
} __attribute__ ((packed)) l2cap_conn_req;
|
||||
#define L2CAP_CONN_REQ_SIZE 4
|
||||
|
||||
typedef struct {
|
||||
uint16_t dcid;
|
||||
uint16_t scid;
|
||||
uint16_t result;
|
||||
uint16_t status;
|
||||
} __attribute__ ((packed)) l2cap_conn_rsp;
|
||||
#define L2CAP_CONN_RSP_SIZE 8
|
||||
|
||||
/* connect result */
|
||||
#define L2CAP_CR_SUCCESS 0x0000
|
||||
#define L2CAP_CR_PEND 0x0001
|
||||
#define L2CAP_CR_BAD_PSM 0x0002
|
||||
#define L2CAP_CR_SEC_BLOCK 0x0003
|
||||
#define L2CAP_CR_NO_MEM 0x0004
|
||||
|
||||
/* connect status */
|
||||
#define L2CAP_CS_NO_INFO 0x0000
|
||||
#define L2CAP_CS_AUTHEN_PEND 0x0001
|
||||
#define L2CAP_CS_AUTHOR_PEND 0x0002
|
||||
|
||||
typedef struct {
|
||||
uint16_t dcid;
|
||||
uint16_t flags;
|
||||
uint8_t data[0];
|
||||
} __attribute__ ((packed)) l2cap_conf_req;
|
||||
#define L2CAP_CONF_REQ_SIZE 4
|
||||
|
||||
typedef struct {
|
||||
uint16_t scid;
|
||||
uint16_t flags;
|
||||
uint16_t result;
|
||||
uint8_t data[0];
|
||||
} __attribute__ ((packed)) l2cap_conf_rsp;
|
||||
#define L2CAP_CONF_RSP_SIZE 6
|
||||
|
||||
#define L2CAP_CONF_SUCCESS 0x0000
|
||||
#define L2CAP_CONF_UNACCEPT 0x0001
|
||||
#define L2CAP_CONF_REJECT 0x0002
|
||||
#define L2CAP_CONF_UNKNOWN 0x0003
|
||||
#define L2CAP_CONF_PENDING 0x0004
|
||||
#define L2CAP_CONF_EFS_REJECT 0x0005
|
||||
|
||||
typedef struct {
|
||||
uint8_t type;
|
||||
uint8_t len;
|
||||
uint8_t val[0];
|
||||
} __attribute__ ((packed)) l2cap_conf_opt;
|
||||
#define L2CAP_CONF_OPT_SIZE 2
|
||||
|
||||
#define L2CAP_CONF_MTU 0x01
|
||||
#define L2CAP_CONF_FLUSH_TO 0x02
|
||||
#define L2CAP_CONF_QOS 0x03
|
||||
#define L2CAP_CONF_RFC 0x04
|
||||
#define L2CAP_CONF_FCS 0x05
|
||||
#define L2CAP_CONF_EFS 0x06
|
||||
#define L2CAP_CONF_EWS 0x07
|
||||
|
||||
#define L2CAP_CONF_MAX_SIZE 22
|
||||
|
||||
#define L2CAP_MODE_BASIC 0x00
|
||||
#define L2CAP_MODE_RETRANS 0x01
|
||||
#define L2CAP_MODE_FLOWCTL 0x02
|
||||
#define L2CAP_MODE_ERTM 0x03
|
||||
#define L2CAP_MODE_STREAMING 0x04
|
||||
|
||||
#define L2CAP_SERVTYPE_NOTRAFFIC 0x00
|
||||
#define L2CAP_SERVTYPE_BESTEFFORT 0x01
|
||||
#define L2CAP_SERVTYPE_GUARANTEED 0x02
|
||||
|
||||
typedef struct {
|
||||
uint16_t dcid;
|
||||
uint16_t scid;
|
||||
} __attribute__ ((packed)) l2cap_disconn_req;
|
||||
#define L2CAP_DISCONN_REQ_SIZE 4
|
||||
|
||||
typedef struct {
|
||||
uint16_t dcid;
|
||||
uint16_t scid;
|
||||
} __attribute__ ((packed)) l2cap_disconn_rsp;
|
||||
#define L2CAP_DISCONN_RSP_SIZE 4
|
||||
|
||||
typedef struct {
|
||||
uint16_t type;
|
||||
} __attribute__ ((packed)) l2cap_info_req;
|
||||
#define L2CAP_INFO_REQ_SIZE 2
|
||||
|
||||
typedef struct {
|
||||
uint16_t type;
|
||||
uint16_t result;
|
||||
uint8_t data[0];
|
||||
} __attribute__ ((packed)) l2cap_info_rsp;
|
||||
#define L2CAP_INFO_RSP_SIZE 4
|
||||
|
||||
/* info type */
|
||||
#define L2CAP_IT_CL_MTU 0x0001
|
||||
#define L2CAP_IT_FEAT_MASK 0x0002
|
||||
|
||||
/* info result */
|
||||
#define L2CAP_IR_SUCCESS 0x0000
|
||||
#define L2CAP_IR_NOTSUPP 0x0001
|
||||
|
||||
typedef struct {
|
||||
uint16_t psm;
|
||||
uint16_t scid;
|
||||
uint8_t id;
|
||||
} __attribute__ ((packed)) l2cap_create_req;
|
||||
#define L2CAP_CREATE_REQ_SIZE 5
|
||||
|
||||
typedef struct {
|
||||
uint16_t dcid;
|
||||
uint16_t scid;
|
||||
uint16_t result;
|
||||
uint16_t status;
|
||||
} __attribute__ ((packed)) l2cap_create_rsp;
|
||||
#define L2CAP_CREATE_RSP_SIZE 8
|
||||
|
||||
typedef struct {
|
||||
uint16_t icid;
|
||||
uint8_t id;
|
||||
} __attribute__ ((packed)) l2cap_move_req;
|
||||
#define L2CAP_MOVE_REQ_SIZE 3
|
||||
|
||||
typedef struct {
|
||||
uint16_t icid;
|
||||
uint16_t result;
|
||||
} __attribute__ ((packed)) l2cap_move_rsp;
|
||||
#define L2CAP_MOVE_RSP_SIZE 4
|
||||
|
||||
typedef struct {
|
||||
uint16_t icid;
|
||||
uint16_t result;
|
||||
} __attribute__ ((packed)) l2cap_move_cfm;
|
||||
#define L2CAP_MOVE_CFM_SIZE 4
|
||||
|
||||
typedef struct {
|
||||
uint16_t icid;
|
||||
} __attribute__ ((packed)) l2cap_move_cfm_rsp;
|
||||
#define L2CAP_MOVE_CFM_RSP_SIZE 2
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __L2CAP_H */
|
|
@ -0,0 +1,86 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/*
|
||||
*
|
||||
* BlueZ - Bluetooth protocol stack for Linux
|
||||
*
|
||||
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
|
||||
* Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __RFCOMM_H
|
||||
#define __RFCOMM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <sys/socket.h>
|
||||
|
||||
/* RFCOMM defaults */
|
||||
#define RFCOMM_DEFAULT_MTU 127
|
||||
|
||||
#define RFCOMM_PSM 3
|
||||
|
||||
/* RFCOMM socket address */
|
||||
struct sockaddr_rc {
|
||||
sa_family_t rc_family;
|
||||
bdaddr_t rc_bdaddr;
|
||||
uint8_t rc_channel;
|
||||
};
|
||||
|
||||
/* RFCOMM socket options */
|
||||
#define RFCOMM_CONNINFO 0x02
|
||||
struct rfcomm_conninfo {
|
||||
uint16_t hci_handle;
|
||||
uint8_t dev_class[3];
|
||||
};
|
||||
|
||||
#define RFCOMM_LM 0x03
|
||||
#define RFCOMM_LM_MASTER 0x0001
|
||||
#define RFCOMM_LM_AUTH 0x0002
|
||||
#define RFCOMM_LM_ENCRYPT 0x0004
|
||||
#define RFCOMM_LM_TRUSTED 0x0008
|
||||
#define RFCOMM_LM_RELIABLE 0x0010
|
||||
#define RFCOMM_LM_SECURE 0x0020
|
||||
|
||||
/* RFCOMM TTY support */
|
||||
#define RFCOMM_MAX_DEV 256
|
||||
|
||||
#define RFCOMMCREATEDEV _IOW('R', 200, int)
|
||||
#define RFCOMMRELEASEDEV _IOW('R', 201, int)
|
||||
#define RFCOMMGETDEVLIST _IOR('R', 210, int)
|
||||
#define RFCOMMGETDEVINFO _IOR('R', 211, int)
|
||||
|
||||
struct rfcomm_dev_req {
|
||||
int16_t dev_id;
|
||||
uint32_t flags;
|
||||
bdaddr_t src;
|
||||
bdaddr_t dst;
|
||||
uint8_t channel;
|
||||
};
|
||||
#define RFCOMM_REUSE_DLC 0
|
||||
#define RFCOMM_RELEASE_ONHUP 1
|
||||
#define RFCOMM_HANGUP_NOW 2
|
||||
#define RFCOMM_TTY_ATTACHED 3
|
||||
|
||||
struct rfcomm_dev_info {
|
||||
int16_t id;
|
||||
uint32_t flags;
|
||||
uint16_t state;
|
||||
bdaddr_t src;
|
||||
bdaddr_t dst;
|
||||
uint8_t channel;
|
||||
};
|
||||
|
||||
struct rfcomm_dev_list_req {
|
||||
uint16_t dev_num;
|
||||
struct rfcomm_dev_info dev_info[0];
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __RFCOMM_H */
|
|
@ -0,0 +1,49 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/*
|
||||
*
|
||||
* BlueZ - Bluetooth protocol stack for Linux
|
||||
*
|
||||
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
|
||||
* Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __SCO_H
|
||||
#define __SCO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* SCO defaults */
|
||||
#define SCO_DEFAULT_MTU 500
|
||||
#define SCO_DEFAULT_FLUSH_TO 0xFFFF
|
||||
|
||||
#define SCO_CONN_TIMEOUT (HZ * 40)
|
||||
#define SCO_DISCONN_TIMEOUT (HZ * 2)
|
||||
#define SCO_CONN_IDLE_TIMEOUT (HZ * 60)
|
||||
|
||||
/* SCO socket address */
|
||||
struct sockaddr_sco {
|
||||
sa_family_t sco_family;
|
||||
bdaddr_t sco_bdaddr;
|
||||
};
|
||||
|
||||
/* set/get sockopt defines */
|
||||
#define SCO_OPTIONS 0x01
|
||||
struct sco_options {
|
||||
uint16_t mtu;
|
||||
};
|
||||
|
||||
#define SCO_CONNINFO 0x02
|
||||
struct sco_conninfo {
|
||||
uint16_t hci_handle;
|
||||
uint8_t dev_class[3];
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __SCO_H */
|
|
@ -0,0 +1,529 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/*
|
||||
*
|
||||
* BlueZ - Bluetooth protocol stack for Linux
|
||||
*
|
||||
* Copyright (C) 2001-2002 Nokia Corporation
|
||||
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
|
||||
* Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
|
||||
* Copyright (C) 2002-2003 Stephen Crane <steve.crane@rococosoft.com>
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __SDP_H
|
||||
#define __SDP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
|
||||
#define SDP_UNIX_PATH "/var/run/sdp"
|
||||
#define SDP_RESPONSE_TIMEOUT 20
|
||||
#define SDP_REQ_BUFFER_SIZE 2048
|
||||
#define SDP_RSP_BUFFER_SIZE 65535
|
||||
#define SDP_PDU_CHUNK_SIZE 1024
|
||||
|
||||
/*
|
||||
* All definitions are based on Bluetooth Assigned Numbers
|
||||
* of the Bluetooth Specification
|
||||
*/
|
||||
#define SDP_PSM 0x0001
|
||||
|
||||
/*
|
||||
* Protocol UUIDs
|
||||
*/
|
||||
#define SDP_UUID 0x0001
|
||||
#define UDP_UUID 0x0002
|
||||
#define RFCOMM_UUID 0x0003
|
||||
#define TCP_UUID 0x0004
|
||||
#define TCS_BIN_UUID 0x0005
|
||||
#define TCS_AT_UUID 0x0006
|
||||
#define ATT_UUID 0x0007
|
||||
#define OBEX_UUID 0x0008
|
||||
#define IP_UUID 0x0009
|
||||
#define FTP_UUID 0x000a
|
||||
#define HTTP_UUID 0x000c
|
||||
#define WSP_UUID 0x000e
|
||||
#define BNEP_UUID 0x000f
|
||||
#define UPNP_UUID 0x0010
|
||||
#define HIDP_UUID 0x0011
|
||||
#define HCRP_CTRL_UUID 0x0012
|
||||
#define HCRP_DATA_UUID 0x0014
|
||||
#define HCRP_NOTE_UUID 0x0016
|
||||
#define AVCTP_UUID 0x0017
|
||||
#define AVDTP_UUID 0x0019
|
||||
#define CMTP_UUID 0x001b
|
||||
#define UDI_UUID 0x001d
|
||||
#define MCAP_CTRL_UUID 0x001e
|
||||
#define MCAP_DATA_UUID 0x001f
|
||||
#define L2CAP_UUID 0x0100
|
||||
|
||||
/*
|
||||
* Service class identifiers of standard services and service groups
|
||||
*/
|
||||
#define SDP_SERVER_SVCLASS_ID 0x1000
|
||||
#define BROWSE_GRP_DESC_SVCLASS_ID 0x1001
|
||||
#define PUBLIC_BROWSE_GROUP 0x1002
|
||||
#define SERIAL_PORT_SVCLASS_ID 0x1101
|
||||
#define LAN_ACCESS_SVCLASS_ID 0x1102
|
||||
#define DIALUP_NET_SVCLASS_ID 0x1103
|
||||
#define IRMC_SYNC_SVCLASS_ID 0x1104
|
||||
#define OBEX_OBJPUSH_SVCLASS_ID 0x1105
|
||||
#define OBEX_FILETRANS_SVCLASS_ID 0x1106
|
||||
#define IRMC_SYNC_CMD_SVCLASS_ID 0x1107
|
||||
#define HEADSET_SVCLASS_ID 0x1108
|
||||
#define CORDLESS_TELEPHONY_SVCLASS_ID 0x1109
|
||||
#define AUDIO_SOURCE_SVCLASS_ID 0x110a
|
||||
#define AUDIO_SINK_SVCLASS_ID 0x110b
|
||||
#define AV_REMOTE_TARGET_SVCLASS_ID 0x110c
|
||||
#define ADVANCED_AUDIO_SVCLASS_ID 0x110d
|
||||
#define AV_REMOTE_SVCLASS_ID 0x110e
|
||||
#define AV_REMOTE_CONTROLLER_SVCLASS_ID 0x110f
|
||||
#define INTERCOM_SVCLASS_ID 0x1110
|
||||
#define FAX_SVCLASS_ID 0x1111
|
||||
#define HEADSET_AGW_SVCLASS_ID 0x1112
|
||||
#define WAP_SVCLASS_ID 0x1113
|
||||
#define WAP_CLIENT_SVCLASS_ID 0x1114
|
||||
#define PANU_SVCLASS_ID 0x1115
|
||||
#define NAP_SVCLASS_ID 0x1116
|
||||
#define GN_SVCLASS_ID 0x1117
|
||||
#define DIRECT_PRINTING_SVCLASS_ID 0x1118
|
||||
#define REFERENCE_PRINTING_SVCLASS_ID 0x1119
|
||||
#define IMAGING_SVCLASS_ID 0x111a
|
||||
#define IMAGING_RESPONDER_SVCLASS_ID 0x111b
|
||||
#define IMAGING_ARCHIVE_SVCLASS_ID 0x111c
|
||||
#define IMAGING_REFOBJS_SVCLASS_ID 0x111d
|
||||
#define HANDSFREE_SVCLASS_ID 0x111e
|
||||
#define HANDSFREE_AGW_SVCLASS_ID 0x111f
|
||||
#define DIRECT_PRT_REFOBJS_SVCLASS_ID 0x1120
|
||||
#define REFLECTED_UI_SVCLASS_ID 0x1121
|
||||
#define BASIC_PRINTING_SVCLASS_ID 0x1122
|
||||
#define PRINTING_STATUS_SVCLASS_ID 0x1123
|
||||
#define HID_SVCLASS_ID 0x1124
|
||||
#define HCR_SVCLASS_ID 0x1125
|
||||
#define HCR_PRINT_SVCLASS_ID 0x1126
|
||||
#define HCR_SCAN_SVCLASS_ID 0x1127
|
||||
#define CIP_SVCLASS_ID 0x1128
|
||||
#define VIDEO_CONF_GW_SVCLASS_ID 0x1129
|
||||
#define UDI_MT_SVCLASS_ID 0x112a
|
||||
#define UDI_TA_SVCLASS_ID 0x112b
|
||||
#define AV_SVCLASS_ID 0x112c
|
||||
#define SAP_SVCLASS_ID 0x112d
|
||||
#define PBAP_PCE_SVCLASS_ID 0x112e
|
||||
#define PBAP_PSE_SVCLASS_ID 0x112f
|
||||
#define PBAP_SVCLASS_ID 0x1130
|
||||
#define MAP_MSE_SVCLASS_ID 0x1132
|
||||
#define MAP_MCE_SVCLASS_ID 0x1133
|
||||
#define MAP_SVCLASS_ID 0x1134
|
||||
#define GNSS_SVCLASS_ID 0x1135
|
||||
#define GNSS_SERVER_SVCLASS_ID 0x1136
|
||||
#define MPS_SC_SVCLASS_ID 0x113A
|
||||
#define MPS_SVCLASS_ID 0x113B
|
||||
#define PNP_INFO_SVCLASS_ID 0x1200
|
||||
#define GENERIC_NETWORKING_SVCLASS_ID 0x1201
|
||||
#define GENERIC_FILETRANS_SVCLASS_ID 0x1202
|
||||
#define GENERIC_AUDIO_SVCLASS_ID 0x1203
|
||||
#define GENERIC_TELEPHONY_SVCLASS_ID 0x1204
|
||||
#define UPNP_SVCLASS_ID 0x1205
|
||||
#define UPNP_IP_SVCLASS_ID 0x1206
|
||||
#define UPNP_PAN_SVCLASS_ID 0x1300
|
||||
#define UPNP_LAP_SVCLASS_ID 0x1301
|
||||
#define UPNP_L2CAP_SVCLASS_ID 0x1302
|
||||
#define VIDEO_SOURCE_SVCLASS_ID 0x1303
|
||||
#define VIDEO_SINK_SVCLASS_ID 0x1304
|
||||
#define VIDEO_DISTRIBUTION_SVCLASS_ID 0x1305
|
||||
#define HDP_SVCLASS_ID 0x1400
|
||||
#define HDP_SOURCE_SVCLASS_ID 0x1401
|
||||
#define HDP_SINK_SVCLASS_ID 0x1402
|
||||
#define GENERIC_ACCESS_SVCLASS_ID 0x1800
|
||||
#define GENERIC_ATTRIB_SVCLASS_ID 0x1801
|
||||
#define APPLE_AGENT_SVCLASS_ID 0x2112
|
||||
|
||||
/*
|
||||
* Standard profile descriptor identifiers; note these
|
||||
* may be identical to some of the service classes defined above
|
||||
*/
|
||||
#define SDP_SERVER_PROFILE_ID SDP_SERVER_SVCLASS_ID
|
||||
#define BROWSE_GRP_DESC_PROFILE_ID BROWSE_GRP_DESC_SVCLASS_ID
|
||||
#define SERIAL_PORT_PROFILE_ID SERIAL_PORT_SVCLASS_ID
|
||||
#define LAN_ACCESS_PROFILE_ID LAN_ACCESS_SVCLASS_ID
|
||||
#define DIALUP_NET_PROFILE_ID DIALUP_NET_SVCLASS_ID
|
||||
#define IRMC_SYNC_PROFILE_ID IRMC_SYNC_SVCLASS_ID
|
||||
#define OBEX_OBJPUSH_PROFILE_ID OBEX_OBJPUSH_SVCLASS_ID
|
||||
#define OBEX_FILETRANS_PROFILE_ID OBEX_FILETRANS_SVCLASS_ID
|
||||
#define IRMC_SYNC_CMD_PROFILE_ID IRMC_SYNC_CMD_SVCLASS_ID
|
||||
#define HEADSET_PROFILE_ID HEADSET_SVCLASS_ID
|
||||
#define CORDLESS_TELEPHONY_PROFILE_ID CORDLESS_TELEPHONY_SVCLASS_ID
|
||||
#define AUDIO_SOURCE_PROFILE_ID AUDIO_SOURCE_SVCLASS_ID
|
||||
#define AUDIO_SINK_PROFILE_ID AUDIO_SINK_SVCLASS_ID
|
||||
#define AV_REMOTE_TARGET_PROFILE_ID AV_REMOTE_TARGET_SVCLASS_ID
|
||||
#define ADVANCED_AUDIO_PROFILE_ID ADVANCED_AUDIO_SVCLASS_ID
|
||||
#define AV_REMOTE_PROFILE_ID AV_REMOTE_SVCLASS_ID
|
||||
#define INTERCOM_PROFILE_ID INTERCOM_SVCLASS_ID
|
||||
#define FAX_PROFILE_ID FAX_SVCLASS_ID
|
||||
#define HEADSET_AGW_PROFILE_ID HEADSET_AGW_SVCLASS_ID
|
||||
#define WAP_PROFILE_ID WAP_SVCLASS_ID
|
||||
#define WAP_CLIENT_PROFILE_ID WAP_CLIENT_SVCLASS_ID
|
||||
#define PANU_PROFILE_ID PANU_SVCLASS_ID
|
||||
#define NAP_PROFILE_ID NAP_SVCLASS_ID
|
||||
#define GN_PROFILE_ID GN_SVCLASS_ID
|
||||
#define DIRECT_PRINTING_PROFILE_ID DIRECT_PRINTING_SVCLASS_ID
|
||||
#define REFERENCE_PRINTING_PROFILE_ID REFERENCE_PRINTING_SVCLASS_ID
|
||||
#define IMAGING_PROFILE_ID IMAGING_SVCLASS_ID
|
||||
#define IMAGING_RESPONDER_PROFILE_ID IMAGING_RESPONDER_SVCLASS_ID
|
||||
#define IMAGING_ARCHIVE_PROFILE_ID IMAGING_ARCHIVE_SVCLASS_ID
|
||||
#define IMAGING_REFOBJS_PROFILE_ID IMAGING_REFOBJS_SVCLASS_ID
|
||||
#define HANDSFREE_PROFILE_ID HANDSFREE_SVCLASS_ID
|
||||
#define HANDSFREE_AGW_PROFILE_ID HANDSFREE_AGW_SVCLASS_ID
|
||||
#define DIRECT_PRT_REFOBJS_PROFILE_ID DIRECT_PRT_REFOBJS_SVCLASS_ID
|
||||
#define REFLECTED_UI_PROFILE_ID REFLECTED_UI_SVCLASS_ID
|
||||
#define BASIC_PRINTING_PROFILE_ID BASIC_PRINTING_SVCLASS_ID
|
||||
#define PRINTING_STATUS_PROFILE_ID PRINTING_STATUS_SVCLASS_ID
|
||||
#define HID_PROFILE_ID HID_SVCLASS_ID
|
||||
#define HCR_PROFILE_ID HCR_SCAN_SVCLASS_ID
|
||||
#define HCR_PRINT_PROFILE_ID HCR_PRINT_SVCLASS_ID
|
||||
#define HCR_SCAN_PROFILE_ID HCR_SCAN_SVCLASS_ID
|
||||
#define CIP_PROFILE_ID CIP_SVCLASS_ID
|
||||
#define VIDEO_CONF_GW_PROFILE_ID VIDEO_CONF_GW_SVCLASS_ID
|
||||
#define UDI_MT_PROFILE_ID UDI_MT_SVCLASS_ID
|
||||
#define UDI_TA_PROFILE_ID UDI_TA_SVCLASS_ID
|
||||
#define AV_PROFILE_ID AV_SVCLASS_ID
|
||||
#define SAP_PROFILE_ID SAP_SVCLASS_ID
|
||||
#define PBAP_PCE_PROFILE_ID PBAP_PCE_SVCLASS_ID
|
||||
#define PBAP_PSE_PROFILE_ID PBAP_PSE_SVCLASS_ID
|
||||
#define PBAP_PROFILE_ID PBAP_SVCLASS_ID
|
||||
#define MAP_PROFILE_ID MAP_SVCLASS_ID
|
||||
#define PNP_INFO_PROFILE_ID PNP_INFO_SVCLASS_ID
|
||||
#define GENERIC_NETWORKING_PROFILE_ID GENERIC_NETWORKING_SVCLASS_ID
|
||||
#define GENERIC_FILETRANS_PROFILE_ID GENERIC_FILETRANS_SVCLASS_ID
|
||||
#define GENERIC_AUDIO_PROFILE_ID GENERIC_AUDIO_SVCLASS_ID
|
||||
#define GENERIC_TELEPHONY_PROFILE_ID GENERIC_TELEPHONY_SVCLASS_ID
|
||||
#define UPNP_PROFILE_ID UPNP_SVCLASS_ID
|
||||
#define UPNP_IP_PROFILE_ID UPNP_IP_SVCLASS_ID
|
||||
#define UPNP_PAN_PROFILE_ID UPNP_PAN_SVCLASS_ID
|
||||
#define UPNP_LAP_PROFILE_ID UPNP_LAP_SVCLASS_ID
|
||||
#define UPNP_L2CAP_PROFILE_ID UPNP_L2CAP_SVCLASS_ID
|
||||
#define VIDEO_SOURCE_PROFILE_ID VIDEO_SOURCE_SVCLASS_ID
|
||||
#define VIDEO_SINK_PROFILE_ID VIDEO_SINK_SVCLASS_ID
|
||||
#define VIDEO_DISTRIBUTION_PROFILE_ID VIDEO_DISTRIBUTION_SVCLASS_ID
|
||||
#define HDP_PROFILE_ID HDP_SVCLASS_ID
|
||||
#define HDP_SOURCE_PROFILE_ID HDP_SOURCE_SVCLASS_ID
|
||||
#define HDP_SINK_PROFILE_ID HDP_SINK_SVCLASS_ID
|
||||
#define GENERIC_ACCESS_PROFILE_ID GENERIC_ACCESS_SVCLASS_ID
|
||||
#define GENERIC_ATTRIB_PROFILE_ID GENERIC_ATTRIB_SVCLASS_ID
|
||||
#define APPLE_AGENT_PROFILE_ID APPLE_AGENT_SVCLASS_ID
|
||||
#define MPS_PROFILE_ID MPS_SC_SVCLASS_ID
|
||||
|
||||
/*
|
||||
* Compatibility macros for the old MDP acronym
|
||||
*/
|
||||
#define MDP_SVCLASS_ID HDP_SVCLASS_ID
|
||||
#define MDP_SOURCE_SVCLASS_ID HDP_SOURCE_SVCLASS_ID
|
||||
#define MDP_SINK_SVCLASS_ID HDP_SINK_SVCLASS_ID
|
||||
#define MDP_PROFILE_ID HDP_PROFILE_ID
|
||||
#define MDP_SOURCE_PROFILE_ID HDP_SOURCE_PROFILE_ID
|
||||
#define MDP_SINK_PROFILE_ID HDP_SINK_PROFILE_ID
|
||||
|
||||
/*
|
||||
* Attribute identifier codes
|
||||
*/
|
||||
#define SDP_SERVER_RECORD_HANDLE 0x0000
|
||||
|
||||
/*
|
||||
* Possible values for attribute-id are listed below.
|
||||
* See SDP Spec, section "Service Attribute Definitions" for more details.
|
||||
*/
|
||||
#define SDP_ATTR_RECORD_HANDLE 0x0000
|
||||
#define SDP_ATTR_SVCLASS_ID_LIST 0x0001
|
||||
#define SDP_ATTR_RECORD_STATE 0x0002
|
||||
#define SDP_ATTR_SERVICE_ID 0x0003
|
||||
#define SDP_ATTR_PROTO_DESC_LIST 0x0004
|
||||
#define SDP_ATTR_BROWSE_GRP_LIST 0x0005
|
||||
#define SDP_ATTR_LANG_BASE_ATTR_ID_LIST 0x0006
|
||||
#define SDP_ATTR_SVCINFO_TTL 0x0007
|
||||
#define SDP_ATTR_SERVICE_AVAILABILITY 0x0008
|
||||
#define SDP_ATTR_PFILE_DESC_LIST 0x0009
|
||||
#define SDP_ATTR_DOC_URL 0x000a
|
||||
#define SDP_ATTR_CLNT_EXEC_URL 0x000b
|
||||
#define SDP_ATTR_ICON_URL 0x000c
|
||||
#define SDP_ATTR_ADD_PROTO_DESC_LIST 0x000d
|
||||
|
||||
#define SDP_ATTR_GROUP_ID 0x0200
|
||||
#define SDP_ATTR_IP_SUBNET 0x0200
|
||||
#define SDP_ATTR_VERSION_NUM_LIST 0x0200
|
||||
#define SDP_ATTR_SUPPORTED_FEATURES_LIST 0x0200
|
||||
#define SDP_ATTR_GOEP_L2CAP_PSM 0x0200
|
||||
#define SDP_ATTR_SVCDB_STATE 0x0201
|
||||
|
||||
#define SDP_ATTR_MPSD_SCENARIOS 0x0200
|
||||
#define SDP_ATTR_MPMD_SCENARIOS 0x0201
|
||||
#define SDP_ATTR_MPS_DEPENDENCIES 0x0202
|
||||
|
||||
#define SDP_ATTR_SERVICE_VERSION 0x0300
|
||||
#define SDP_ATTR_EXTERNAL_NETWORK 0x0301
|
||||
#define SDP_ATTR_SUPPORTED_DATA_STORES_LIST 0x0301
|
||||
#define SDP_ATTR_DATA_EXCHANGE_SPEC 0x0301
|
||||
#define SDP_ATTR_NETWORK 0x0301
|
||||
#define SDP_ATTR_FAX_CLASS1_SUPPORT 0x0302
|
||||
#define SDP_ATTR_REMOTE_AUDIO_VOLUME_CONTROL 0x0302
|
||||
#define SDP_ATTR_MCAP_SUPPORTED_PROCEDURES 0x0302
|
||||
#define SDP_ATTR_FAX_CLASS20_SUPPORT 0x0303
|
||||
#define SDP_ATTR_SUPPORTED_FORMATS_LIST 0x0303
|
||||
#define SDP_ATTR_FAX_CLASS2_SUPPORT 0x0304
|
||||
#define SDP_ATTR_AUDIO_FEEDBACK_SUPPORT 0x0305
|
||||
#define SDP_ATTR_NETWORK_ADDRESS 0x0306
|
||||
#define SDP_ATTR_WAP_GATEWAY 0x0307
|
||||
#define SDP_ATTR_HOMEPAGE_URL 0x0308
|
||||
#define SDP_ATTR_WAP_STACK_TYPE 0x0309
|
||||
#define SDP_ATTR_SECURITY_DESC 0x030a
|
||||
#define SDP_ATTR_NET_ACCESS_TYPE 0x030b
|
||||
#define SDP_ATTR_MAX_NET_ACCESSRATE 0x030c
|
||||
#define SDP_ATTR_IP4_SUBNET 0x030d
|
||||
#define SDP_ATTR_IP6_SUBNET 0x030e
|
||||
#define SDP_ATTR_SUPPORTED_CAPABILITIES 0x0310
|
||||
#define SDP_ATTR_SUPPORTED_FEATURES 0x0311
|
||||
#define SDP_ATTR_SUPPORTED_FUNCTIONS 0x0312
|
||||
#define SDP_ATTR_TOTAL_IMAGING_DATA_CAPACITY 0x0313
|
||||
#define SDP_ATTR_SUPPORTED_REPOSITORIES 0x0314
|
||||
#define SDP_ATTR_MAS_INSTANCE_ID 0x0315
|
||||
#define SDP_ATTR_SUPPORTED_MESSAGE_TYPES 0x0316
|
||||
#define SDP_ATTR_PBAP_SUPPORTED_FEATURES 0x0317
|
||||
#define SDP_ATTR_MAP_SUPPORTED_FEATURES 0x0317
|
||||
|
||||
#define SDP_ATTR_SPECIFICATION_ID 0x0200
|
||||
#define SDP_ATTR_VENDOR_ID 0x0201
|
||||
#define SDP_ATTR_PRODUCT_ID 0x0202
|
||||
#define SDP_ATTR_VERSION 0x0203
|
||||
#define SDP_ATTR_PRIMARY_RECORD 0x0204
|
||||
#define SDP_ATTR_VENDOR_ID_SOURCE 0x0205
|
||||
|
||||
#define SDP_ATTR_HID_DEVICE_RELEASE_NUMBER 0x0200
|
||||
#define SDP_ATTR_HID_PARSER_VERSION 0x0201
|
||||
#define SDP_ATTR_HID_DEVICE_SUBCLASS 0x0202
|
||||
#define SDP_ATTR_HID_COUNTRY_CODE 0x0203
|
||||
#define SDP_ATTR_HID_VIRTUAL_CABLE 0x0204
|
||||
#define SDP_ATTR_HID_RECONNECT_INITIATE 0x0205
|
||||
#define SDP_ATTR_HID_DESCRIPTOR_LIST 0x0206
|
||||
#define SDP_ATTR_HID_LANG_ID_BASE_LIST 0x0207
|
||||
#define SDP_ATTR_HID_SDP_DISABLE 0x0208
|
||||
#define SDP_ATTR_HID_BATTERY_POWER 0x0209
|
||||
#define SDP_ATTR_HID_REMOTE_WAKEUP 0x020a
|
||||
#define SDP_ATTR_HID_PROFILE_VERSION 0x020b
|
||||
#define SDP_ATTR_HID_SUPERVISION_TIMEOUT 0x020c
|
||||
#define SDP_ATTR_HID_NORMALLY_CONNECTABLE 0x020d
|
||||
#define SDP_ATTR_HID_BOOT_DEVICE 0x020e
|
||||
|
||||
/*
|
||||
* These identifiers are based on the SDP spec stating that
|
||||
* "base attribute id of the primary (universal) language must be 0x0100"
|
||||
*
|
||||
* Other languages should have their own offset; e.g.:
|
||||
* #define XXXLangBase yyyy
|
||||
* #define AttrServiceName_XXX 0x0000+XXXLangBase
|
||||
*/
|
||||
#define SDP_PRIMARY_LANG_BASE 0x0100
|
||||
|
||||
#define SDP_ATTR_SVCNAME_PRIMARY 0x0000 + SDP_PRIMARY_LANG_BASE
|
||||
#define SDP_ATTR_SVCDESC_PRIMARY 0x0001 + SDP_PRIMARY_LANG_BASE
|
||||
#define SDP_ATTR_PROVNAME_PRIMARY 0x0002 + SDP_PRIMARY_LANG_BASE
|
||||
|
||||
/*
|
||||
* The Data representation in SDP PDUs (pps 339, 340 of BT SDP Spec)
|
||||
* These are the exact data type+size descriptor values
|
||||
* that go into the PDU buffer.
|
||||
*
|
||||
* The datatype (leading 5bits) + size descriptor (last 3 bits)
|
||||
* is 8 bits. The size descriptor is critical to extract the
|
||||
* right number of bytes for the data value from the PDU.
|
||||
*
|
||||
* For most basic types, the datatype+size descriptor is
|
||||
* straightforward. However for constructed types and strings,
|
||||
* the size of the data is in the next "n" bytes following the
|
||||
* 8 bits (datatype+size) descriptor. Exactly what the "n" is
|
||||
* specified in the 3 bits of the data size descriptor.
|
||||
*
|
||||
* TextString and URLString can be of size 2^{8, 16, 32} bytes
|
||||
* DataSequence and DataSequenceAlternates can be of size 2^{8, 16, 32}
|
||||
* The size are computed post-facto in the API and are not known apriori
|
||||
*/
|
||||
#define SDP_DATA_NIL 0x00
|
||||
#define SDP_UINT8 0x08
|
||||
#define SDP_UINT16 0x09
|
||||
#define SDP_UINT32 0x0A
|
||||
#define SDP_UINT64 0x0B
|
||||
#define SDP_UINT128 0x0C
|
||||
#define SDP_INT8 0x10
|
||||
#define SDP_INT16 0x11
|
||||
#define SDP_INT32 0x12
|
||||
#define SDP_INT64 0x13
|
||||
#define SDP_INT128 0x14
|
||||
#define SDP_UUID_UNSPEC 0x18
|
||||
#define SDP_UUID16 0x19
|
||||
#define SDP_UUID32 0x1A
|
||||
#define SDP_UUID128 0x1C
|
||||
#define SDP_TEXT_STR_UNSPEC 0x20
|
||||
#define SDP_TEXT_STR8 0x25
|
||||
#define SDP_TEXT_STR16 0x26
|
||||
#define SDP_TEXT_STR32 0x27
|
||||
#define SDP_BOOL 0x28
|
||||
#define SDP_SEQ_UNSPEC 0x30
|
||||
#define SDP_SEQ8 0x35
|
||||
#define SDP_SEQ16 0x36
|
||||
#define SDP_SEQ32 0x37
|
||||
#define SDP_ALT_UNSPEC 0x38
|
||||
#define SDP_ALT8 0x3D
|
||||
#define SDP_ALT16 0x3E
|
||||
#define SDP_ALT32 0x3F
|
||||
#define SDP_URL_STR_UNSPEC 0x40
|
||||
#define SDP_URL_STR8 0x45
|
||||
#define SDP_URL_STR16 0x46
|
||||
#define SDP_URL_STR32 0x47
|
||||
|
||||
/*
|
||||
* The PDU identifiers of SDP packets between client and server
|
||||
*/
|
||||
#define SDP_ERROR_RSP 0x01
|
||||
#define SDP_SVC_SEARCH_REQ 0x02
|
||||
#define SDP_SVC_SEARCH_RSP 0x03
|
||||
#define SDP_SVC_ATTR_REQ 0x04
|
||||
#define SDP_SVC_ATTR_RSP 0x05
|
||||
#define SDP_SVC_SEARCH_ATTR_REQ 0x06
|
||||
#define SDP_SVC_SEARCH_ATTR_RSP 0x07
|
||||
|
||||
/*
|
||||
* Some additions to support service registration.
|
||||
* These are outside the scope of the Bluetooth specification
|
||||
*/
|
||||
#define SDP_SVC_REGISTER_REQ 0x75
|
||||
#define SDP_SVC_REGISTER_RSP 0x76
|
||||
#define SDP_SVC_UPDATE_REQ 0x77
|
||||
#define SDP_SVC_UPDATE_RSP 0x78
|
||||
#define SDP_SVC_REMOVE_REQ 0x79
|
||||
#define SDP_SVC_REMOVE_RSP 0x80
|
||||
|
||||
/*
|
||||
* SDP Error codes
|
||||
*/
|
||||
#define SDP_INVALID_VERSION 0x0001
|
||||
#define SDP_INVALID_RECORD_HANDLE 0x0002
|
||||
#define SDP_INVALID_SYNTAX 0x0003
|
||||
#define SDP_INVALID_PDU_SIZE 0x0004
|
||||
#define SDP_INVALID_CSTATE 0x0005
|
||||
|
||||
/*
|
||||
* SDP PDU
|
||||
*/
|
||||
typedef struct {
|
||||
uint8_t pdu_id;
|
||||
uint16_t tid;
|
||||
uint16_t plen;
|
||||
} __attribute__ ((packed)) sdp_pdu_hdr_t;
|
||||
|
||||
/*
|
||||
* Common definitions for attributes in the SDP.
|
||||
* Should the type of any of these change, you need only make a change here.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
uint8_t type;
|
||||
union {
|
||||
uint16_t uuid16;
|
||||
uint32_t uuid32;
|
||||
uint128_t uuid128;
|
||||
} value;
|
||||
} uuid_t;
|
||||
|
||||
#define SDP_IS_UUID(x) ((x) == SDP_UUID16 || (x) == SDP_UUID32 || \
|
||||
(x) == SDP_UUID128)
|
||||
#define SDP_IS_ALT(x) ((x) == SDP_ALT8 || (x) == SDP_ALT16 || (x) == SDP_ALT32)
|
||||
#define SDP_IS_SEQ(x) ((x) == SDP_SEQ8 || (x) == SDP_SEQ16 || (x) == SDP_SEQ32)
|
||||
#define SDP_IS_TEXT_STR(x) ((x) == SDP_TEXT_STR8 || (x) == SDP_TEXT_STR16 || \
|
||||
(x) == SDP_TEXT_STR32)
|
||||
|
||||
typedef struct _sdp_list sdp_list_t;
|
||||
struct _sdp_list {
|
||||
sdp_list_t *next;
|
||||
void *data;
|
||||
};
|
||||
|
||||
/*
|
||||
* User-visible strings can be in many languages
|
||||
* in addition to the universal language.
|
||||
*
|
||||
* Language meta-data includes language code in ISO639
|
||||
* followed by the encoding format. The third field in this
|
||||
* structure is the attribute offset for the language.
|
||||
* User-visible strings in the specified language can be
|
||||
* obtained at this offset.
|
||||
*/
|
||||
typedef struct {
|
||||
uint16_t code_ISO639;
|
||||
uint16_t encoding;
|
||||
uint16_t base_offset;
|
||||
} sdp_lang_attr_t;
|
||||
|
||||
/*
|
||||
* Profile descriptor is the Bluetooth profile metadata. If a
|
||||
* service conforms to a well-known profile, then its profile
|
||||
* identifier (UUID) is an attribute of the service. In addition,
|
||||
* if the profile has a version number it is specified here.
|
||||
*/
|
||||
typedef struct {
|
||||
uuid_t uuid;
|
||||
uint16_t version;
|
||||
} sdp_profile_desc_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t major;
|
||||
uint8_t minor;
|
||||
} sdp_version_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t *data;
|
||||
uint32_t data_size;
|
||||
uint32_t buf_size;
|
||||
} sdp_buf_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t handle;
|
||||
|
||||
/* Search pattern: a sequence of all UUIDs seen in this record */
|
||||
sdp_list_t *pattern;
|
||||
sdp_list_t *attrlist;
|
||||
|
||||
/* Main service class for Extended Inquiry Response */
|
||||
uuid_t svclass;
|
||||
} sdp_record_t;
|
||||
|
||||
typedef struct sdp_data_struct sdp_data_t;
|
||||
struct sdp_data_struct {
|
||||
uint8_t dtd;
|
||||
uint16_t attrId;
|
||||
union {
|
||||
int8_t int8;
|
||||
int16_t int16;
|
||||
int32_t int32;
|
||||
int64_t int64;
|
||||
uint128_t int128;
|
||||
uint8_t uint8;
|
||||
uint16_t uint16;
|
||||
uint32_t uint32;
|
||||
uint64_t uint64;
|
||||
uint128_t uint128;
|
||||
uuid_t uuid;
|
||||
char *str;
|
||||
sdp_data_t *dataseq;
|
||||
} val;
|
||||
sdp_data_t *next;
|
||||
int unitSize;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __SDP_H */
|
|
@ -0,0 +1,621 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/*
|
||||
*
|
||||
* BlueZ - Bluetooth protocol stack for Linux
|
||||
*
|
||||
* Copyright (C) 2001-2002 Nokia Corporation
|
||||
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
|
||||
* Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
|
||||
* Copyright (C) 2002-2003 Stephen Crane <steve.crane@rococosoft.com>
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __SDP_LIB_H
|
||||
#define __SDP_LIB_H
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/hci.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* SDP lists
|
||||
*/
|
||||
typedef void(*sdp_list_func_t)(void *, void *);
|
||||
typedef void(*sdp_free_func_t)(void *);
|
||||
typedef int (*sdp_comp_func_t)(const void *, const void *);
|
||||
|
||||
sdp_list_t *sdp_list_append(sdp_list_t *list, void *d);
|
||||
sdp_list_t *sdp_list_remove(sdp_list_t *list, void *d);
|
||||
sdp_list_t *sdp_list_insert_sorted(sdp_list_t *list, void *data, sdp_comp_func_t f);
|
||||
void sdp_list_free(sdp_list_t *list, sdp_free_func_t f);
|
||||
|
||||
static inline int sdp_list_len(const sdp_list_t *list)
|
||||
{
|
||||
int n = 0;
|
||||
for (; list; list = list->next)
|
||||
n++;
|
||||
return n;
|
||||
}
|
||||
|
||||
static inline sdp_list_t *sdp_list_find(sdp_list_t *list, void *u, sdp_comp_func_t f)
|
||||
{
|
||||
for (; list; list = list->next)
|
||||
if (f(list->data, u) == 0)
|
||||
return list;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline void sdp_list_foreach(sdp_list_t *list, sdp_list_func_t f, void *u)
|
||||
{
|
||||
for (; list; list = list->next)
|
||||
f(list->data, u);
|
||||
}
|
||||
|
||||
/*
|
||||
* Values of the flags parameter to sdp_record_register
|
||||
*/
|
||||
#define SDP_RECORD_PERSIST 0x01
|
||||
#define SDP_DEVICE_RECORD 0x02
|
||||
|
||||
/*
|
||||
* Values of the flags parameter to sdp_connect
|
||||
*/
|
||||
#define SDP_RETRY_IF_BUSY 0x01
|
||||
#define SDP_WAIT_ON_CLOSE 0x02
|
||||
#define SDP_NON_BLOCKING 0x04
|
||||
#define SDP_LARGE_MTU 0x08
|
||||
|
||||
/*
|
||||
* a session with an SDP server
|
||||
*/
|
||||
typedef struct {
|
||||
int sock;
|
||||
int state;
|
||||
int local;
|
||||
int flags;
|
||||
uint16_t tid; /* Current transaction ID */
|
||||
void *priv;
|
||||
} sdp_session_t;
|
||||
|
||||
typedef enum {
|
||||
/*
|
||||
* Attributes are specified as individual elements
|
||||
*/
|
||||
SDP_ATTR_REQ_INDIVIDUAL = 1,
|
||||
/*
|
||||
* Attributes are specified as a range
|
||||
*/
|
||||
SDP_ATTR_REQ_RANGE
|
||||
} sdp_attrreq_type_t;
|
||||
|
||||
/*
|
||||
* When the pdu_id(type) is a sdp error response, check the status value
|
||||
* to figure out the error reason. For status values 0x0001-0x0006 check
|
||||
* Bluetooth SPEC. If the status is 0xffff, call sdp_get_error function
|
||||
* to get the real reason:
|
||||
* - wrong transaction ID(EPROTO)
|
||||
* - wrong PDU id or(EPROTO)
|
||||
* - I/O error
|
||||
*/
|
||||
typedef void sdp_callback_t(uint8_t type, uint16_t status, uint8_t *rsp, size_t size, void *udata);
|
||||
|
||||
/*
|
||||
* create an L2CAP connection to a Bluetooth device
|
||||
*
|
||||
* INPUT:
|
||||
*
|
||||
* bdaddr_t *src:
|
||||
* Address of the local device to use to make the connection
|
||||
* (or BDADDR_ANY)
|
||||
*
|
||||
* bdaddr_t *dst:
|
||||
* Address of the SDP server device
|
||||
*/
|
||||
sdp_session_t *sdp_connect(const bdaddr_t *src, const bdaddr_t *dst, uint32_t flags);
|
||||
int sdp_close(sdp_session_t *session);
|
||||
int sdp_get_socket(const sdp_session_t *session);
|
||||
|
||||
/*
|
||||
* SDP transaction: functions for asynchronous search.
|
||||
*/
|
||||
sdp_session_t *sdp_create(int sk, uint32_t flags);
|
||||
int sdp_get_error(sdp_session_t *session);
|
||||
int sdp_process(sdp_session_t *session);
|
||||
int sdp_set_notify(sdp_session_t *session, sdp_callback_t *func, void *udata);
|
||||
|
||||
int sdp_service_search_async(sdp_session_t *session, const sdp_list_t *search, uint16_t max_rec_num);
|
||||
int sdp_service_attr_async(sdp_session_t *session, uint32_t handle, sdp_attrreq_type_t reqtype, const sdp_list_t *attrid_list);
|
||||
int sdp_service_search_attr_async(sdp_session_t *session, const sdp_list_t *search, sdp_attrreq_type_t reqtype, const sdp_list_t *attrid_list);
|
||||
|
||||
uint16_t sdp_gen_tid(sdp_session_t *session);
|
||||
|
||||
/*
|
||||
* find all devices in the piconet
|
||||
*/
|
||||
int sdp_general_inquiry(inquiry_info *ii, int dev_num, int duration, uint8_t *found);
|
||||
|
||||
/* flexible extraction of basic attributes - Jean II */
|
||||
int sdp_get_int_attr(const sdp_record_t *rec, uint16_t attr, int *value);
|
||||
int sdp_get_string_attr(const sdp_record_t *rec, uint16_t attr, char *value, int valuelen);
|
||||
|
||||
/*
|
||||
* Basic sdp data functions
|
||||
*/
|
||||
sdp_data_t *sdp_data_alloc(uint8_t dtd, const void *value);
|
||||
sdp_data_t *sdp_data_alloc_with_length(uint8_t dtd, const void *value, uint32_t length);
|
||||
void sdp_data_free(sdp_data_t *data);
|
||||
sdp_data_t *sdp_data_get(const sdp_record_t *rec, uint16_t attr_id);
|
||||
|
||||
sdp_data_t *sdp_seq_alloc(void **dtds, void **values, int len);
|
||||
sdp_data_t *sdp_seq_alloc_with_length(void **dtds, void **values, int *length, int len);
|
||||
sdp_data_t *sdp_seq_append(sdp_data_t *seq, sdp_data_t *data);
|
||||
|
||||
int sdp_attr_add(sdp_record_t *rec, uint16_t attr, sdp_data_t *data);
|
||||
void sdp_attr_remove(sdp_record_t *rec, uint16_t attr);
|
||||
void sdp_attr_replace(sdp_record_t *rec, uint16_t attr, sdp_data_t *data);
|
||||
int sdp_set_uuidseq_attr(sdp_record_t *rec, uint16_t attr, sdp_list_t *seq);
|
||||
int sdp_get_uuidseq_attr(const sdp_record_t *rec, uint16_t attr, sdp_list_t **seqp);
|
||||
|
||||
/*
|
||||
* NOTE that none of the functions below will update the SDP server,
|
||||
* unless the {register, update}sdp_record_t() function is invoked.
|
||||
* All functions which return an integer value, return 0 on success
|
||||
* or -1 on failure.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Create an attribute and add it to the service record's attribute list.
|
||||
* This consists of the data type descriptor of the attribute,
|
||||
* the value of the attribute and the attribute identifier.
|
||||
*/
|
||||
int sdp_attr_add_new(sdp_record_t *rec, uint16_t attr, uint8_t dtd, const void *p);
|
||||
|
||||
/*
|
||||
* Set the information attributes of the service record.
|
||||
* The set of attributes comprises service name, description
|
||||
* and provider name
|
||||
*/
|
||||
void sdp_set_info_attr(sdp_record_t *rec, const char *name, const char *prov, const char *desc);
|
||||
|
||||
/*
|
||||
* Set the ServiceClassID attribute to the sequence specified by seq.
|
||||
* Note that the identifiers need to be in sorted order from the most
|
||||
* specific to the most generic service class that this service
|
||||
* conforms to.
|
||||
*/
|
||||
static inline int sdp_set_service_classes(sdp_record_t *rec, sdp_list_t *seq)
|
||||
{
|
||||
return sdp_set_uuidseq_attr(rec, SDP_ATTR_SVCLASS_ID_LIST, seq);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the service classes to which the service conforms.
|
||||
*
|
||||
* When set, the list contains elements of ServiceClassIdentifer(uint16_t)
|
||||
* ordered from most specific to most generic
|
||||
*/
|
||||
static inline int sdp_get_service_classes(const sdp_record_t *rec, sdp_list_t **seqp)
|
||||
{
|
||||
return sdp_get_uuidseq_attr(rec, SDP_ATTR_SVCLASS_ID_LIST, seqp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the BrowseGroupList attribute to the list specified by seq.
|
||||
*
|
||||
* A service can belong to one or more service groups
|
||||
* and the list comprises such group identifiers (UUIDs)
|
||||
*/
|
||||
static inline int sdp_set_browse_groups(sdp_record_t *rec, sdp_list_t *seq)
|
||||
{
|
||||
return sdp_set_uuidseq_attr(rec, SDP_ATTR_BROWSE_GRP_LIST, seq);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the access protocols of the record to those specified in proto
|
||||
*/
|
||||
int sdp_set_access_protos(sdp_record_t *rec, const sdp_list_t *proto);
|
||||
|
||||
/*
|
||||
* Set the additional access protocols of the record to those specified in proto
|
||||
*/
|
||||
int sdp_set_add_access_protos(sdp_record_t *rec, const sdp_list_t *proto);
|
||||
|
||||
/*
|
||||
* Get protocol port (i.e. PSM for L2CAP, Channel for RFCOMM)
|
||||
*/
|
||||
int sdp_get_proto_port(const sdp_list_t *list, int proto);
|
||||
|
||||
/*
|
||||
* Get protocol descriptor.
|
||||
*/
|
||||
sdp_data_t *sdp_get_proto_desc(sdp_list_t *list, int proto);
|
||||
|
||||
/*
|
||||
* Set the LanguageBase attributes to the values specified in list
|
||||
* (a linked list of sdp_lang_attr_t objects, one for each language in
|
||||
* which user-visible attributes are present).
|
||||
*/
|
||||
int sdp_set_lang_attr(sdp_record_t *rec, const sdp_list_t *list);
|
||||
|
||||
/*
|
||||
* Set the ServiceInfoTimeToLive attribute of the service.
|
||||
* This is the number of seconds that this record is guaranteed
|
||||
* not to change after being obtained by a client.
|
||||
*/
|
||||
static inline int sdp_set_service_ttl(sdp_record_t *rec, uint32_t ttl)
|
||||
{
|
||||
return sdp_attr_add_new(rec, SDP_ATTR_SVCINFO_TTL, SDP_UINT32, &ttl);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the ServiceRecordState attribute of a service. This is
|
||||
* guaranteed to change if there is any kind of modification to
|
||||
* the record.
|
||||
*/
|
||||
static inline int sdp_set_record_state(sdp_record_t *rec, uint32_t state)
|
||||
{
|
||||
return sdp_attr_add_new(rec, SDP_ATTR_RECORD_STATE, SDP_UINT32, &state);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the ServiceID attribute of a service.
|
||||
*/
|
||||
void sdp_set_service_id(sdp_record_t *rec, uuid_t uuid);
|
||||
|
||||
/*
|
||||
* Set the GroupID attribute of a service
|
||||
*/
|
||||
void sdp_set_group_id(sdp_record_t *rec, uuid_t grouuuid);
|
||||
|
||||
/*
|
||||
* Set the ServiceAvailability attribute of a service.
|
||||
*
|
||||
* Note that this represents the relative availability
|
||||
* of the service: 0x00 means completely unavailable;
|
||||
* 0xFF means maximum availability.
|
||||
*/
|
||||
static inline int sdp_set_service_avail(sdp_record_t *rec, uint8_t avail)
|
||||
{
|
||||
return sdp_attr_add_new(rec, SDP_ATTR_SERVICE_AVAILABILITY, SDP_UINT8, &avail);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the profile descriptor list attribute of a record.
|
||||
*
|
||||
* Each element in the list is an object of type
|
||||
* sdp_profile_desc_t which is a definition of the
|
||||
* Bluetooth profile that this service conforms to.
|
||||
*/
|
||||
int sdp_set_profile_descs(sdp_record_t *rec, const sdp_list_t *desc);
|
||||
|
||||
/*
|
||||
* Set URL attributes of a record.
|
||||
*
|
||||
* ClientExecutableURL: a URL to a client's platform specific (WinCE,
|
||||
* PalmOS) executable code that can be used to access this service.
|
||||
*
|
||||
* DocumentationURL: a URL pointing to service documentation
|
||||
*
|
||||
* IconURL: a URL to an icon that can be used to represent this service.
|
||||
*
|
||||
* Note: pass NULL for any URLs that you don't want to set or remove
|
||||
*/
|
||||
void sdp_set_url_attr(sdp_record_t *rec, const char *clientExecURL, const char *docURL, const char *iconURL);
|
||||
|
||||
/*
|
||||
* a service search request.
|
||||
*
|
||||
* INPUT :
|
||||
*
|
||||
* sdp_list_t *search
|
||||
* list containing elements of the search
|
||||
* pattern. Each entry in the list is a UUID
|
||||
* of the service to be searched
|
||||
*
|
||||
* uint16_t max_rec_num
|
||||
* An integer specifying the maximum number of
|
||||
* entries that the client can handle in the response.
|
||||
*
|
||||
* OUTPUT :
|
||||
*
|
||||
* int return value
|
||||
* 0
|
||||
* The request completed successfully. This does not
|
||||
* mean the requested services were found
|
||||
* -1
|
||||
* The request completed unsuccessfully
|
||||
*
|
||||
* sdp_list_t *rsp_list
|
||||
* This variable is set on a successful return if there are
|
||||
* non-zero service handles. It is a singly linked list of
|
||||
* service record handles (uint16_t)
|
||||
*/
|
||||
int sdp_service_search_req(sdp_session_t *session, const sdp_list_t *search, uint16_t max_rec_num, sdp_list_t **rsp_list);
|
||||
|
||||
/*
|
||||
* a service attribute request.
|
||||
*
|
||||
* INPUT :
|
||||
*
|
||||
* uint32_t handle
|
||||
* The handle of the service for which the attribute(s) are
|
||||
* requested
|
||||
*
|
||||
* sdp_attrreq_type_t reqtype
|
||||
* Attribute identifiers are 16 bit unsigned integers specified
|
||||
* in one of 2 ways described below :
|
||||
* SDP_ATTR_REQ_INDIVIDUAL - 16bit individual identifiers
|
||||
* They are the actual attribute identifiers in ascending order
|
||||
*
|
||||
* SDP_ATTR_REQ_RANGE - 32bit identifier range
|
||||
* The high-order 16bits is the start of range
|
||||
* the low-order 16bits are the end of range
|
||||
* 0x0000 to 0xFFFF gets all attributes
|
||||
*
|
||||
* sdp_list_t *attrid_list
|
||||
* Singly linked list containing attribute identifiers desired.
|
||||
* Every element is either a uint16_t(attrSpec = SDP_ATTR_REQ_INDIVIDUAL)
|
||||
* or a uint32_t(attrSpec=SDP_ATTR_REQ_RANGE)
|
||||
*
|
||||
* OUTPUT :
|
||||
* int return value
|
||||
* 0
|
||||
* The request completed successfully. This does not
|
||||
* mean the requested services were found
|
||||
* -1
|
||||
* The request completed unsuccessfully due to a timeout
|
||||
*/
|
||||
sdp_record_t *sdp_service_attr_req(sdp_session_t *session, uint32_t handle, sdp_attrreq_type_t reqtype, const sdp_list_t *attrid_list);
|
||||
|
||||
/*
|
||||
* This is a service search request combined with the service
|
||||
* attribute request. First a service class match is done and
|
||||
* for matching service, requested attributes are extracted
|
||||
*
|
||||
* INPUT :
|
||||
*
|
||||
* sdp_list_t *search
|
||||
* Singly linked list containing elements of the search
|
||||
* pattern. Each entry in the list is a UUID(DataTypeSDP_UUID16)
|
||||
* of the service to be searched
|
||||
*
|
||||
* AttributeSpecification attrSpec
|
||||
* Attribute identifiers are 16 bit unsigned integers specified
|
||||
* in one of 2 ways described below :
|
||||
* SDP_ATTR_REQ_INDIVIDUAL - 16bit individual identifiers
|
||||
* They are the actual attribute identifiers in ascending order
|
||||
*
|
||||
* SDP_ATTR_REQ_RANGE - 32bit identifier range
|
||||
* The high-order 16bits is the start of range
|
||||
* the low-order 16bits are the end of range
|
||||
* 0x0000 to 0xFFFF gets all attributes
|
||||
*
|
||||
* sdp_list_t *attrid_list
|
||||
* Singly linked list containing attribute identifiers desired.
|
||||
* Every element is either a uint16_t(attrSpec = SDP_ATTR_REQ_INDIVIDUAL)
|
||||
* or a uint32_t(attrSpec=SDP_ATTR_REQ_RANGE)
|
||||
*
|
||||
* OUTPUT :
|
||||
* int return value
|
||||
* 0
|
||||
* The request completed successfully. This does not
|
||||
* mean the requested services were found
|
||||
* -1
|
||||
* The request completed unsuccessfully due to a timeout
|
||||
*
|
||||
* sdp_list_t *rsp_list
|
||||
* This variable is set on a successful return to point to
|
||||
* service(s) found. Each element of this list is of type
|
||||
* sdp_record_t *.
|
||||
*/
|
||||
int sdp_service_search_attr_req(sdp_session_t *session, const sdp_list_t *search, sdp_attrreq_type_t reqtype, const sdp_list_t *attrid_list, sdp_list_t **rsp_list);
|
||||
|
||||
/*
|
||||
* Allocate/free a service record and its attributes
|
||||
*/
|
||||
sdp_record_t *sdp_record_alloc(void);
|
||||
void sdp_record_free(sdp_record_t *rec);
|
||||
|
||||
/*
|
||||
* Register a service record.
|
||||
*
|
||||
* Note: It is the responsbility of the Service Provider to create the
|
||||
* record first and set its attributes using setXXX() methods.
|
||||
*
|
||||
* The service provider must then call sdp_record_register() to make
|
||||
* the service record visible to SDP clients. This function returns 0
|
||||
* on success or -1 on failure (and sets errno).
|
||||
*/
|
||||
int sdp_device_record_register_binary(sdp_session_t *session, bdaddr_t *device, uint8_t *data, uint32_t size, uint8_t flags, uint32_t *handle);
|
||||
int sdp_device_record_register(sdp_session_t *session, bdaddr_t *device, sdp_record_t *rec, uint8_t flags);
|
||||
int sdp_record_register(sdp_session_t *session, sdp_record_t *rec, uint8_t flags);
|
||||
|
||||
/*
|
||||
* Unregister a service record.
|
||||
*/
|
||||
int sdp_device_record_unregister_binary(sdp_session_t *session, bdaddr_t *device, uint32_t handle);
|
||||
int sdp_device_record_unregister(sdp_session_t *session, bdaddr_t *device, sdp_record_t *rec);
|
||||
int sdp_record_unregister(sdp_session_t *session, sdp_record_t *rec);
|
||||
|
||||
/*
|
||||
* Update an existing service record. (Calling this function
|
||||
* before a previous call to sdp_record_register() will result
|
||||
* in an error.)
|
||||
*/
|
||||
int sdp_device_record_update_binary(sdp_session_t *session, bdaddr_t *device, uint32_t handle, uint8_t *data, uint32_t size);
|
||||
int sdp_device_record_update(sdp_session_t *session, bdaddr_t *device, const sdp_record_t *rec);
|
||||
int sdp_record_update(sdp_session_t *sess, const sdp_record_t *rec);
|
||||
|
||||
void sdp_record_print(const sdp_record_t *rec);
|
||||
|
||||
/*
|
||||
* UUID functions
|
||||
*/
|
||||
uuid_t *sdp_uuid16_create(uuid_t *uuid, uint16_t data);
|
||||
uuid_t *sdp_uuid32_create(uuid_t *uuid, uint32_t data);
|
||||
uuid_t *sdp_uuid128_create(uuid_t *uuid, const void *data);
|
||||
int sdp_uuid16_cmp(const void *p1, const void *p2);
|
||||
int sdp_uuid128_cmp(const void *p1, const void *p2);
|
||||
int sdp_uuid_cmp(const void *p1, const void *p2);
|
||||
uuid_t *sdp_uuid_to_uuid128(const uuid_t *uuid);
|
||||
void sdp_uuid16_to_uuid128(uuid_t *uuid128, const uuid_t *uuid16);
|
||||
void sdp_uuid32_to_uuid128(uuid_t *uuid128, const uuid_t *uuid32);
|
||||
int sdp_uuid128_to_uuid(uuid_t *uuid);
|
||||
int sdp_uuid_to_proto(uuid_t *uuid);
|
||||
int sdp_uuid_extract(const uint8_t *buffer, int bufsize, uuid_t *uuid, int *scanned);
|
||||
void sdp_uuid_print(const uuid_t *uuid);
|
||||
|
||||
#define MAX_LEN_UUID_STR 37
|
||||
#define MAX_LEN_PROTOCOL_UUID_STR 8
|
||||
#define MAX_LEN_SERVICECLASS_UUID_STR 28
|
||||
#define MAX_LEN_PROFILEDESCRIPTOR_UUID_STR 28
|
||||
|
||||
int sdp_uuid2strn(const uuid_t *uuid, char *str, size_t n);
|
||||
int sdp_proto_uuid2strn(const uuid_t *uuid, char *str, size_t n);
|
||||
int sdp_svclass_uuid2strn(const uuid_t *uuid, char *str, size_t n);
|
||||
int sdp_profile_uuid2strn(const uuid_t *uuid, char *str, size_t n);
|
||||
|
||||
/*
|
||||
* In all the sdp_get_XXX(handle, XXX *xxx) functions below,
|
||||
* the XXX * is set to point to the value, should it exist
|
||||
* and 0 is returned. If the value does not exist, -1 is
|
||||
* returned and errno set to ENODATA.
|
||||
*
|
||||
* In all the methods below, the memory management rules are
|
||||
* simple. Don't free anything! The pointer returned, in the
|
||||
* case of constructed types, is a pointer to the contents
|
||||
* of the sdp_record_t.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Get the access protocols from the service record
|
||||
*/
|
||||
int sdp_get_access_protos(const sdp_record_t *rec, sdp_list_t **protos);
|
||||
|
||||
/*
|
||||
* Get the additional access protocols from the service record
|
||||
*/
|
||||
int sdp_get_add_access_protos(const sdp_record_t *rec, sdp_list_t **protos);
|
||||
|
||||
/*
|
||||
* Extract the list of browse groups to which the service belongs.
|
||||
* When set, seqp contains elements of GroupID (uint16_t)
|
||||
*/
|
||||
static inline int sdp_get_browse_groups(const sdp_record_t *rec, sdp_list_t **seqp)
|
||||
{
|
||||
return sdp_get_uuidseq_attr(rec, SDP_ATTR_BROWSE_GRP_LIST, seqp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract language attribute meta-data of the service record.
|
||||
* For each language in the service record, LangSeq has a struct of type
|
||||
* sdp_lang_attr_t.
|
||||
*/
|
||||
int sdp_get_lang_attr(const sdp_record_t *rec, sdp_list_t **langSeq);
|
||||
|
||||
/*
|
||||
* Extract the Bluetooth profile descriptor sequence from a record.
|
||||
* Each element in the list is of type sdp_profile_desc_t
|
||||
* which contains the UUID of the profile and its version number
|
||||
* (encoded as major and minor in the high-order 8bits
|
||||
* and low-order 8bits respectively of the uint16_t)
|
||||
*/
|
||||
int sdp_get_profile_descs(const sdp_record_t *rec, sdp_list_t **profDesc);
|
||||
|
||||
/*
|
||||
* Extract SDP server version numbers
|
||||
*
|
||||
* Note: that this is an attribute of the SDP server only and
|
||||
* contains a list of uint16_t each of which represent the
|
||||
* major and minor SDP version numbers supported by this server
|
||||
*/
|
||||
int sdp_get_server_ver(const sdp_record_t *rec, sdp_list_t **pVnumList);
|
||||
|
||||
int sdp_get_service_id(const sdp_record_t *rec, uuid_t *uuid);
|
||||
int sdp_get_group_id(const sdp_record_t *rec, uuid_t *uuid);
|
||||
int sdp_get_record_state(const sdp_record_t *rec, uint32_t *svcRecState);
|
||||
int sdp_get_service_avail(const sdp_record_t *rec, uint8_t *svcAvail);
|
||||
int sdp_get_service_ttl(const sdp_record_t *rec, uint32_t *svcTTLInfo);
|
||||
int sdp_get_database_state(const sdp_record_t *rec, uint32_t *svcDBState);
|
||||
|
||||
static inline int sdp_get_service_name(const sdp_record_t *rec, char *str, int len)
|
||||
{
|
||||
return sdp_get_string_attr(rec, SDP_ATTR_SVCNAME_PRIMARY, str, len);
|
||||
}
|
||||
|
||||
static inline int sdp_get_service_desc(const sdp_record_t *rec, char *str, int len)
|
||||
{
|
||||
return sdp_get_string_attr(rec, SDP_ATTR_SVCDESC_PRIMARY, str, len);
|
||||
}
|
||||
|
||||
static inline int sdp_get_provider_name(const sdp_record_t *rec, char *str, int len)
|
||||
{
|
||||
return sdp_get_string_attr(rec, SDP_ATTR_PROVNAME_PRIMARY, str, len);
|
||||
}
|
||||
|
||||
static inline int sdp_get_doc_url(const sdp_record_t *rec, char *str, int len)
|
||||
{
|
||||
return sdp_get_string_attr(rec, SDP_ATTR_DOC_URL, str, len);
|
||||
}
|
||||
|
||||
static inline int sdp_get_clnt_exec_url(const sdp_record_t *rec, char *str, int len)
|
||||
{
|
||||
return sdp_get_string_attr(rec, SDP_ATTR_CLNT_EXEC_URL, str, len);
|
||||
}
|
||||
|
||||
static inline int sdp_get_icon_url(const sdp_record_t *rec, char *str, int len)
|
||||
{
|
||||
return sdp_get_string_attr(rec, SDP_ATTR_ICON_URL, str, len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the supported features
|
||||
* sf should be a list of list with each feature data
|
||||
* Returns 0 on success -1 on fail
|
||||
*/
|
||||
int sdp_set_supp_feat(sdp_record_t *rec, const sdp_list_t *sf);
|
||||
|
||||
/*
|
||||
* Get the supported features
|
||||
* seqp is set to a list of list with each feature data
|
||||
* Returns 0 on success, if an error occurred -1 is returned and errno is set
|
||||
*/
|
||||
int sdp_get_supp_feat(const sdp_record_t *rec, sdp_list_t **seqp);
|
||||
|
||||
sdp_record_t *sdp_extract_pdu(const uint8_t *pdata, int bufsize, int *scanned);
|
||||
sdp_record_t *sdp_copy_record(sdp_record_t *rec);
|
||||
|
||||
void sdp_data_print(sdp_data_t *data);
|
||||
void sdp_print_service_attr(sdp_list_t *alist);
|
||||
|
||||
int sdp_attrid_comp_func(const void *key1, const void *key2);
|
||||
|
||||
void sdp_set_seq_len(uint8_t *ptr, uint32_t length);
|
||||
void sdp_set_attrid(sdp_buf_t *pdu, uint16_t id);
|
||||
void sdp_append_to_pdu(sdp_buf_t *dst, sdp_data_t *d);
|
||||
void sdp_append_to_buf(sdp_buf_t *dst, uint8_t *data, uint32_t len);
|
||||
|
||||
int sdp_gen_pdu(sdp_buf_t *pdu, sdp_data_t *data);
|
||||
int sdp_gen_record_pdu(const sdp_record_t *rec, sdp_buf_t *pdu);
|
||||
|
||||
int sdp_extract_seqtype(const uint8_t *buf, int bufsize, uint8_t *dtdp, int *size);
|
||||
|
||||
sdp_data_t *sdp_extract_attr(const uint8_t *pdata, int bufsize, int *extractedLength, sdp_record_t *rec);
|
||||
|
||||
void sdp_pattern_add_uuid(sdp_record_t *rec, uuid_t *uuid);
|
||||
void sdp_pattern_add_uuidseq(sdp_record_t *rec, sdp_list_t *seq);
|
||||
|
||||
int sdp_send_req_w4_rsp(sdp_session_t *session, uint8_t *req, uint8_t *rsp, uint32_t reqsize, uint32_t *rspsize);
|
||||
|
||||
void sdp_add_lang_attr(sdp_record_t *rec);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __SDP_LIB_H */
|
1800
code/application/source/sf_app/tools/blue/include/curses.h
Normal file
1800
code/application/source/sf_app/tools/blue/include/curses.h
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,87 @@
|
|||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
/* dbus-address.h Server address parser.
|
||||
*
|
||||
* Copyright (C) 2003 CodeFactory AB
|
||||
*
|
||||
* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
|
||||
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
|
||||
#endif
|
||||
|
||||
#ifndef DBUS_ADDRESS_H
|
||||
#define DBUS_ADDRESS_H
|
||||
|
||||
#include <dbus/dbus-types.h>
|
||||
#include <dbus/dbus-errors.h>
|
||||
|
||||
DBUS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* @addtogroup DBusAddress
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Opaque type representing one of the semicolon-separated items in an address */
|
||||
typedef struct DBusAddressEntry DBusAddressEntry;
|
||||
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_parse_address (const char *address,
|
||||
DBusAddressEntry ***entry_result,
|
||||
int *array_len,
|
||||
DBusError *error);
|
||||
DBUS_EXPORT
|
||||
const char *dbus_address_entry_get_value (DBusAddressEntry *entry,
|
||||
const char *key);
|
||||
DBUS_EXPORT
|
||||
const char *dbus_address_entry_get_method (DBusAddressEntry *entry);
|
||||
DBUS_EXPORT
|
||||
void dbus_address_entries_free (DBusAddressEntry **entries);
|
||||
|
||||
DBUS_EXPORT
|
||||
char* dbus_address_escape_value (const char *value);
|
||||
DBUS_EXPORT
|
||||
char* dbus_address_unescape_value (const char *value,
|
||||
DBusError *error);
|
||||
|
||||
/**
|
||||
* Clear a variable or struct member that contains an array of #DBusAddressEntry.
|
||||
* If it does not contain #NULL, the entries that were previously
|
||||
* there are freed with dbus_address_entries_free().
|
||||
*
|
||||
* This is similar to dbus_clear_connection(): see that function
|
||||
* for more details.
|
||||
*
|
||||
* @param pointer_to_entries A pointer to a variable or struct member.
|
||||
* pointer_to_entries must not be #NULL, but *pointer_to_entries
|
||||
* may be #NULL.
|
||||
*/
|
||||
static inline void
|
||||
dbus_clear_address_entries (DBusAddressEntry ***pointer_to_entries)
|
||||
{
|
||||
_dbus_clear_pointer_impl (DBusAddressEntry *, pointer_to_entries,
|
||||
dbus_address_entries_free);
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
DBUS_END_DECLS
|
||||
|
||||
#endif /* DBUS_ADDRESS_H */
|
|
@ -0,0 +1,97 @@
|
|||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
/* dbus-bus.h Convenience functions for communicating with the bus.
|
||||
*
|
||||
* Copyright (C) 2003 CodeFactory AB
|
||||
*
|
||||
* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
|
||||
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
|
||||
#endif
|
||||
|
||||
#ifndef DBUS_BUS_H
|
||||
#define DBUS_BUS_H
|
||||
|
||||
#include <dbus/dbus-connection.h>
|
||||
|
||||
DBUS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* @addtogroup DBusBus
|
||||
* @{
|
||||
*/
|
||||
|
||||
DBUS_EXPORT
|
||||
DBusConnection *dbus_bus_get (DBusBusType type,
|
||||
DBusError *error);
|
||||
DBUS_EXPORT
|
||||
DBusConnection *dbus_bus_get_private (DBusBusType type,
|
||||
DBusError *error);
|
||||
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_bus_register (DBusConnection *connection,
|
||||
DBusError *error);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_bus_set_unique_name (DBusConnection *connection,
|
||||
const char *unique_name);
|
||||
DBUS_EXPORT
|
||||
const char* dbus_bus_get_unique_name (DBusConnection *connection);
|
||||
DBUS_EXPORT
|
||||
unsigned long dbus_bus_get_unix_user (DBusConnection *connection,
|
||||
const char *name,
|
||||
DBusError *error);
|
||||
DBUS_EXPORT
|
||||
char* dbus_bus_get_id (DBusConnection *connection,
|
||||
DBusError *error);
|
||||
DBUS_EXPORT
|
||||
int dbus_bus_request_name (DBusConnection *connection,
|
||||
const char *name,
|
||||
unsigned int flags,
|
||||
DBusError *error);
|
||||
DBUS_EXPORT
|
||||
int dbus_bus_release_name (DBusConnection *connection,
|
||||
const char *name,
|
||||
DBusError *error);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_bus_name_has_owner (DBusConnection *connection,
|
||||
const char *name,
|
||||
DBusError *error);
|
||||
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_bus_start_service_by_name (DBusConnection *connection,
|
||||
const char *name,
|
||||
dbus_uint32_t flags,
|
||||
dbus_uint32_t *reply,
|
||||
DBusError *error);
|
||||
|
||||
DBUS_EXPORT
|
||||
void dbus_bus_add_match (DBusConnection *connection,
|
||||
const char *rule,
|
||||
DBusError *error);
|
||||
DBUS_EXPORT
|
||||
void dbus_bus_remove_match (DBusConnection *connection,
|
||||
const char *rule,
|
||||
DBusError *error);
|
||||
|
||||
/** @} */
|
||||
|
||||
DBUS_END_DECLS
|
||||
|
||||
#endif /* DBUS_BUS_H */
|
|
@ -0,0 +1,531 @@
|
|||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
/* dbus-connection.h DBusConnection object
|
||||
*
|
||||
* Copyright (C) 2002, 2003 Red Hat Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
|
||||
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
|
||||
#endif
|
||||
|
||||
#ifndef DBUS_CONNECTION_H
|
||||
#define DBUS_CONNECTION_H
|
||||
|
||||
#include <dbus/dbus-errors.h>
|
||||
#include <dbus/dbus-macros.h>
|
||||
#include <dbus/dbus-memory.h>
|
||||
#include <dbus/dbus-message.h>
|
||||
#include <dbus/dbus-shared.h>
|
||||
|
||||
DBUS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* @addtogroup DBusConnection
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* documented in dbus-watch.c */
|
||||
typedef struct DBusWatch DBusWatch;
|
||||
/* documented in dbus-timeout.c */
|
||||
typedef struct DBusTimeout DBusTimeout;
|
||||
/** Opaque type representing preallocated resources so a message can be sent without further memory allocation. */
|
||||
typedef struct DBusPreallocatedSend DBusPreallocatedSend;
|
||||
/** Opaque type representing a method call that has not yet received a reply. */
|
||||
typedef struct DBusPendingCall DBusPendingCall;
|
||||
/** Opaque type representing a connection to a remote application and associated incoming/outgoing message queues. */
|
||||
typedef struct DBusConnection DBusConnection;
|
||||
/** Set of functions that must be implemented to handle messages sent to a particular object path. */
|
||||
typedef struct DBusObjectPathVTable DBusObjectPathVTable;
|
||||
|
||||
/**
|
||||
* Indicates the status of a #DBusWatch.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
DBUS_WATCH_READABLE = 1 << 0, /**< As in POLLIN */
|
||||
DBUS_WATCH_WRITABLE = 1 << 1, /**< As in POLLOUT */
|
||||
DBUS_WATCH_ERROR = 1 << 2, /**< As in POLLERR (can't watch for
|
||||
* this, but can be present in
|
||||
* current state passed to
|
||||
* dbus_watch_handle()).
|
||||
*/
|
||||
DBUS_WATCH_HANGUP = 1 << 3 /**< As in POLLHUP (can't watch for
|
||||
* it, but can be present in current
|
||||
* state passed to
|
||||
* dbus_watch_handle()).
|
||||
*/
|
||||
/* Internal to libdbus, there is also _DBUS_WATCH_NVAL in dbus-watch.h */
|
||||
} DBusWatchFlags;
|
||||
|
||||
/**
|
||||
* Indicates the status of incoming data on a #DBusConnection. This determines whether
|
||||
* dbus_connection_dispatch() needs to be called.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
DBUS_DISPATCH_DATA_REMAINS, /**< There is more data to potentially convert to messages. */
|
||||
DBUS_DISPATCH_COMPLETE, /**< All currently available data has been processed. */
|
||||
DBUS_DISPATCH_NEED_MEMORY /**< More memory is needed to continue. */
|
||||
} DBusDispatchStatus;
|
||||
|
||||
/** Called when libdbus needs a new watch to be monitored by the main
|
||||
* loop. Returns #FALSE if it lacks enough memory to add the
|
||||
* watch. Set by dbus_connection_set_watch_functions() or
|
||||
* dbus_server_set_watch_functions().
|
||||
*/
|
||||
typedef dbus_bool_t (* DBusAddWatchFunction) (DBusWatch *watch,
|
||||
void *data);
|
||||
/** Called when dbus_watch_get_enabled() may return a different value
|
||||
* than it did before. Set by dbus_connection_set_watch_functions()
|
||||
* or dbus_server_set_watch_functions().
|
||||
*/
|
||||
typedef void (* DBusWatchToggledFunction) (DBusWatch *watch,
|
||||
void *data);
|
||||
/** Called when libdbus no longer needs a watch to be monitored by the
|
||||
* main loop. Set by dbus_connection_set_watch_functions() or
|
||||
* dbus_server_set_watch_functions().
|
||||
*/
|
||||
typedef void (* DBusRemoveWatchFunction) (DBusWatch *watch,
|
||||
void *data);
|
||||
/** Called when libdbus needs a new timeout to be monitored by the main
|
||||
* loop. Returns #FALSE if it lacks enough memory to add the
|
||||
* watch. Set by dbus_connection_set_timeout_functions() or
|
||||
* dbus_server_set_timeout_functions().
|
||||
*/
|
||||
typedef dbus_bool_t (* DBusAddTimeoutFunction) (DBusTimeout *timeout,
|
||||
void *data);
|
||||
/** Called when dbus_timeout_get_enabled() may return a different
|
||||
* value than it did before.
|
||||
* Set by dbus_connection_set_timeout_functions() or
|
||||
* dbus_server_set_timeout_functions().
|
||||
*/
|
||||
typedef void (* DBusTimeoutToggledFunction) (DBusTimeout *timeout,
|
||||
void *data);
|
||||
/** Called when libdbus no longer needs a timeout to be monitored by the
|
||||
* main loop. Set by dbus_connection_set_timeout_functions() or
|
||||
* dbus_server_set_timeout_functions().
|
||||
*/
|
||||
typedef void (* DBusRemoveTimeoutFunction) (DBusTimeout *timeout,
|
||||
void *data);
|
||||
/** Called when the return value of dbus_connection_get_dispatch_status()
|
||||
* may have changed. Set with dbus_connection_set_dispatch_status_function().
|
||||
*/
|
||||
typedef void (* DBusDispatchStatusFunction) (DBusConnection *connection,
|
||||
DBusDispatchStatus new_status,
|
||||
void *data);
|
||||
/**
|
||||
* Called when the main loop's thread should be notified that there's now work
|
||||
* to do. Set with dbus_connection_set_wakeup_main_function().
|
||||
*/
|
||||
typedef void (* DBusWakeupMainFunction) (void *data);
|
||||
|
||||
/**
|
||||
* Called during authentication to check whether the given UNIX user
|
||||
* ID is allowed to connect, if the client tried to auth as a UNIX
|
||||
* user ID. Normally on Windows this would never happen. Set with
|
||||
* dbus_connection_set_unix_user_function().
|
||||
*/
|
||||
typedef dbus_bool_t (* DBusAllowUnixUserFunction) (DBusConnection *connection,
|
||||
unsigned long uid,
|
||||
void *data);
|
||||
|
||||
/**
|
||||
* Called during authentication to check whether the given Windows user
|
||||
* ID is allowed to connect, if the client tried to auth as a Windows
|
||||
* user ID. Normally on UNIX this would never happen. Set with
|
||||
* dbus_connection_set_windows_user_function().
|
||||
*/
|
||||
typedef dbus_bool_t (* DBusAllowWindowsUserFunction) (DBusConnection *connection,
|
||||
const char *user_sid,
|
||||
void *data);
|
||||
|
||||
|
||||
/**
|
||||
* Called when a pending call now has a reply available. Set with
|
||||
* dbus_pending_call_set_notify().
|
||||
*/
|
||||
typedef void (* DBusPendingCallNotifyFunction) (DBusPendingCall *pending,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
* Called when a message needs to be handled. The result indicates whether or
|
||||
* not more handlers should be run. Set with dbus_connection_add_filter().
|
||||
*/
|
||||
typedef DBusHandlerResult (* DBusHandleMessageFunction) (DBusConnection *connection,
|
||||
DBusMessage *message,
|
||||
void *user_data);
|
||||
DBUS_EXPORT
|
||||
DBusConnection* dbus_connection_open (const char *address,
|
||||
DBusError *error);
|
||||
DBUS_EXPORT
|
||||
DBusConnection* dbus_connection_open_private (const char *address,
|
||||
DBusError *error);
|
||||
DBUS_EXPORT
|
||||
DBusConnection* dbus_connection_ref (DBusConnection *connection);
|
||||
DBUS_EXPORT
|
||||
void dbus_connection_unref (DBusConnection *connection);
|
||||
DBUS_EXPORT
|
||||
void dbus_connection_close (DBusConnection *connection);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_connection_get_is_connected (DBusConnection *connection);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_connection_get_is_authenticated (DBusConnection *connection);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_connection_get_is_anonymous (DBusConnection *connection);
|
||||
DBUS_EXPORT
|
||||
char* dbus_connection_get_server_id (DBusConnection *connection);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_connection_can_send_type (DBusConnection *connection,
|
||||
int type);
|
||||
|
||||
DBUS_EXPORT
|
||||
void dbus_connection_set_exit_on_disconnect (DBusConnection *connection,
|
||||
dbus_bool_t exit_on_disconnect);
|
||||
DBUS_EXPORT
|
||||
void dbus_connection_flush (DBusConnection *connection);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_connection_read_write_dispatch (DBusConnection *connection,
|
||||
int timeout_milliseconds);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_connection_read_write (DBusConnection *connection,
|
||||
int timeout_milliseconds);
|
||||
DBUS_EXPORT
|
||||
DBusMessage* dbus_connection_borrow_message (DBusConnection *connection);
|
||||
DBUS_EXPORT
|
||||
void dbus_connection_return_message (DBusConnection *connection,
|
||||
DBusMessage *message);
|
||||
DBUS_EXPORT
|
||||
void dbus_connection_steal_borrowed_message (DBusConnection *connection,
|
||||
DBusMessage *message);
|
||||
DBUS_EXPORT
|
||||
DBusMessage* dbus_connection_pop_message (DBusConnection *connection);
|
||||
DBUS_EXPORT
|
||||
DBusDispatchStatus dbus_connection_get_dispatch_status (DBusConnection *connection);
|
||||
DBUS_EXPORT
|
||||
DBusDispatchStatus dbus_connection_dispatch (DBusConnection *connection);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_connection_has_messages_to_send (DBusConnection *connection);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_connection_send (DBusConnection *connection,
|
||||
DBusMessage *message,
|
||||
dbus_uint32_t *client_serial);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_connection_send_with_reply (DBusConnection *connection,
|
||||
DBusMessage *message,
|
||||
DBusPendingCall **pending_return,
|
||||
int timeout_milliseconds);
|
||||
DBUS_EXPORT
|
||||
DBusMessage * dbus_connection_send_with_reply_and_block (DBusConnection *connection,
|
||||
DBusMessage *message,
|
||||
int timeout_milliseconds,
|
||||
DBusError *error);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_connection_set_watch_functions (DBusConnection *connection,
|
||||
DBusAddWatchFunction add_function,
|
||||
DBusRemoveWatchFunction remove_function,
|
||||
DBusWatchToggledFunction toggled_function,
|
||||
void *data,
|
||||
DBusFreeFunction free_data_function);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_connection_set_timeout_functions (DBusConnection *connection,
|
||||
DBusAddTimeoutFunction add_function,
|
||||
DBusRemoveTimeoutFunction remove_function,
|
||||
DBusTimeoutToggledFunction toggled_function,
|
||||
void *data,
|
||||
DBusFreeFunction free_data_function);
|
||||
DBUS_EXPORT
|
||||
void dbus_connection_set_wakeup_main_function (DBusConnection *connection,
|
||||
DBusWakeupMainFunction wakeup_main_function,
|
||||
void *data,
|
||||
DBusFreeFunction free_data_function);
|
||||
DBUS_EXPORT
|
||||
void dbus_connection_set_dispatch_status_function (DBusConnection *connection,
|
||||
DBusDispatchStatusFunction function,
|
||||
void *data,
|
||||
DBusFreeFunction free_data_function);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_connection_get_unix_user (DBusConnection *connection,
|
||||
unsigned long *uid);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_connection_get_unix_process_id (DBusConnection *connection,
|
||||
unsigned long *pid);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_connection_get_adt_audit_session_data (DBusConnection *connection,
|
||||
void **data,
|
||||
dbus_int32_t *data_size);
|
||||
DBUS_EXPORT
|
||||
void dbus_connection_set_unix_user_function (DBusConnection *connection,
|
||||
DBusAllowUnixUserFunction function,
|
||||
void *data,
|
||||
DBusFreeFunction free_data_function);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_connection_get_windows_user (DBusConnection *connection,
|
||||
char **windows_sid_p);
|
||||
DBUS_EXPORT
|
||||
void dbus_connection_set_windows_user_function (DBusConnection *connection,
|
||||
DBusAllowWindowsUserFunction function,
|
||||
void *data,
|
||||
DBusFreeFunction free_data_function);
|
||||
DBUS_EXPORT
|
||||
void dbus_connection_set_allow_anonymous (DBusConnection *connection,
|
||||
dbus_bool_t value);
|
||||
DBUS_EXPORT
|
||||
void dbus_connection_set_builtin_filters_enabled (DBusConnection *connection,
|
||||
dbus_bool_t value);
|
||||
DBUS_EXPORT
|
||||
void dbus_connection_set_route_peer_messages (DBusConnection *connection,
|
||||
dbus_bool_t value);
|
||||
|
||||
|
||||
/* Filters */
|
||||
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_connection_add_filter (DBusConnection *connection,
|
||||
DBusHandleMessageFunction function,
|
||||
void *user_data,
|
||||
DBusFreeFunction free_data_function);
|
||||
DBUS_EXPORT
|
||||
void dbus_connection_remove_filter (DBusConnection *connection,
|
||||
DBusHandleMessageFunction function,
|
||||
void *user_data);
|
||||
|
||||
|
||||
/* Other */
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_connection_allocate_data_slot (dbus_int32_t *slot_p);
|
||||
DBUS_EXPORT
|
||||
void dbus_connection_free_data_slot (dbus_int32_t *slot_p);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_connection_set_data (DBusConnection *connection,
|
||||
dbus_int32_t slot,
|
||||
void *data,
|
||||
DBusFreeFunction free_data_func);
|
||||
DBUS_EXPORT
|
||||
void* dbus_connection_get_data (DBusConnection *connection,
|
||||
dbus_int32_t slot);
|
||||
|
||||
DBUS_EXPORT
|
||||
void dbus_connection_set_change_sigpipe (dbus_bool_t will_modify_sigpipe);
|
||||
|
||||
DBUS_EXPORT
|
||||
void dbus_connection_set_max_message_size (DBusConnection *connection,
|
||||
long size);
|
||||
DBUS_EXPORT
|
||||
long dbus_connection_get_max_message_size (DBusConnection *connection);
|
||||
DBUS_EXPORT
|
||||
void dbus_connection_set_max_received_size (DBusConnection *connection,
|
||||
long size);
|
||||
DBUS_EXPORT
|
||||
long dbus_connection_get_max_received_size (DBusConnection *connection);
|
||||
|
||||
DBUS_EXPORT
|
||||
void dbus_connection_set_max_message_unix_fds (DBusConnection *connection,
|
||||
long n);
|
||||
DBUS_EXPORT
|
||||
long dbus_connection_get_max_message_unix_fds (DBusConnection *connection);
|
||||
DBUS_EXPORT
|
||||
void dbus_connection_set_max_received_unix_fds(DBusConnection *connection,
|
||||
long n);
|
||||
DBUS_EXPORT
|
||||
long dbus_connection_get_max_received_unix_fds(DBusConnection *connection);
|
||||
|
||||
DBUS_EXPORT
|
||||
long dbus_connection_get_outgoing_size (DBusConnection *connection);
|
||||
DBUS_EXPORT
|
||||
long dbus_connection_get_outgoing_unix_fds (DBusConnection *connection);
|
||||
|
||||
DBUS_EXPORT
|
||||
DBusPreallocatedSend* dbus_connection_preallocate_send (DBusConnection *connection);
|
||||
DBUS_EXPORT
|
||||
void dbus_connection_free_preallocated_send (DBusConnection *connection,
|
||||
DBusPreallocatedSend *preallocated);
|
||||
DBUS_EXPORT
|
||||
void dbus_connection_send_preallocated (DBusConnection *connection,
|
||||
DBusPreallocatedSend *preallocated,
|
||||
DBusMessage *message,
|
||||
dbus_uint32_t *client_serial);
|
||||
|
||||
|
||||
/* Object tree functionality */
|
||||
|
||||
/**
|
||||
* Called when a #DBusObjectPathVTable is unregistered (or its connection is freed).
|
||||
* Found in #DBusObjectPathVTable.
|
||||
*/
|
||||
typedef void (* DBusObjectPathUnregisterFunction) (DBusConnection *connection,
|
||||
void *user_data);
|
||||
/**
|
||||
* Called when a message is sent to a registered object path. Found in
|
||||
* #DBusObjectPathVTable which is registered with dbus_connection_register_object_path()
|
||||
* or dbus_connection_register_fallback().
|
||||
*/
|
||||
typedef DBusHandlerResult (* DBusObjectPathMessageFunction) (DBusConnection *connection,
|
||||
DBusMessage *message,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
* Virtual table that must be implemented to handle a portion of the
|
||||
* object path hierarchy. Attach the vtable to a particular path using
|
||||
* dbus_connection_register_object_path() or
|
||||
* dbus_connection_register_fallback().
|
||||
*/
|
||||
struct DBusObjectPathVTable
|
||||
{
|
||||
DBusObjectPathUnregisterFunction unregister_function; /**< Function to unregister this handler */
|
||||
DBusObjectPathMessageFunction message_function; /**< Function to handle messages */
|
||||
|
||||
void (* dbus_internal_pad1) (void *); /**< Reserved for future expansion */
|
||||
void (* dbus_internal_pad2) (void *); /**< Reserved for future expansion */
|
||||
void (* dbus_internal_pad3) (void *); /**< Reserved for future expansion */
|
||||
void (* dbus_internal_pad4) (void *); /**< Reserved for future expansion */
|
||||
};
|
||||
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_connection_try_register_object_path (DBusConnection *connection,
|
||||
const char *path,
|
||||
const DBusObjectPathVTable *vtable,
|
||||
void *user_data,
|
||||
DBusError *error);
|
||||
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_connection_register_object_path (DBusConnection *connection,
|
||||
const char *path,
|
||||
const DBusObjectPathVTable *vtable,
|
||||
void *user_data);
|
||||
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_connection_try_register_fallback (DBusConnection *connection,
|
||||
const char *path,
|
||||
const DBusObjectPathVTable *vtable,
|
||||
void *user_data,
|
||||
DBusError *error);
|
||||
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_connection_register_fallback (DBusConnection *connection,
|
||||
const char *path,
|
||||
const DBusObjectPathVTable *vtable,
|
||||
void *user_data);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_connection_unregister_object_path (DBusConnection *connection,
|
||||
const char *path);
|
||||
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_connection_get_object_path_data (DBusConnection *connection,
|
||||
const char *path,
|
||||
void **data_p);
|
||||
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_connection_list_registered (DBusConnection *connection,
|
||||
const char *parent_path,
|
||||
char ***child_entries);
|
||||
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_connection_get_unix_fd (DBusConnection *connection,
|
||||
int *fd);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_connection_get_socket (DBusConnection *connection,
|
||||
int *fd);
|
||||
|
||||
/**
|
||||
* Clear a variable or struct member that contains a #DBusConnection.
|
||||
* If it does not contain #NULL, the connection that was previously
|
||||
* there is unreferenced with dbus_connection_unref().
|
||||
*
|
||||
* For example, this function and the similar functions for
|
||||
* other reference-counted types can be used in code like this:
|
||||
*
|
||||
* @code
|
||||
* DBusConnection *conn = NULL;
|
||||
* struct { ...; DBusMessage *m; ... } *larger_structure = ...;
|
||||
*
|
||||
* ... code that might set conn or m to be non-NULL ...
|
||||
*
|
||||
* dbus_clear_connection (&conn);
|
||||
* dbus_clear_message (&larger_structure->m);
|
||||
* @endcode
|
||||
*
|
||||
* @param pointer_to_connection A pointer to a variable or struct member.
|
||||
* pointer_to_connection must not be #NULL, but *pointer_to_connection
|
||||
* may be #NULL.
|
||||
*/
|
||||
static inline void
|
||||
dbus_clear_connection (DBusConnection **pointer_to_connection)
|
||||
{
|
||||
_dbus_clear_pointer_impl (DBusConnection, pointer_to_connection,
|
||||
dbus_connection_unref);
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
/**
|
||||
* @addtogroup DBusWatch
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef DBUS_DISABLE_DEPRECATED
|
||||
DBUS_EXPORT
|
||||
DBUS_DEPRECATED int dbus_watch_get_fd (DBusWatch *watch);
|
||||
#endif
|
||||
|
||||
DBUS_EXPORT
|
||||
int dbus_watch_get_unix_fd (DBusWatch *watch);
|
||||
DBUS_EXPORT
|
||||
int dbus_watch_get_socket (DBusWatch *watch);
|
||||
DBUS_EXPORT
|
||||
unsigned int dbus_watch_get_flags (DBusWatch *watch);
|
||||
DBUS_EXPORT
|
||||
void* dbus_watch_get_data (DBusWatch *watch);
|
||||
DBUS_EXPORT
|
||||
void dbus_watch_set_data (DBusWatch *watch,
|
||||
void *data,
|
||||
DBusFreeFunction free_data_function);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_watch_handle (DBusWatch *watch,
|
||||
unsigned int flags);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_watch_get_enabled (DBusWatch *watch);
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @addtogroup DBusTimeout
|
||||
* @{
|
||||
*/
|
||||
|
||||
DBUS_EXPORT
|
||||
int dbus_timeout_get_interval (DBusTimeout *timeout);
|
||||
DBUS_EXPORT
|
||||
void* dbus_timeout_get_data (DBusTimeout *timeout);
|
||||
DBUS_EXPORT
|
||||
void dbus_timeout_set_data (DBusTimeout *timeout,
|
||||
void *data,
|
||||
DBusFreeFunction free_data_function);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_timeout_handle (DBusTimeout *timeout);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_timeout_get_enabled (DBusTimeout *timeout);
|
||||
|
||||
/** @} */
|
||||
|
||||
DBUS_END_DECLS
|
||||
|
||||
#endif /* DBUS_CONNECTION_H */
|
|
@ -0,0 +1,92 @@
|
|||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
/* dbus-errors.h Error reporting
|
||||
*
|
||||
* Copyright (C) 2002 Red Hat Inc.
|
||||
* Copyright (C) 2003 CodeFactory AB
|
||||
*
|
||||
* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
|
||||
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
|
||||
#endif
|
||||
|
||||
#ifndef DBUS_ERROR_H
|
||||
#define DBUS_ERROR_H
|
||||
|
||||
#include <dbus/dbus-macros.h>
|
||||
#include <dbus/dbus-types.h>
|
||||
#include <dbus/dbus-protocol.h>
|
||||
|
||||
DBUS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* @addtogroup DBusErrors
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Mostly-opaque type representing an error that occurred */
|
||||
typedef struct DBusError DBusError;
|
||||
|
||||
/**
|
||||
* Object representing an exception.
|
||||
*/
|
||||
struct DBusError
|
||||
{
|
||||
const char *name; /**< public error name field */
|
||||
const char *message; /**< public error message field */
|
||||
|
||||
unsigned int dummy1 : 1; /**< placeholder */
|
||||
unsigned int dummy2 : 1; /**< placeholder */
|
||||
unsigned int dummy3 : 1; /**< placeholder */
|
||||
unsigned int dummy4 : 1; /**< placeholder */
|
||||
unsigned int dummy5 : 1; /**< placeholder */
|
||||
|
||||
void *padding1; /**< placeholder */
|
||||
};
|
||||
|
||||
#define DBUS_ERROR_INIT { NULL, NULL, TRUE, 0, 0, 0, 0, NULL }
|
||||
|
||||
DBUS_EXPORT
|
||||
void dbus_error_init (DBusError *error);
|
||||
DBUS_EXPORT
|
||||
void dbus_error_free (DBusError *error);
|
||||
DBUS_EXPORT
|
||||
void dbus_set_error (DBusError *error,
|
||||
const char *name,
|
||||
const char *message,
|
||||
...) _DBUS_GNUC_PRINTF (3, 4);
|
||||
DBUS_EXPORT
|
||||
void dbus_set_error_const (DBusError *error,
|
||||
const char *name,
|
||||
const char *message);
|
||||
DBUS_EXPORT
|
||||
void dbus_move_error (DBusError *src,
|
||||
DBusError *dest);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_error_has_name (const DBusError *error,
|
||||
const char *name);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_error_is_set (const DBusError *error);
|
||||
|
||||
/** @} */
|
||||
|
||||
DBUS_END_DECLS
|
||||
|
||||
#endif /* DBUS_ERROR_H */
|
|
@ -0,0 +1,237 @@
|
|||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
/* dbus-macros.h generic macros
|
||||
*
|
||||
* Copyright (C) 2002 Red Hat Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
|
||||
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
|
||||
#endif
|
||||
|
||||
#ifndef DBUS_MACROS_H
|
||||
#define DBUS_MACROS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
# define DBUS_BEGIN_DECLS extern "C" {
|
||||
# define DBUS_END_DECLS }
|
||||
#else
|
||||
# define DBUS_BEGIN_DECLS
|
||||
# define DBUS_END_DECLS
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
# define TRUE 1
|
||||
#endif
|
||||
#ifndef FALSE
|
||||
# define FALSE 0
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
# ifdef __cplusplus
|
||||
# define NULL (0L)
|
||||
# else /* !__cplusplus */
|
||||
# define NULL ((void*) 0)
|
||||
# endif /* !__cplusplus */
|
||||
#endif
|
||||
|
||||
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
|
||||
# define DBUS_DEPRECATED __attribute__ ((__deprecated__))
|
||||
#elif defined(_MSC_VER) && (_MSC_VER >= 1300)
|
||||
# define DBUS_DEPRECATED __declspec(deprecated)
|
||||
#else
|
||||
# define DBUS_DEPRECATED
|
||||
#endif
|
||||
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
|
||||
# define _DBUS_GNUC_EXTENSION __extension__
|
||||
#else
|
||||
# define _DBUS_GNUC_EXTENSION
|
||||
#endif
|
||||
|
||||
#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)) || \
|
||||
defined(__clang__)
|
||||
#define _DBUS_GNUC_PRINTF( format_idx, arg_idx ) \
|
||||
__attribute__((__format__ (__printf__, format_idx, arg_idx)))
|
||||
#define _DBUS_GNUC_NORETURN \
|
||||
__attribute__((__noreturn__))
|
||||
#define _DBUS_GNUC_UNUSED \
|
||||
__attribute__((__unused__))
|
||||
#else /* !__GNUC__ */
|
||||
#define _DBUS_GNUC_PRINTF( format_idx, arg_idx )
|
||||
#define _DBUS_GNUC_NORETURN
|
||||
#define _DBUS_GNUC_UNUSED
|
||||
#endif /* !__GNUC__ */
|
||||
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
#define DBUS_MALLOC __attribute__((__malloc__))
|
||||
#else
|
||||
#define DBUS_MALLOC
|
||||
#endif
|
||||
|
||||
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
|
||||
#define DBUS_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
|
||||
#define DBUS_ALLOC_SIZE2(x,y) __attribute__((__alloc_size__(x,y)))
|
||||
#else
|
||||
#define DBUS_ALLOC_SIZE(x)
|
||||
#define DBUS_ALLOC_SIZE2(x,y)
|
||||
#endif
|
||||
|
||||
/** @def _DBUS_WARN_UNUSED_RESULT
|
||||
*
|
||||
* An attribute for functions whose result must be checked by the caller.
|
||||
*
|
||||
* This macro is used in function declarations. Unlike gcc-specific
|
||||
* attributes, to avoid compilation failure with MSVC it must appear
|
||||
* somewhere before the function name in the declaration. Our preferred
|
||||
* coding style is to place it before the return type, for example:
|
||||
*
|
||||
* DBUS_PRIVATE_EXPORT _DBUS_WARN_UNUSED_RESULT
|
||||
* dbus_bool_t _dbus_user_database_lock_system (void);
|
||||
*/
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1700)
|
||||
#define _DBUS_WARN_UNUSED_RESULT _Must_inspect_result_
|
||||
#elif (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
|
||||
#define _DBUS_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
|
||||
#else
|
||||
#define _DBUS_WARN_UNUSED_RESULT
|
||||
#endif
|
||||
|
||||
/** @def _DBUS_GNUC_PRINTF
|
||||
* used to tell gcc about printf format strings
|
||||
*/
|
||||
/** @def _DBUS_GNUC_NORETURN
|
||||
* used to tell gcc about functions that never return, such as _dbus_abort()
|
||||
*/
|
||||
|
||||
/* Normally docs are in .c files, but there isn't a .c file for this. */
|
||||
/**
|
||||
* @defgroup DBusMacros Utility macros
|
||||
* @ingroup DBus
|
||||
* @brief #TRUE, #FALSE, #NULL, and so on
|
||||
*
|
||||
* Utility macros.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def DBUS_BEGIN_DECLS
|
||||
*
|
||||
* Macro used prior to declaring functions in the D-Bus header
|
||||
* files. Expands to "extern "C"" when using a C++ compiler,
|
||||
* and expands to nothing when using a C compiler.
|
||||
*
|
||||
* Please don't use this in your own code, consider it
|
||||
* D-Bus internal.
|
||||
*/
|
||||
/**
|
||||
* @def DBUS_END_DECLS
|
||||
*
|
||||
* Macro used after declaring functions in the D-Bus header
|
||||
* files. Expands to "}" when using a C++ compiler,
|
||||
* and expands to nothing when using a C compiler.
|
||||
*
|
||||
* Please don't use this in your own code, consider it
|
||||
* D-Bus internal.
|
||||
*/
|
||||
/**
|
||||
* @def TRUE
|
||||
*
|
||||
* Expands to "1"
|
||||
*/
|
||||
/**
|
||||
* @def FALSE
|
||||
*
|
||||
* Expands to "0"
|
||||
*/
|
||||
/**
|
||||
* @def NULL
|
||||
*
|
||||
* A null pointer, defined appropriately for C or C++.
|
||||
*/
|
||||
/**
|
||||
* @def DBUS_DEPRECATED
|
||||
*
|
||||
* Tells the compiler to warn about a function or type if it's used.
|
||||
* Code marked in this way should also be enclosed in
|
||||
* @code
|
||||
* #ifndef DBUS_DISABLE_DEPRECATED
|
||||
* deprecated stuff here
|
||||
* #endif
|
||||
* @endcode
|
||||
*
|
||||
* Please don't use this in your own code, consider it
|
||||
* D-Bus internal.
|
||||
*/
|
||||
/**
|
||||
* @def _DBUS_GNUC_EXTENSION
|
||||
*
|
||||
* Tells gcc not to warn about extensions to the C standard in the
|
||||
* following expression, even if compiling with -pedantic. Do not use
|
||||
* this macro in your own code; please consider it to be internal to libdbus.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @def DBUS_EXPORT
|
||||
*
|
||||
* Declare the following symbol as public. This is currently a noop on
|
||||
* platforms other than Windows.
|
||||
*/
|
||||
|
||||
#if defined(DBUS_EXPORT)
|
||||
/* value forced by compiler command line, don't redefine */
|
||||
#elif defined(_WIN32)
|
||||
# if defined(DBUS_STATIC_BUILD)
|
||||
# define DBUS_EXPORT
|
||||
# elif defined(dbus_1_EXPORTS)
|
||||
# define DBUS_EXPORT __declspec(dllexport)
|
||||
# else
|
||||
# define DBUS_EXPORT __declspec(dllimport)
|
||||
# endif
|
||||
#elif defined(__GNUC__) && __GNUC__ >= 4
|
||||
# define DBUS_EXPORT __attribute__ ((__visibility__ ("default")))
|
||||
#else
|
||||
#define DBUS_EXPORT
|
||||
#endif
|
||||
|
||||
/* Implementation for dbus_clear_message() etc. This is not API,
|
||||
* do not use it directly.
|
||||
*
|
||||
* We're using a specific type (T ** and T *) instead of void ** and
|
||||
* void * partly for type-safety, partly to be strict-aliasing-compliant,
|
||||
* and partly to keep C++ compilers happy. This code is inlined into
|
||||
* users of libdbus, so we can't rely on it having dbus' own compiler
|
||||
* settings. */
|
||||
#define _dbus_clear_pointer_impl(T, pointer_to_pointer, destroy) \
|
||||
do { \
|
||||
T **_pp = (pointer_to_pointer); \
|
||||
T *_value = *_pp; \
|
||||
\
|
||||
*_pp = NULL; \
|
||||
\
|
||||
if (_value != NULL) \
|
||||
destroy (_value); \
|
||||
} while (0)
|
||||
/* Not (destroy) (_value) in case destroy() is a function-like macro */
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* DBUS_MACROS_H */
|
|
@ -0,0 +1,74 @@
|
|||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
/* dbus-memory.h D-Bus memory handling
|
||||
*
|
||||
* Copyright (C) 2002 Red Hat Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
|
||||
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
|
||||
#endif
|
||||
|
||||
#ifndef DBUS_MEMORY_H
|
||||
#define DBUS_MEMORY_H
|
||||
|
||||
#include <dbus/dbus-macros.h>
|
||||
#include <stddef.h>
|
||||
|
||||
DBUS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* @addtogroup DBusMemory
|
||||
* @{
|
||||
*/
|
||||
|
||||
DBUS_EXPORT
|
||||
DBUS_MALLOC
|
||||
DBUS_ALLOC_SIZE(1)
|
||||
void* dbus_malloc (size_t bytes);
|
||||
|
||||
DBUS_EXPORT
|
||||
DBUS_MALLOC
|
||||
DBUS_ALLOC_SIZE(1)
|
||||
void* dbus_malloc0 (size_t bytes);
|
||||
|
||||
DBUS_EXPORT
|
||||
DBUS_ALLOC_SIZE(2)
|
||||
void* dbus_realloc (void *memory,
|
||||
size_t bytes);
|
||||
DBUS_EXPORT
|
||||
void dbus_free (void *memory);
|
||||
|
||||
#define dbus_new(type, count) ((type*)dbus_malloc (sizeof (type) * (count)))
|
||||
#define dbus_new0(type, count) ((type*)dbus_malloc0 (sizeof (type) * (count)))
|
||||
|
||||
DBUS_EXPORT
|
||||
void dbus_free_string_array (char **str_array);
|
||||
|
||||
typedef void (* DBusFreeFunction) (void *memory);
|
||||
|
||||
DBUS_EXPORT
|
||||
void dbus_shutdown (void);
|
||||
|
||||
/** @} */
|
||||
|
||||
DBUS_END_DECLS
|
||||
|
||||
#endif /* DBUS_MEMORY_H */
|
|
@ -0,0 +1,401 @@
|
|||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
/* dbus-message.h DBusMessage object
|
||||
*
|
||||
* Copyright (C) 2002, 2003, 2005 Red Hat Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
|
||||
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
|
||||
#endif
|
||||
|
||||
#ifndef DBUS_MESSAGE_H
|
||||
#define DBUS_MESSAGE_H
|
||||
|
||||
#include <dbus/dbus-macros.h>
|
||||
#include <dbus/dbus-types.h>
|
||||
#include <dbus/dbus-arch-deps.h>
|
||||
#include <dbus/dbus-memory.h>
|
||||
#include <dbus/dbus-errors.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
DBUS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* @addtogroup DBusMessage
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef struct DBusMessage DBusMessage;
|
||||
/**
|
||||
* Opaque type representing a message iterator. Can be copied by value and
|
||||
* allocated on the stack.
|
||||
*
|
||||
* A DBusMessageIter usually contains no allocated memory. However, there
|
||||
* is one special case: after a successful call to
|
||||
* dbus_message_iter_open_container(), the caller is responsible for calling
|
||||
* either dbus_message_iter_close_container() or
|
||||
* dbus_message_iter_abandon_container() exactly once, with the same pair
|
||||
* of iterators.
|
||||
*/
|
||||
typedef struct DBusMessageIter DBusMessageIter;
|
||||
|
||||
/**
|
||||
* DBusMessageIter struct; contains no public fields.
|
||||
*/
|
||||
struct DBusMessageIter
|
||||
{
|
||||
#if DBUS_SIZEOF_VOID_P > 8
|
||||
void *dummy[16]; /**< Don't use this */
|
||||
#else
|
||||
void *dummy1; /**< Don't use this */
|
||||
void *dummy2; /**< Don't use this */
|
||||
dbus_uint32_t dummy3; /**< Don't use this */
|
||||
int dummy4; /**< Don't use this */
|
||||
int dummy5; /**< Don't use this */
|
||||
int dummy6; /**< Don't use this */
|
||||
int dummy7; /**< Don't use this */
|
||||
int dummy8; /**< Don't use this */
|
||||
int dummy9; /**< Don't use this */
|
||||
int dummy10; /**< Don't use this */
|
||||
int dummy11; /**< Don't use this */
|
||||
int pad1; /**< Don't use this */
|
||||
void *pad2; /**< Don't use this */
|
||||
void *pad3; /**< Don't use this */
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
* A message iterator for which dbus_message_iter_abandon_container_if_open()
|
||||
* is the only valid operation.
|
||||
*/
|
||||
#if DBUS_SIZEOF_VOID_P > 8
|
||||
#define DBUS_MESSAGE_ITER_INIT_CLOSED \
|
||||
{ \
|
||||
{ \
|
||||
NULL, NULL, NULL, NULL, \
|
||||
NULL, NULL, NULL, NULL, \
|
||||
NULL, NULL, NULL, NULL, \
|
||||
NULL, NULL, NULL, NULL \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define DBUS_MESSAGE_ITER_INIT_CLOSED \
|
||||
{ \
|
||||
NULL, /* dummy1 */ \
|
||||
NULL, /* dummy2 */ \
|
||||
0, /* dummy3 */ \
|
||||
0, /* dummy4 */ \
|
||||
0, /* dummy5 */ \
|
||||
0, /* dummy6 */ \
|
||||
0, /* dummy7 */ \
|
||||
0, /* dummy8 */ \
|
||||
0, /* dummy9 */ \
|
||||
0, /* dummy10 */ \
|
||||
0, /* dummy11 */ \
|
||||
0, /* pad1 */ \
|
||||
NULL, /* pad2 */ \
|
||||
NULL /* pad3 */ \
|
||||
}
|
||||
#endif
|
||||
|
||||
DBUS_EXPORT
|
||||
DBusMessage* dbus_message_new (int message_type);
|
||||
DBUS_EXPORT
|
||||
DBusMessage* dbus_message_new_method_call (const char *bus_name,
|
||||
const char *path,
|
||||
const char *iface,
|
||||
const char *method);
|
||||
DBUS_EXPORT
|
||||
DBusMessage* dbus_message_new_method_return (DBusMessage *method_call);
|
||||
DBUS_EXPORT
|
||||
DBusMessage* dbus_message_new_signal (const char *path,
|
||||
const char *iface,
|
||||
const char *name);
|
||||
DBUS_EXPORT
|
||||
DBusMessage* dbus_message_new_error (DBusMessage *reply_to,
|
||||
const char *error_name,
|
||||
const char *error_message);
|
||||
DBUS_EXPORT
|
||||
DBusMessage* dbus_message_new_error_printf (DBusMessage *reply_to,
|
||||
const char *error_name,
|
||||
const char *error_format,
|
||||
...) _DBUS_GNUC_PRINTF (3, 4);
|
||||
|
||||
DBUS_EXPORT
|
||||
DBusMessage* dbus_message_copy (const DBusMessage *message);
|
||||
|
||||
DBUS_EXPORT
|
||||
DBusMessage* dbus_message_ref (DBusMessage *message);
|
||||
DBUS_EXPORT
|
||||
void dbus_message_unref (DBusMessage *message);
|
||||
DBUS_EXPORT
|
||||
int dbus_message_get_type (DBusMessage *message);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_set_path (DBusMessage *message,
|
||||
const char *object_path);
|
||||
DBUS_EXPORT
|
||||
const char* dbus_message_get_path (DBusMessage *message);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_has_path (DBusMessage *message,
|
||||
const char *object_path);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_set_interface (DBusMessage *message,
|
||||
const char *iface);
|
||||
DBUS_EXPORT
|
||||
const char* dbus_message_get_interface (DBusMessage *message);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_has_interface (DBusMessage *message,
|
||||
const char *iface);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_set_member (DBusMessage *message,
|
||||
const char *member);
|
||||
DBUS_EXPORT
|
||||
const char* dbus_message_get_member (DBusMessage *message);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_has_member (DBusMessage *message,
|
||||
const char *member);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_set_error_name (DBusMessage *message,
|
||||
const char *name);
|
||||
DBUS_EXPORT
|
||||
const char* dbus_message_get_error_name (DBusMessage *message);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_set_destination (DBusMessage *message,
|
||||
const char *destination);
|
||||
DBUS_EXPORT
|
||||
const char* dbus_message_get_destination (DBusMessage *message);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_set_sender (DBusMessage *message,
|
||||
const char *sender);
|
||||
DBUS_EXPORT
|
||||
const char* dbus_message_get_sender (DBusMessage *message);
|
||||
DBUS_EXPORT
|
||||
const char* dbus_message_get_signature (DBusMessage *message);
|
||||
DBUS_EXPORT
|
||||
void dbus_message_set_no_reply (DBusMessage *message,
|
||||
dbus_bool_t no_reply);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_get_no_reply (DBusMessage *message);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_is_method_call (DBusMessage *message,
|
||||
const char *iface,
|
||||
const char *method);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_is_signal (DBusMessage *message,
|
||||
const char *iface,
|
||||
const char *signal_name);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_is_error (DBusMessage *message,
|
||||
const char *error_name);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_has_destination (DBusMessage *message,
|
||||
const char *bus_name);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_has_sender (DBusMessage *message,
|
||||
const char *unique_bus_name);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_has_signature (DBusMessage *message,
|
||||
const char *signature);
|
||||
DBUS_EXPORT
|
||||
dbus_uint32_t dbus_message_get_serial (DBusMessage *message);
|
||||
DBUS_EXPORT
|
||||
void dbus_message_set_serial (DBusMessage *message,
|
||||
dbus_uint32_t serial);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_set_reply_serial (DBusMessage *message,
|
||||
dbus_uint32_t reply_serial);
|
||||
DBUS_EXPORT
|
||||
dbus_uint32_t dbus_message_get_reply_serial (DBusMessage *message);
|
||||
|
||||
DBUS_EXPORT
|
||||
void dbus_message_set_auto_start (DBusMessage *message,
|
||||
dbus_bool_t auto_start);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_get_auto_start (DBusMessage *message);
|
||||
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_get_path_decomposed (DBusMessage *message,
|
||||
char ***path);
|
||||
|
||||
DBUS_EXPORT
|
||||
const char *dbus_message_get_container_instance (DBusMessage *message);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_set_container_instance (DBusMessage *message,
|
||||
const char *object_path);
|
||||
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_append_args (DBusMessage *message,
|
||||
int first_arg_type,
|
||||
...);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_append_args_valist (DBusMessage *message,
|
||||
int first_arg_type,
|
||||
va_list var_args);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_get_args (DBusMessage *message,
|
||||
DBusError *error,
|
||||
int first_arg_type,
|
||||
...);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_get_args_valist (DBusMessage *message,
|
||||
DBusError *error,
|
||||
int first_arg_type,
|
||||
va_list var_args);
|
||||
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_contains_unix_fds (DBusMessage *message);
|
||||
|
||||
DBUS_EXPORT
|
||||
void dbus_message_iter_init_closed (DBusMessageIter *iter);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_iter_init (DBusMessage *message,
|
||||
DBusMessageIter *iter);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_iter_has_next (DBusMessageIter *iter);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_iter_next (DBusMessageIter *iter);
|
||||
DBUS_EXPORT
|
||||
char* dbus_message_iter_get_signature (DBusMessageIter *iter);
|
||||
DBUS_EXPORT
|
||||
int dbus_message_iter_get_arg_type (DBusMessageIter *iter);
|
||||
DBUS_EXPORT
|
||||
int dbus_message_iter_get_element_type (DBusMessageIter *iter);
|
||||
DBUS_EXPORT
|
||||
void dbus_message_iter_recurse (DBusMessageIter *iter,
|
||||
DBusMessageIter *sub);
|
||||
DBUS_EXPORT
|
||||
void dbus_message_iter_get_basic (DBusMessageIter *iter,
|
||||
void *value);
|
||||
DBUS_EXPORT
|
||||
int dbus_message_iter_get_element_count(DBusMessageIter *iter);
|
||||
|
||||
#ifndef DBUS_DISABLE_DEPRECATED
|
||||
/* This function returns the wire protocol size of the array in bytes,
|
||||
* you do not want to know that probably
|
||||
*/
|
||||
DBUS_EXPORT
|
||||
DBUS_DEPRECATED int dbus_message_iter_get_array_len (DBusMessageIter *iter);
|
||||
#endif
|
||||
DBUS_EXPORT
|
||||
void dbus_message_iter_get_fixed_array (DBusMessageIter *iter,
|
||||
void *value,
|
||||
int *n_elements);
|
||||
|
||||
|
||||
DBUS_EXPORT
|
||||
void dbus_message_iter_init_append (DBusMessage *message,
|
||||
DBusMessageIter *iter);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_iter_append_basic (DBusMessageIter *iter,
|
||||
int type,
|
||||
const void *value);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_iter_append_fixed_array (DBusMessageIter *iter,
|
||||
int element_type,
|
||||
const void *value,
|
||||
int n_elements);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_iter_open_container (DBusMessageIter *iter,
|
||||
int type,
|
||||
const char *contained_signature,
|
||||
DBusMessageIter *sub);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_iter_close_container (DBusMessageIter *iter,
|
||||
DBusMessageIter *sub);
|
||||
DBUS_EXPORT
|
||||
void dbus_message_iter_abandon_container (DBusMessageIter *iter,
|
||||
DBusMessageIter *sub);
|
||||
|
||||
DBUS_EXPORT
|
||||
void dbus_message_iter_abandon_container_if_open (DBusMessageIter *iter,
|
||||
DBusMessageIter *sub);
|
||||
|
||||
DBUS_EXPORT
|
||||
void dbus_message_lock (DBusMessage *message);
|
||||
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_set_error_from_message (DBusError *error,
|
||||
DBusMessage *message);
|
||||
|
||||
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_allocate_data_slot (dbus_int32_t *slot_p);
|
||||
DBUS_EXPORT
|
||||
void dbus_message_free_data_slot (dbus_int32_t *slot_p);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_set_data (DBusMessage *message,
|
||||
dbus_int32_t slot,
|
||||
void *data,
|
||||
DBusFreeFunction free_data_func);
|
||||
DBUS_EXPORT
|
||||
void* dbus_message_get_data (DBusMessage *message,
|
||||
dbus_int32_t slot);
|
||||
|
||||
DBUS_EXPORT
|
||||
int dbus_message_type_from_string (const char *type_str);
|
||||
DBUS_EXPORT
|
||||
const char* dbus_message_type_to_string (int type);
|
||||
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_marshal (DBusMessage *msg,
|
||||
char **marshalled_data_p,
|
||||
int *len_p);
|
||||
DBUS_EXPORT
|
||||
DBusMessage* dbus_message_demarshal (const char *str,
|
||||
int len,
|
||||
DBusError *error);
|
||||
|
||||
DBUS_EXPORT
|
||||
int dbus_message_demarshal_bytes_needed (const char *str,
|
||||
int len);
|
||||
|
||||
DBUS_EXPORT
|
||||
void dbus_message_set_allow_interactive_authorization (DBusMessage *message,
|
||||
dbus_bool_t allow);
|
||||
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_message_get_allow_interactive_authorization (
|
||||
DBusMessage *message);
|
||||
|
||||
/**
|
||||
* Clear a variable or struct member that contains a #DBusMessage.
|
||||
* If it does not contain #NULL, the message that was previously
|
||||
* there is unreferenced with dbus_message_unref().
|
||||
*
|
||||
* This is very similar to dbus_clear_connection(): see that function
|
||||
* for more details.
|
||||
*
|
||||
* @param pointer_to_message A pointer to a variable or struct member.
|
||||
* pointer_to_message must not be #NULL, but *pointer_to_message
|
||||
* may be #NULL.
|
||||
*/
|
||||
static inline void
|
||||
dbus_clear_message (DBusMessage **pointer_to_message)
|
||||
{
|
||||
_dbus_clear_pointer_impl (DBusMessage, pointer_to_message,
|
||||
dbus_message_unref);
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
DBUS_END_DECLS
|
||||
|
||||
#endif /* DBUS_MESSAGE_H */
|
|
@ -0,0 +1,60 @@
|
|||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
/* dbus-misc.h A few assorted public functions that don't fit elsewhere
|
||||
*
|
||||
* Copyright (C) 2006 Red Hat, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
|
||||
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
|
||||
#endif
|
||||
|
||||
#ifndef DBUS_MISC_H
|
||||
#define DBUS_MISC_H
|
||||
|
||||
#include <dbus/dbus-types.h>
|
||||
#include <dbus/dbus-errors.h>
|
||||
|
||||
DBUS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* @addtogroup DBusMisc
|
||||
* @{
|
||||
*/
|
||||
DBUS_EXPORT
|
||||
char* dbus_get_local_machine_id (void);
|
||||
|
||||
DBUS_EXPORT
|
||||
void dbus_get_version (int *major_version_p,
|
||||
int *minor_version_p,
|
||||
int *micro_version_p);
|
||||
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_setenv (const char *variable,
|
||||
const char *value);
|
||||
|
||||
DBUS_EXPORT
|
||||
char *dbus_try_get_local_machine_id (DBusError *error);
|
||||
|
||||
/** @} */
|
||||
|
||||
DBUS_END_DECLS
|
||||
|
||||
#endif /* DBUS_MISC_H */
|
|
@ -0,0 +1,100 @@
|
|||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
/* dbus-pending-call.h Object representing a call in progress.
|
||||
*
|
||||
* Copyright (C) 2002, 2003 Red Hat Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
|
||||
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
|
||||
#endif
|
||||
|
||||
#ifndef DBUS_PENDING_CALL_H
|
||||
#define DBUS_PENDING_CALL_H
|
||||
|
||||
#include <dbus/dbus-macros.h>
|
||||
#include <dbus/dbus-types.h>
|
||||
#include <dbus/dbus-connection.h>
|
||||
|
||||
DBUS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* @addtogroup DBusPendingCall
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define DBUS_TIMEOUT_INFINITE ((int) 0x7fffffff)
|
||||
#define DBUS_TIMEOUT_USE_DEFAULT (-1)
|
||||
|
||||
DBUS_EXPORT
|
||||
DBusPendingCall* dbus_pending_call_ref (DBusPendingCall *pending);
|
||||
DBUS_EXPORT
|
||||
void dbus_pending_call_unref (DBusPendingCall *pending);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_pending_call_set_notify (DBusPendingCall *pending,
|
||||
DBusPendingCallNotifyFunction function,
|
||||
void *user_data,
|
||||
DBusFreeFunction free_user_data);
|
||||
DBUS_EXPORT
|
||||
void dbus_pending_call_cancel (DBusPendingCall *pending);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_pending_call_get_completed (DBusPendingCall *pending);
|
||||
DBUS_EXPORT
|
||||
DBusMessage* dbus_pending_call_steal_reply (DBusPendingCall *pending);
|
||||
DBUS_EXPORT
|
||||
void dbus_pending_call_block (DBusPendingCall *pending);
|
||||
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_pending_call_allocate_data_slot (dbus_int32_t *slot_p);
|
||||
DBUS_EXPORT
|
||||
void dbus_pending_call_free_data_slot (dbus_int32_t *slot_p);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_pending_call_set_data (DBusPendingCall *pending,
|
||||
dbus_int32_t slot,
|
||||
void *data,
|
||||
DBusFreeFunction free_data_func);
|
||||
DBUS_EXPORT
|
||||
void* dbus_pending_call_get_data (DBusPendingCall *pending,
|
||||
dbus_int32_t slot);
|
||||
|
||||
/**
|
||||
* Clear a variable or struct member that contains a #DBusPendingCall.
|
||||
* If it does not contain #NULL, the pending call that was previously
|
||||
* there is unreferenced with dbus_pending_call_unref().
|
||||
*
|
||||
* This is very similar to dbus_clear_connection(): see that function
|
||||
* for more details.
|
||||
*
|
||||
* @param pointer_to_pending_call A pointer to a variable or struct member.
|
||||
* pointer_to_pending_call must not be #NULL, but *pointer_to_pending_call
|
||||
* may be #NULL.
|
||||
*/
|
||||
static inline void
|
||||
dbus_clear_pending_call (DBusPendingCall **pointer_to_pending_call)
|
||||
{
|
||||
_dbus_clear_pointer_impl (DBusPendingCall, pointer_to_pending_call,
|
||||
dbus_pending_call_unref);
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
DBUS_END_DECLS
|
||||
|
||||
#endif /* DBUS_PENDING_CALL_H */
|
|
@ -0,0 +1,488 @@
|
|||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
/* dbus-protocol.h D-Bus protocol constants
|
||||
*
|
||||
* Copyright (C) 2002, 2003 CodeFactory AB
|
||||
* Copyright (C) 2004, 2005 Red Hat, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DBUS_PROTOCOL_H
|
||||
#define DBUS_PROTOCOL_H
|
||||
|
||||
/* Don't include anything in here from anywhere else. It's
|
||||
* intended for use by any random library.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#if 0
|
||||
} /* avoids confusing emacs indentation */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Normally docs are in .c files, but there isn't a .c file for this. */
|
||||
/**
|
||||
* @defgroup DBusProtocol Protocol constants
|
||||
* @ingroup DBus
|
||||
*
|
||||
* @brief Defines constants which are part of the D-Bus protocol
|
||||
*
|
||||
* This header is intended for use by any library, not only libdbus.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/* Message byte order */
|
||||
#define DBUS_LITTLE_ENDIAN ('l') /**< Code marking LSB-first byte order in the wire protocol. */
|
||||
#define DBUS_BIG_ENDIAN ('B') /**< Code marking MSB-first byte order in the wire protocol. */
|
||||
|
||||
/** Protocol version. */
|
||||
#define DBUS_MAJOR_PROTOCOL_VERSION 1
|
||||
|
||||
/** Type code that is never equal to a legitimate type code */
|
||||
#define DBUS_TYPE_INVALID ((int) '\0')
|
||||
/** #DBUS_TYPE_INVALID as a string literal instead of a int literal */
|
||||
#define DBUS_TYPE_INVALID_AS_STRING "\0"
|
||||
|
||||
/* Primitive types */
|
||||
/** Type code marking an 8-bit unsigned integer */
|
||||
#define DBUS_TYPE_BYTE ((int) 'y')
|
||||
/** #DBUS_TYPE_BYTE as a string literal instead of a int literal */
|
||||
#define DBUS_TYPE_BYTE_AS_STRING "y"
|
||||
/** Type code marking a boolean */
|
||||
#define DBUS_TYPE_BOOLEAN ((int) 'b')
|
||||
/** #DBUS_TYPE_BOOLEAN as a string literal instead of a int literal */
|
||||
#define DBUS_TYPE_BOOLEAN_AS_STRING "b"
|
||||
/** Type code marking a 16-bit signed integer */
|
||||
#define DBUS_TYPE_INT16 ((int) 'n')
|
||||
/** #DBUS_TYPE_INT16 as a string literal instead of a int literal */
|
||||
#define DBUS_TYPE_INT16_AS_STRING "n"
|
||||
/** Type code marking a 16-bit unsigned integer */
|
||||
#define DBUS_TYPE_UINT16 ((int) 'q')
|
||||
/** #DBUS_TYPE_UINT16 as a string literal instead of a int literal */
|
||||
#define DBUS_TYPE_UINT16_AS_STRING "q"
|
||||
/** Type code marking a 32-bit signed integer */
|
||||
#define DBUS_TYPE_INT32 ((int) 'i')
|
||||
/** #DBUS_TYPE_INT32 as a string literal instead of a int literal */
|
||||
#define DBUS_TYPE_INT32_AS_STRING "i"
|
||||
/** Type code marking a 32-bit unsigned integer */
|
||||
#define DBUS_TYPE_UINT32 ((int) 'u')
|
||||
/** #DBUS_TYPE_UINT32 as a string literal instead of a int literal */
|
||||
#define DBUS_TYPE_UINT32_AS_STRING "u"
|
||||
/** Type code marking a 64-bit signed integer */
|
||||
#define DBUS_TYPE_INT64 ((int) 'x')
|
||||
/** #DBUS_TYPE_INT64 as a string literal instead of a int literal */
|
||||
#define DBUS_TYPE_INT64_AS_STRING "x"
|
||||
/** Type code marking a 64-bit unsigned integer */
|
||||
#define DBUS_TYPE_UINT64 ((int) 't')
|
||||
/** #DBUS_TYPE_UINT64 as a string literal instead of a int literal */
|
||||
#define DBUS_TYPE_UINT64_AS_STRING "t"
|
||||
/** Type code marking an 8-byte double in IEEE 754 format */
|
||||
#define DBUS_TYPE_DOUBLE ((int) 'd')
|
||||
/** #DBUS_TYPE_DOUBLE as a string literal instead of a int literal */
|
||||
#define DBUS_TYPE_DOUBLE_AS_STRING "d"
|
||||
/** Type code marking a UTF-8 encoded, nul-terminated Unicode string */
|
||||
#define DBUS_TYPE_STRING ((int) 's')
|
||||
/** #DBUS_TYPE_STRING as a string literal instead of a int literal */
|
||||
#define DBUS_TYPE_STRING_AS_STRING "s"
|
||||
/** Type code marking a D-Bus object path */
|
||||
#define DBUS_TYPE_OBJECT_PATH ((int) 'o')
|
||||
/** #DBUS_TYPE_OBJECT_PATH as a string literal instead of a int literal */
|
||||
#define DBUS_TYPE_OBJECT_PATH_AS_STRING "o"
|
||||
/** Type code marking a D-Bus type signature */
|
||||
#define DBUS_TYPE_SIGNATURE ((int) 'g')
|
||||
/** #DBUS_TYPE_SIGNATURE as a string literal instead of a int literal */
|
||||
#define DBUS_TYPE_SIGNATURE_AS_STRING "g"
|
||||
/** Type code marking a unix file descriptor */
|
||||
#define DBUS_TYPE_UNIX_FD ((int) 'h')
|
||||
/** #DBUS_TYPE_UNIX_FD as a string literal instead of a int literal */
|
||||
#define DBUS_TYPE_UNIX_FD_AS_STRING "h"
|
||||
|
||||
/* Compound types */
|
||||
/** Type code marking a D-Bus array type */
|
||||
#define DBUS_TYPE_ARRAY ((int) 'a')
|
||||
/** #DBUS_TYPE_ARRAY as a string literal instead of a int literal */
|
||||
#define DBUS_TYPE_ARRAY_AS_STRING "a"
|
||||
/** Type code marking a D-Bus variant type */
|
||||
#define DBUS_TYPE_VARIANT ((int) 'v')
|
||||
/** #DBUS_TYPE_VARIANT as a string literal instead of a int literal */
|
||||
#define DBUS_TYPE_VARIANT_AS_STRING "v"
|
||||
|
||||
/** STRUCT and DICT_ENTRY are sort of special since their codes can't
|
||||
* appear in a type string, instead
|
||||
* DBUS_STRUCT_BEGIN_CHAR/DBUS_DICT_ENTRY_BEGIN_CHAR have to appear
|
||||
*/
|
||||
/** Type code used to represent a struct; however, this type code does not appear
|
||||
* in type signatures, instead #DBUS_STRUCT_BEGIN_CHAR and #DBUS_STRUCT_END_CHAR will
|
||||
* appear in a signature.
|
||||
*/
|
||||
#define DBUS_TYPE_STRUCT ((int) 'r')
|
||||
/** #DBUS_TYPE_STRUCT as a string literal instead of a int literal */
|
||||
#define DBUS_TYPE_STRUCT_AS_STRING "r"
|
||||
/** Type code used to represent a dict entry; however, this type code does not appear
|
||||
* in type signatures, instead #DBUS_DICT_ENTRY_BEGIN_CHAR and #DBUS_DICT_ENTRY_END_CHAR will
|
||||
* appear in a signature.
|
||||
*/
|
||||
#define DBUS_TYPE_DICT_ENTRY ((int) 'e')
|
||||
/** #DBUS_TYPE_DICT_ENTRY as a string literal instead of a int literal */
|
||||
#define DBUS_TYPE_DICT_ENTRY_AS_STRING "e"
|
||||
|
||||
/** Does not include #DBUS_TYPE_INVALID, #DBUS_STRUCT_BEGIN_CHAR, #DBUS_STRUCT_END_CHAR,
|
||||
* #DBUS_DICT_ENTRY_BEGIN_CHAR, or #DBUS_DICT_ENTRY_END_CHAR - i.e. it is the number of
|
||||
* valid types, not the number of distinct characters that may appear in a type signature.
|
||||
*/
|
||||
#define DBUS_NUMBER_OF_TYPES (16)
|
||||
|
||||
/* characters other than typecodes that appear in type signatures */
|
||||
|
||||
/** Code marking the start of a struct type in a type signature */
|
||||
#define DBUS_STRUCT_BEGIN_CHAR ((int) '(')
|
||||
/** #DBUS_STRUCT_BEGIN_CHAR as a string literal instead of a int literal */
|
||||
#define DBUS_STRUCT_BEGIN_CHAR_AS_STRING "("
|
||||
/** Code marking the end of a struct type in a type signature */
|
||||
#define DBUS_STRUCT_END_CHAR ((int) ')')
|
||||
/** #DBUS_STRUCT_END_CHAR a string literal instead of a int literal */
|
||||
#define DBUS_STRUCT_END_CHAR_AS_STRING ")"
|
||||
/** Code marking the start of a dict entry type in a type signature */
|
||||
#define DBUS_DICT_ENTRY_BEGIN_CHAR ((int) '{')
|
||||
/** #DBUS_DICT_ENTRY_BEGIN_CHAR as a string literal instead of a int literal */
|
||||
#define DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING "{"
|
||||
/** Code marking the end of a dict entry type in a type signature */
|
||||
#define DBUS_DICT_ENTRY_END_CHAR ((int) '}')
|
||||
/** #DBUS_DICT_ENTRY_END_CHAR as a string literal instead of a int literal */
|
||||
#define DBUS_DICT_ENTRY_END_CHAR_AS_STRING "}"
|
||||
|
||||
/** Max length in bytes of a bus name, interface, or member (not object
|
||||
* path, paths are unlimited). This is limited because lots of stuff
|
||||
* is O(n) in this number, plus it would be obnoxious to type in a
|
||||
* paragraph-long method name so most likely something like that would
|
||||
* be an exploit.
|
||||
*/
|
||||
#define DBUS_MAXIMUM_NAME_LENGTH 255
|
||||
|
||||
/** This one is 255 so it fits in a byte */
|
||||
#define DBUS_MAXIMUM_SIGNATURE_LENGTH 255
|
||||
|
||||
/** Max length of a match rule string; to keep people from hosing the
|
||||
* daemon with some huge rule
|
||||
*/
|
||||
#define DBUS_MAXIMUM_MATCH_RULE_LENGTH 1024
|
||||
|
||||
/** Max arg number you can match on in a match rule, e.g.
|
||||
* arg0='hello' is OK, arg3489720987='hello' is not
|
||||
*/
|
||||
#define DBUS_MAXIMUM_MATCH_RULE_ARG_NUMBER 63
|
||||
|
||||
/** Max length of a marshaled array in bytes (64M, 2^26) We use signed
|
||||
* int for lengths so must be INT_MAX or less. We need something a
|
||||
* bit smaller than INT_MAX because the array is inside a message with
|
||||
* header info, etc. so an INT_MAX array wouldn't allow the message
|
||||
* overhead. The 64M number is an attempt at a larger number than
|
||||
* we'd reasonably ever use, but small enough that your bus would chew
|
||||
* through it fairly quickly without locking up forever. If you have
|
||||
* data that's likely to be larger than this, you should probably be
|
||||
* sending it in multiple incremental messages anyhow.
|
||||
*/
|
||||
#define DBUS_MAXIMUM_ARRAY_LENGTH (67108864)
|
||||
/** Number of bits you need in an unsigned to store the max array size */
|
||||
#define DBUS_MAXIMUM_ARRAY_LENGTH_BITS 26
|
||||
|
||||
/** The maximum total message size including header and body; similar
|
||||
* rationale to max array size.
|
||||
*/
|
||||
#define DBUS_MAXIMUM_MESSAGE_LENGTH (DBUS_MAXIMUM_ARRAY_LENGTH * 2)
|
||||
/** Number of bits you need in an unsigned to store the max message size */
|
||||
#define DBUS_MAXIMUM_MESSAGE_LENGTH_BITS 27
|
||||
|
||||
/** The maximum total number of unix fds in a message. Similar
|
||||
* rationale as DBUS_MAXIMUM_MESSAGE_LENGTH. However we divide by four
|
||||
* given that one fd is an int and hence at least 32 bits.
|
||||
*/
|
||||
#define DBUS_MAXIMUM_MESSAGE_UNIX_FDS (DBUS_MAXIMUM_MESSAGE_LENGTH/4)
|
||||
/** Number of bits you need in an unsigned to store the max message unix fds */
|
||||
#define DBUS_MAXIMUM_MESSAGE_UNIX_FDS_BITS (DBUS_MAXIMUM_MESSAGE_LENGTH_BITS-2)
|
||||
|
||||
/** Depth of recursion in the type tree. This is automatically limited
|
||||
* to DBUS_MAXIMUM_SIGNATURE_LENGTH since you could only have an array
|
||||
* of array of array of ... that fit in the max signature. But that's
|
||||
* probably a bit too large.
|
||||
*/
|
||||
#define DBUS_MAXIMUM_TYPE_RECURSION_DEPTH 32
|
||||
|
||||
/* Types of message */
|
||||
|
||||
/** This value is never a valid message type, see dbus_message_get_type() */
|
||||
#define DBUS_MESSAGE_TYPE_INVALID 0
|
||||
/** Message type of a method call message, see dbus_message_get_type() */
|
||||
#define DBUS_MESSAGE_TYPE_METHOD_CALL 1
|
||||
/** Message type of a method return message, see dbus_message_get_type() */
|
||||
#define DBUS_MESSAGE_TYPE_METHOD_RETURN 2
|
||||
/** Message type of an error reply message, see dbus_message_get_type() */
|
||||
#define DBUS_MESSAGE_TYPE_ERROR 3
|
||||
/** Message type of a signal message, see dbus_message_get_type() */
|
||||
#define DBUS_MESSAGE_TYPE_SIGNAL 4
|
||||
|
||||
#define DBUS_NUM_MESSAGE_TYPES 5
|
||||
|
||||
/* Header flags */
|
||||
|
||||
/** If set, this flag means that the sender of a message does not care about getting
|
||||
* a reply, so the recipient need not send one. See dbus_message_set_no_reply().
|
||||
*/
|
||||
#define DBUS_HEADER_FLAG_NO_REPLY_EXPECTED 0x1
|
||||
/**
|
||||
* If set, this flag means that even if the message bus knows how to start an owner for
|
||||
* the destination bus name (see dbus_message_set_destination()), it should not
|
||||
* do so. If this flag is not set, the bus may launch a program to process the
|
||||
* message.
|
||||
*/
|
||||
#define DBUS_HEADER_FLAG_NO_AUTO_START 0x2
|
||||
/**
|
||||
* If set on a method call, this flag means that the caller is prepared to
|
||||
* wait for interactive authorization.
|
||||
*/
|
||||
#define DBUS_HEADER_FLAG_ALLOW_INTERACTIVE_AUTHORIZATION 0x4
|
||||
|
||||
/* Header fields */
|
||||
|
||||
/** Not equal to any valid header field code */
|
||||
#define DBUS_HEADER_FIELD_INVALID 0
|
||||
/** Header field code for the path - the path is the object emitting a signal or the object receiving a method call.
|
||||
* See dbus_message_set_path().
|
||||
*/
|
||||
#define DBUS_HEADER_FIELD_PATH 1
|
||||
/** Header field code for the interface containing a member (method or signal).
|
||||
* See dbus_message_set_interface().
|
||||
*/
|
||||
#define DBUS_HEADER_FIELD_INTERFACE 2
|
||||
/** Header field code for a member (method or signal). See dbus_message_set_member(). */
|
||||
#define DBUS_HEADER_FIELD_MEMBER 3
|
||||
/** Header field code for an error name (found in #DBUS_MESSAGE_TYPE_ERROR messages).
|
||||
* See dbus_message_set_error_name().
|
||||
*/
|
||||
#define DBUS_HEADER_FIELD_ERROR_NAME 4
|
||||
/** Header field code for a reply serial, used to match a #DBUS_MESSAGE_TYPE_METHOD_RETURN message with the
|
||||
* message that it's a reply to. See dbus_message_set_reply_serial().
|
||||
*/
|
||||
#define DBUS_HEADER_FIELD_REPLY_SERIAL 5
|
||||
/**
|
||||
* Header field code for the destination bus name of a message. See dbus_message_set_destination().
|
||||
*/
|
||||
#define DBUS_HEADER_FIELD_DESTINATION 6
|
||||
/**
|
||||
* Header field code for the sender of a message; usually initialized by the message bus.
|
||||
* See dbus_message_set_sender().
|
||||
*/
|
||||
#define DBUS_HEADER_FIELD_SENDER 7
|
||||
/**
|
||||
* Header field code for the type signature of a message.
|
||||
*/
|
||||
#define DBUS_HEADER_FIELD_SIGNATURE 8
|
||||
/**
|
||||
* Header field code for the number of unix file descriptors associated
|
||||
* with this message.
|
||||
*/
|
||||
#define DBUS_HEADER_FIELD_UNIX_FDS 9
|
||||
/**
|
||||
* Header field code for the container instance that sent this message.
|
||||
*/
|
||||
#define DBUS_HEADER_FIELD_CONTAINER_INSTANCE 10
|
||||
|
||||
|
||||
/**
|
||||
* Value of the highest-numbered header field code, can be used to determine
|
||||
* the size of an array indexed by header field code. Remember though
|
||||
* that unknown codes must be ignored, so check for that before
|
||||
* indexing the array.
|
||||
*/
|
||||
#define DBUS_HEADER_FIELD_LAST DBUS_HEADER_FIELD_CONTAINER_INSTANCE
|
||||
|
||||
/** Header format is defined as a signature:
|
||||
* byte byte order
|
||||
* byte message type ID
|
||||
* byte flags
|
||||
* byte protocol version
|
||||
* uint32 body length
|
||||
* uint32 serial
|
||||
* array of struct (byte,variant) (field name, value)
|
||||
*
|
||||
* The length of the header can be computed as the
|
||||
* fixed size of the initial data, plus the length of
|
||||
* the array at the end, plus padding to an 8-boundary.
|
||||
*/
|
||||
#define DBUS_HEADER_SIGNATURE \
|
||||
DBUS_TYPE_BYTE_AS_STRING \
|
||||
DBUS_TYPE_BYTE_AS_STRING \
|
||||
DBUS_TYPE_BYTE_AS_STRING \
|
||||
DBUS_TYPE_BYTE_AS_STRING \
|
||||
DBUS_TYPE_UINT32_AS_STRING \
|
||||
DBUS_TYPE_UINT32_AS_STRING \
|
||||
DBUS_TYPE_ARRAY_AS_STRING \
|
||||
DBUS_STRUCT_BEGIN_CHAR_AS_STRING \
|
||||
DBUS_TYPE_BYTE_AS_STRING \
|
||||
DBUS_TYPE_VARIANT_AS_STRING \
|
||||
DBUS_STRUCT_END_CHAR_AS_STRING
|
||||
|
||||
|
||||
/**
|
||||
* The smallest header size that can occur. (It won't be valid due to
|
||||
* missing required header fields.) This is 4 bytes, two uint32, an
|
||||
* array length. This isn't any kind of resource limit, just the
|
||||
* necessary/logical outcome of the header signature.
|
||||
*/
|
||||
#define DBUS_MINIMUM_HEADER_SIZE 16
|
||||
|
||||
/* Errors */
|
||||
/* WARNING these get autoconverted to an enum in dbus-glib.h. Thus,
|
||||
* if you change the order it breaks the ABI. Keep them in order.
|
||||
* Also, don't change the formatting since that will break the sed
|
||||
* script.
|
||||
*/
|
||||
/** A generic error; "something went wrong" - see the error message for more. */
|
||||
#define DBUS_ERROR_FAILED "org.freedesktop.DBus.Error.Failed"
|
||||
/** There was not enough memory to complete an operation. */
|
||||
#define DBUS_ERROR_NO_MEMORY "org.freedesktop.DBus.Error.NoMemory"
|
||||
/** The bus doesn't know how to launch a service to supply the bus name you wanted. */
|
||||
#define DBUS_ERROR_SERVICE_UNKNOWN "org.freedesktop.DBus.Error.ServiceUnknown"
|
||||
/** The bus name you referenced doesn't exist (i.e. no application owns it). */
|
||||
#define DBUS_ERROR_NAME_HAS_NO_OWNER "org.freedesktop.DBus.Error.NameHasNoOwner"
|
||||
/** No reply to a message expecting one, usually means a timeout occurred. */
|
||||
#define DBUS_ERROR_NO_REPLY "org.freedesktop.DBus.Error.NoReply"
|
||||
/** Something went wrong reading or writing to a socket, for example. */
|
||||
#define DBUS_ERROR_IO_ERROR "org.freedesktop.DBus.Error.IOError"
|
||||
/** A D-Bus bus address was malformed. */
|
||||
#define DBUS_ERROR_BAD_ADDRESS "org.freedesktop.DBus.Error.BadAddress"
|
||||
/** Requested operation isn't supported (like ENOSYS on UNIX). */
|
||||
#define DBUS_ERROR_NOT_SUPPORTED "org.freedesktop.DBus.Error.NotSupported"
|
||||
/** Some limited resource is exhausted. */
|
||||
#define DBUS_ERROR_LIMITS_EXCEEDED "org.freedesktop.DBus.Error.LimitsExceeded"
|
||||
/** Security restrictions don't allow doing what you're trying to do. */
|
||||
#define DBUS_ERROR_ACCESS_DENIED "org.freedesktop.DBus.Error.AccessDenied"
|
||||
/** Authentication didn't work. */
|
||||
#define DBUS_ERROR_AUTH_FAILED "org.freedesktop.DBus.Error.AuthFailed"
|
||||
/** Unable to connect to server (probably caused by ECONNREFUSED on a socket). */
|
||||
#define DBUS_ERROR_NO_SERVER "org.freedesktop.DBus.Error.NoServer"
|
||||
/** Certain timeout errors, possibly ETIMEDOUT on a socket.
|
||||
* Note that #DBUS_ERROR_NO_REPLY is used for message reply timeouts.
|
||||
* @warning this is confusingly-named given that #DBUS_ERROR_TIMED_OUT also exists. We can't fix
|
||||
* it for compatibility reasons so just be careful.
|
||||
*/
|
||||
#define DBUS_ERROR_TIMEOUT "org.freedesktop.DBus.Error.Timeout"
|
||||
/** No network access (probably ENETUNREACH on a socket). */
|
||||
#define DBUS_ERROR_NO_NETWORK "org.freedesktop.DBus.Error.NoNetwork"
|
||||
/** Can't bind a socket since its address is in use (i.e. EADDRINUSE). */
|
||||
#define DBUS_ERROR_ADDRESS_IN_USE "org.freedesktop.DBus.Error.AddressInUse"
|
||||
/** The connection is disconnected and you're trying to use it. */
|
||||
#define DBUS_ERROR_DISCONNECTED "org.freedesktop.DBus.Error.Disconnected"
|
||||
/** Invalid arguments passed to a method call. */
|
||||
#define DBUS_ERROR_INVALID_ARGS "org.freedesktop.DBus.Error.InvalidArgs"
|
||||
/** Missing file. */
|
||||
#define DBUS_ERROR_FILE_NOT_FOUND "org.freedesktop.DBus.Error.FileNotFound"
|
||||
/** Existing file and the operation you're using does not silently overwrite. */
|
||||
#define DBUS_ERROR_FILE_EXISTS "org.freedesktop.DBus.Error.FileExists"
|
||||
/** Method name you invoked isn't known by the object you invoked it on. */
|
||||
#define DBUS_ERROR_UNKNOWN_METHOD "org.freedesktop.DBus.Error.UnknownMethod"
|
||||
/** Object you invoked a method on isn't known. */
|
||||
#define DBUS_ERROR_UNKNOWN_OBJECT "org.freedesktop.DBus.Error.UnknownObject"
|
||||
/** Interface you invoked a method on isn't known by the object. */
|
||||
#define DBUS_ERROR_UNKNOWN_INTERFACE "org.freedesktop.DBus.Error.UnknownInterface"
|
||||
/** Property you tried to access isn't known by the object. */
|
||||
#define DBUS_ERROR_UNKNOWN_PROPERTY "org.freedesktop.DBus.Error.UnknownProperty"
|
||||
/** Property you tried to set is read-only. */
|
||||
#define DBUS_ERROR_PROPERTY_READ_ONLY "org.freedesktop.DBus.Error.PropertyReadOnly"
|
||||
/** Certain timeout errors, e.g. while starting a service.
|
||||
* @warning this is confusingly-named given that #DBUS_ERROR_TIMEOUT also exists. We can't fix
|
||||
* it for compatibility reasons so just be careful.
|
||||
*/
|
||||
#define DBUS_ERROR_TIMED_OUT "org.freedesktop.DBus.Error.TimedOut"
|
||||
/** Tried to remove or modify a match rule that didn't exist. */
|
||||
#define DBUS_ERROR_MATCH_RULE_NOT_FOUND "org.freedesktop.DBus.Error.MatchRuleNotFound"
|
||||
/** The match rule isn't syntactically valid. */
|
||||
#define DBUS_ERROR_MATCH_RULE_INVALID "org.freedesktop.DBus.Error.MatchRuleInvalid"
|
||||
/** While starting a new process, the exec() call failed. */
|
||||
#define DBUS_ERROR_SPAWN_EXEC_FAILED "org.freedesktop.DBus.Error.Spawn.ExecFailed"
|
||||
/** While starting a new process, the fork() call failed. */
|
||||
#define DBUS_ERROR_SPAWN_FORK_FAILED "org.freedesktop.DBus.Error.Spawn.ForkFailed"
|
||||
/** While starting a new process, the child exited with a status code. */
|
||||
#define DBUS_ERROR_SPAWN_CHILD_EXITED "org.freedesktop.DBus.Error.Spawn.ChildExited"
|
||||
/** While starting a new process, the child exited on a signal. */
|
||||
#define DBUS_ERROR_SPAWN_CHILD_SIGNALED "org.freedesktop.DBus.Error.Spawn.ChildSignaled"
|
||||
/** While starting a new process, something went wrong. */
|
||||
#define DBUS_ERROR_SPAWN_FAILED "org.freedesktop.DBus.Error.Spawn.Failed"
|
||||
/** We failed to setup the environment correctly. */
|
||||
#define DBUS_ERROR_SPAWN_SETUP_FAILED "org.freedesktop.DBus.Error.Spawn.FailedToSetup"
|
||||
/** We failed to setup the config parser correctly. */
|
||||
#define DBUS_ERROR_SPAWN_CONFIG_INVALID "org.freedesktop.DBus.Error.Spawn.ConfigInvalid"
|
||||
/** Bus name was not valid. */
|
||||
#define DBUS_ERROR_SPAWN_SERVICE_INVALID "org.freedesktop.DBus.Error.Spawn.ServiceNotValid"
|
||||
/** Service file not found in system-services directory. */
|
||||
#define DBUS_ERROR_SPAWN_SERVICE_NOT_FOUND "org.freedesktop.DBus.Error.Spawn.ServiceNotFound"
|
||||
/** Permissions are incorrect on the setuid helper. */
|
||||
#define DBUS_ERROR_SPAWN_PERMISSIONS_INVALID "org.freedesktop.DBus.Error.Spawn.PermissionsInvalid"
|
||||
/** Service file invalid (Name, User or Exec missing). */
|
||||
#define DBUS_ERROR_SPAWN_FILE_INVALID "org.freedesktop.DBus.Error.Spawn.FileInvalid"
|
||||
/** There was not enough memory to complete the operation. */
|
||||
#define DBUS_ERROR_SPAWN_NO_MEMORY "org.freedesktop.DBus.Error.Spawn.NoMemory"
|
||||
/** Tried to get a UNIX process ID and it wasn't available. */
|
||||
#define DBUS_ERROR_UNIX_PROCESS_ID_UNKNOWN "org.freedesktop.DBus.Error.UnixProcessIdUnknown"
|
||||
/** A type signature is not valid. */
|
||||
#define DBUS_ERROR_INVALID_SIGNATURE "org.freedesktop.DBus.Error.InvalidSignature"
|
||||
/** A file contains invalid syntax or is otherwise broken. */
|
||||
#define DBUS_ERROR_INVALID_FILE_CONTENT "org.freedesktop.DBus.Error.InvalidFileContent"
|
||||
/** Asked for SELinux security context and it wasn't available. */
|
||||
#define DBUS_ERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN "org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown"
|
||||
/** Asked for ADT audit data and it wasn't available. */
|
||||
#define DBUS_ERROR_ADT_AUDIT_DATA_UNKNOWN "org.freedesktop.DBus.Error.AdtAuditDataUnknown"
|
||||
/** There's already an object with the requested object path. */
|
||||
#define DBUS_ERROR_OBJECT_PATH_IN_USE "org.freedesktop.DBus.Error.ObjectPathInUse"
|
||||
/** The message meta data does not match the payload. e.g. expected
|
||||
number of file descriptors were not sent over the socket this message was received on. */
|
||||
#define DBUS_ERROR_INCONSISTENT_MESSAGE "org.freedesktop.DBus.Error.InconsistentMessage"
|
||||
/** The message is not allowed without performing interactive authorization,
|
||||
* but could have succeeded if an interactive authorization step was
|
||||
* allowed. */
|
||||
#define DBUS_ERROR_INTERACTIVE_AUTHORIZATION_REQUIRED "org.freedesktop.DBus.Error.InteractiveAuthorizationRequired"
|
||||
/** The connection is not from a container, or the specified container instance
|
||||
* does not exist. */
|
||||
#define DBUS_ERROR_NOT_CONTAINER "org.freedesktop.DBus.Error.NotContainer"
|
||||
|
||||
/* XML introspection format */
|
||||
|
||||
/** XML namespace of the introspection format version 1.0 */
|
||||
#define DBUS_INTROSPECT_1_0_XML_NAMESPACE "http://www.freedesktop.org/standards/dbus"
|
||||
/** XML public identifier of the introspection format version 1.0 */
|
||||
#define DBUS_INTROSPECT_1_0_XML_PUBLIC_IDENTIFIER "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
||||
/** XML system identifier of the introspection format version 1.0 */
|
||||
#define DBUS_INTROSPECT_1_0_XML_SYSTEM_IDENTIFIER "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"
|
||||
/** XML document type declaration of the introspection format version 1.0 */
|
||||
#define DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE "<!DOCTYPE node PUBLIC \"" DBUS_INTROSPECT_1_0_XML_PUBLIC_IDENTIFIER "\"\n\"" DBUS_INTROSPECT_1_0_XML_SYSTEM_IDENTIFIER "\">\n"
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if 0
|
||||
{ /* avoids confusing emacs indentation */
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DBUS_PROTOCOL_H */
|
|
@ -0,0 +1,127 @@
|
|||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
/* dbus-server.h DBusServer object
|
||||
*
|
||||
* Copyright (C) 2002, 2003 Red Hat Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
|
||||
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
|
||||
#endif
|
||||
|
||||
#ifndef DBUS_SERVER_H
|
||||
#define DBUS_SERVER_H
|
||||
|
||||
#include <dbus/dbus-errors.h>
|
||||
#include <dbus/dbus-macros.h>
|
||||
#include <dbus/dbus-message.h>
|
||||
#include <dbus/dbus-connection.h>
|
||||
#include <dbus/dbus-protocol.h>
|
||||
|
||||
DBUS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* @addtogroup DBusServer
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef struct DBusServer DBusServer;
|
||||
|
||||
/** Called when a new connection to the server is available. Must reference and save the new
|
||||
* connection, or close the new connection. Set with dbus_server_set_new_connection_function().
|
||||
*/
|
||||
typedef void (* DBusNewConnectionFunction) (DBusServer *server,
|
||||
DBusConnection *new_connection,
|
||||
void *data);
|
||||
|
||||
DBUS_EXPORT
|
||||
DBusServer* dbus_server_listen (const char *address,
|
||||
DBusError *error);
|
||||
DBUS_EXPORT
|
||||
DBusServer* dbus_server_ref (DBusServer *server);
|
||||
DBUS_EXPORT
|
||||
void dbus_server_unref (DBusServer *server);
|
||||
DBUS_EXPORT
|
||||
void dbus_server_disconnect (DBusServer *server);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_server_get_is_connected (DBusServer *server);
|
||||
DBUS_EXPORT
|
||||
char* dbus_server_get_address (DBusServer *server);
|
||||
DBUS_EXPORT
|
||||
char* dbus_server_get_id (DBusServer *server);
|
||||
DBUS_EXPORT
|
||||
void dbus_server_set_new_connection_function (DBusServer *server,
|
||||
DBusNewConnectionFunction function,
|
||||
void *data,
|
||||
DBusFreeFunction free_data_function);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_server_set_watch_functions (DBusServer *server,
|
||||
DBusAddWatchFunction add_function,
|
||||
DBusRemoveWatchFunction remove_function,
|
||||
DBusWatchToggledFunction toggled_function,
|
||||
void *data,
|
||||
DBusFreeFunction free_data_function);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_server_set_timeout_functions (DBusServer *server,
|
||||
DBusAddTimeoutFunction add_function,
|
||||
DBusRemoveTimeoutFunction remove_function,
|
||||
DBusTimeoutToggledFunction toggled_function,
|
||||
void *data,
|
||||
DBusFreeFunction free_data_function);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_server_set_auth_mechanisms (DBusServer *server,
|
||||
const char **mechanisms);
|
||||
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_server_allocate_data_slot (dbus_int32_t *slot_p);
|
||||
DBUS_EXPORT
|
||||
void dbus_server_free_data_slot (dbus_int32_t *slot_p);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_server_set_data (DBusServer *server,
|
||||
int slot,
|
||||
void *data,
|
||||
DBusFreeFunction free_data_func);
|
||||
DBUS_EXPORT
|
||||
void* dbus_server_get_data (DBusServer *server,
|
||||
int slot);
|
||||
|
||||
/**
|
||||
* Clear a variable or struct member that contains a #DBusServer.
|
||||
* If it does not contain #NULL, the server that was previously
|
||||
* there is unreferenced with dbus_server_unref().
|
||||
*
|
||||
* This is very similar to dbus_clear_connection(): see that function
|
||||
* for more details.
|
||||
*
|
||||
* @param pointer_to_server A pointer to a variable or struct member.
|
||||
* pointer_to_server must not be #NULL, but *pointer_to_server
|
||||
* may be #NULL.
|
||||
*/
|
||||
static inline void
|
||||
dbus_clear_server (DBusServer **pointer_to_server)
|
||||
{
|
||||
_dbus_clear_pointer_impl (DBusServer, pointer_to_server, dbus_server_unref);
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
DBUS_END_DECLS
|
||||
|
||||
#endif /* DBUS_SERVER_H */
|
|
@ -0,0 +1,138 @@
|
|||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
/* dbus-shared.h Stuff used by both dbus/dbus.h low-level and C/C++ binding APIs
|
||||
*
|
||||
* Copyright (C) 2004 Red Hat, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DBUS_SHARED_H
|
||||
#define DBUS_SHARED_H
|
||||
|
||||
/* Don't include anything in here from anywhere else. It's
|
||||
* intended for use by any random library.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#if 0
|
||||
} /* avoids confusing emacs indentation */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Normally docs are in .c files, but there isn't a .c file for this. */
|
||||
/**
|
||||
* @defgroup DBusShared Shared constants
|
||||
* @ingroup DBus
|
||||
*
|
||||
* @brief Shared header included by both libdbus and C/C++ bindings such as the GLib bindings.
|
||||
*
|
||||
* Usually a C/C++ binding such as the GLib or Qt binding won't want to include dbus.h in its
|
||||
* public headers. However, a few constants and macros may be useful to include; those are
|
||||
* found here and in dbus-protocol.h
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Well-known bus types. See dbus_bus_get().
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
DBUS_BUS_SESSION, /**< The login session bus */
|
||||
DBUS_BUS_SYSTEM, /**< The systemwide bus */
|
||||
DBUS_BUS_STARTER /**< The bus that started us, if any */
|
||||
} DBusBusType;
|
||||
|
||||
/**
|
||||
* Results that a message handler can return.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
DBUS_HANDLER_RESULT_HANDLED, /**< Message has had its effect - no need to run more handlers. */
|
||||
DBUS_HANDLER_RESULT_NOT_YET_HANDLED, /**< Message has not had any effect - see if other handlers want it. */
|
||||
DBUS_HANDLER_RESULT_NEED_MEMORY /**< Need more memory in order to return #DBUS_HANDLER_RESULT_HANDLED or #DBUS_HANDLER_RESULT_NOT_YET_HANDLED. Please try again later with more memory. */
|
||||
} DBusHandlerResult;
|
||||
|
||||
/* Bus names */
|
||||
|
||||
/** The bus name used to talk to the bus itself. */
|
||||
#define DBUS_SERVICE_DBUS "org.freedesktop.DBus"
|
||||
|
||||
/* Paths */
|
||||
/** The object path used to talk to the bus itself. */
|
||||
#define DBUS_PATH_DBUS "/org/freedesktop/DBus"
|
||||
/** The object path used in local/in-process-generated messages. */
|
||||
#define DBUS_PATH_LOCAL "/org/freedesktop/DBus/Local"
|
||||
|
||||
/* Interfaces, these #define don't do much other than
|
||||
* catch typos at compile time
|
||||
*/
|
||||
/** The interface exported by the object with #DBUS_SERVICE_DBUS and #DBUS_PATH_DBUS */
|
||||
#define DBUS_INTERFACE_DBUS "org.freedesktop.DBus"
|
||||
/** The monitoring interface exported by the dbus-daemon */
|
||||
#define DBUS_INTERFACE_MONITORING "org.freedesktop.DBus.Monitoring"
|
||||
|
||||
/** The verbose interface exported by the dbus-daemon */
|
||||
#define DBUS_INTERFACE_VERBOSE "org.freedesktop.DBus.Verbose"
|
||||
/** The interface supported by introspectable objects */
|
||||
#define DBUS_INTERFACE_INTROSPECTABLE "org.freedesktop.DBus.Introspectable"
|
||||
/** The interface supported by objects with properties */
|
||||
#define DBUS_INTERFACE_PROPERTIES "org.freedesktop.DBus.Properties"
|
||||
/** The interface supported by most dbus peers */
|
||||
#define DBUS_INTERFACE_PEER "org.freedesktop.DBus.Peer"
|
||||
|
||||
/** This is a special interface whose methods can only be invoked
|
||||
* by the local implementation (messages from remote apps aren't
|
||||
* allowed to specify this interface).
|
||||
*/
|
||||
#define DBUS_INTERFACE_LOCAL "org.freedesktop.DBus.Local"
|
||||
|
||||
/* Owner flags */
|
||||
#define DBUS_NAME_FLAG_ALLOW_REPLACEMENT 0x1 /**< Allow another service to become the primary owner if requested */
|
||||
#define DBUS_NAME_FLAG_REPLACE_EXISTING 0x2 /**< Request to replace the current primary owner */
|
||||
#define DBUS_NAME_FLAG_DO_NOT_QUEUE 0x4 /**< If we can not become the primary owner do not place us in the queue */
|
||||
|
||||
/* Replies to request for a name */
|
||||
#define DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER 1 /**< Service has become the primary owner of the requested name */
|
||||
#define DBUS_REQUEST_NAME_REPLY_IN_QUEUE 2 /**< Service could not become the primary owner and has been placed in the queue */
|
||||
#define DBUS_REQUEST_NAME_REPLY_EXISTS 3 /**< Service is already in the queue */
|
||||
#define DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER 4 /**< Service is already the primary owner */
|
||||
|
||||
/* Replies to releasing a name */
|
||||
#define DBUS_RELEASE_NAME_REPLY_RELEASED 1 /**< Service was released from the given name */
|
||||
#define DBUS_RELEASE_NAME_REPLY_NON_EXISTENT 2 /**< The given name does not exist on the bus */
|
||||
#define DBUS_RELEASE_NAME_REPLY_NOT_OWNER 3 /**< Service is not an owner of the given name */
|
||||
|
||||
/* Replies to service starts */
|
||||
#define DBUS_START_REPLY_SUCCESS 1 /**< Service was auto started */
|
||||
#define DBUS_START_REPLY_ALREADY_RUNNING 2 /**< Service was already running */
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if 0
|
||||
{ /* avoids confusing emacs indentation */
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DBUS_SHARED_H */
|
|
@ -0,0 +1,97 @@
|
|||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
/* dbus-signatures.h utility functions for D-Bus types
|
||||
*
|
||||
* Copyright (C) 2005 Red Hat Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
|
||||
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
|
||||
#endif
|
||||
|
||||
#ifndef DBUS_SIGNATURES_H
|
||||
#define DBUS_SIGNATURES_H
|
||||
|
||||
#include <dbus/dbus-macros.h>
|
||||
#include <dbus/dbus-types.h>
|
||||
#include <dbus/dbus-errors.h>
|
||||
|
||||
DBUS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* @addtogroup DBusSignature
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* DBusSignatureIter struct; contains no public fields
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
void *dummy1; /**< Don't use this */
|
||||
void *dummy2; /**< Don't use this */
|
||||
dbus_uint32_t dummy8; /**< Don't use this */
|
||||
int dummy12; /**< Don't use this */
|
||||
int dummy17; /**< Don't use this */
|
||||
} DBusSignatureIter;
|
||||
|
||||
DBUS_EXPORT
|
||||
void dbus_signature_iter_init (DBusSignatureIter *iter,
|
||||
const char *signature);
|
||||
|
||||
DBUS_EXPORT
|
||||
int dbus_signature_iter_get_current_type (const DBusSignatureIter *iter);
|
||||
|
||||
DBUS_EXPORT
|
||||
char * dbus_signature_iter_get_signature (const DBusSignatureIter *iter);
|
||||
|
||||
DBUS_EXPORT
|
||||
int dbus_signature_iter_get_element_type (const DBusSignatureIter *iter);
|
||||
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_signature_iter_next (DBusSignatureIter *iter);
|
||||
|
||||
DBUS_EXPORT
|
||||
void dbus_signature_iter_recurse (const DBusSignatureIter *iter,
|
||||
DBusSignatureIter *subiter);
|
||||
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_signature_validate (const char *signature,
|
||||
DBusError *error);
|
||||
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_signature_validate_single (const char *signature,
|
||||
DBusError *error);
|
||||
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_type_is_valid (int typecode);
|
||||
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_type_is_basic (int typecode);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_type_is_container (int typecode);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_type_is_fixed (int typecode);
|
||||
|
||||
/** @} */
|
||||
|
||||
DBUS_END_DECLS
|
||||
|
||||
#endif /* DBUS_SIGNATURE_H */
|
|
@ -0,0 +1,60 @@
|
|||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
/* dbus-syntax.h - utility functions for strings with special syntax
|
||||
*
|
||||
* Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
|
||||
* Copyright © 2011 Nokia Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
|
||||
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
|
||||
#endif
|
||||
|
||||
#ifndef DBUS_SYNTAX_H
|
||||
#define DBUS_SYNTAX_H
|
||||
|
||||
#include <dbus/dbus-macros.h>
|
||||
#include <dbus/dbus-types.h>
|
||||
#include <dbus/dbus-errors.h>
|
||||
|
||||
DBUS_BEGIN_DECLS
|
||||
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_validate_path (const char *path,
|
||||
DBusError *error);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_validate_interface (const char *name,
|
||||
DBusError *error);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_validate_member (const char *name,
|
||||
DBusError *error);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_validate_error_name (const char *name,
|
||||
DBusError *error);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_validate_bus_name (const char *name,
|
||||
DBusError *error);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_validate_utf8 (const char *alleged_utf8,
|
||||
DBusError *error);
|
||||
|
||||
DBUS_END_DECLS
|
||||
|
||||
#endif /* multiple-inclusion guard */
|
|
@ -0,0 +1,191 @@
|
|||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
/* dbus-threads.h D-Bus threads handling
|
||||
*
|
||||
* Copyright (C) 2002 Red Hat Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
|
||||
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
|
||||
#endif
|
||||
|
||||
#ifndef DBUS_THREADS_H
|
||||
#define DBUS_THREADS_H
|
||||
|
||||
#include <dbus/dbus-macros.h>
|
||||
#include <dbus/dbus-types.h>
|
||||
|
||||
DBUS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* @addtogroup DBusThreads
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** An opaque mutex type provided by the #DBusThreadFunctions implementation installed by dbus_threads_init(). */
|
||||
typedef struct DBusMutex DBusMutex;
|
||||
/** An opaque condition variable type provided by the #DBusThreadFunctions implementation installed by dbus_threads_init(). */
|
||||
typedef struct DBusCondVar DBusCondVar;
|
||||
|
||||
/** Deprecated, provide DBusRecursiveMutexNewFunction instead. */
|
||||
typedef DBusMutex* (* DBusMutexNewFunction) (void);
|
||||
/** Deprecated, provide DBusRecursiveMutexFreeFunction instead. */
|
||||
typedef void (* DBusMutexFreeFunction) (DBusMutex *mutex);
|
||||
/** Deprecated, provide DBusRecursiveMutexLockFunction instead. Return value is lock success, but gets ignored in practice. */
|
||||
typedef dbus_bool_t (* DBusMutexLockFunction) (DBusMutex *mutex);
|
||||
/** Deprecated, provide DBusRecursiveMutexUnlockFunction instead. Return value is unlock success, but gets ignored in practice. */
|
||||
typedef dbus_bool_t (* DBusMutexUnlockFunction) (DBusMutex *mutex);
|
||||
|
||||
/** Creates a new recursively-lockable mutex, or returns #NULL if not
|
||||
* enough memory. Can only fail due to lack of memory. Found in
|
||||
* #DBusThreadFunctions. Do not just use PTHREAD_MUTEX_RECURSIVE for
|
||||
* this, because it does not save/restore the recursion count when
|
||||
* waiting on a condition. libdbus requires the Java-style behavior
|
||||
* where the mutex is fully unlocked to wait on a condition.
|
||||
*/
|
||||
typedef DBusMutex* (* DBusRecursiveMutexNewFunction) (void);
|
||||
/** Frees a recursively-lockable mutex. Found in #DBusThreadFunctions.
|
||||
*/
|
||||
typedef void (* DBusRecursiveMutexFreeFunction) (DBusMutex *mutex);
|
||||
/** Locks a recursively-lockable mutex. Found in #DBusThreadFunctions.
|
||||
* Can only fail due to lack of memory.
|
||||
*/
|
||||
typedef void (* DBusRecursiveMutexLockFunction) (DBusMutex *mutex);
|
||||
/** Unlocks a recursively-lockable mutex. Found in #DBusThreadFunctions.
|
||||
* Can only fail due to lack of memory.
|
||||
*/
|
||||
typedef void (* DBusRecursiveMutexUnlockFunction) (DBusMutex *mutex);
|
||||
|
||||
/** Creates a new condition variable. Found in #DBusThreadFunctions.
|
||||
* Can only fail (returning #NULL) due to lack of memory.
|
||||
*/
|
||||
typedef DBusCondVar* (* DBusCondVarNewFunction) (void);
|
||||
/** Frees a condition variable. Found in #DBusThreadFunctions.
|
||||
*/
|
||||
typedef void (* DBusCondVarFreeFunction) (DBusCondVar *cond);
|
||||
|
||||
/** Waits on a condition variable. Found in
|
||||
* #DBusThreadFunctions. Must work with either a recursive or
|
||||
* nonrecursive mutex, whichever the thread implementation
|
||||
* provides. Note that PTHREAD_MUTEX_RECURSIVE does not work with
|
||||
* condition variables (does not save/restore the recursion count) so
|
||||
* don't try using simply pthread_cond_wait() and a
|
||||
* PTHREAD_MUTEX_RECURSIVE to implement this, it won't work right.
|
||||
*
|
||||
* Has no error conditions. Must succeed if it returns.
|
||||
*/
|
||||
typedef void (* DBusCondVarWaitFunction) (DBusCondVar *cond,
|
||||
DBusMutex *mutex);
|
||||
|
||||
/** Waits on a condition variable with a timeout. Found in
|
||||
* #DBusThreadFunctions. Returns #TRUE if the wait did not
|
||||
* time out, and #FALSE if it did.
|
||||
*
|
||||
* Has no error conditions. Must succeed if it returns.
|
||||
*/
|
||||
typedef dbus_bool_t (* DBusCondVarWaitTimeoutFunction) (DBusCondVar *cond,
|
||||
DBusMutex *mutex,
|
||||
int timeout_milliseconds);
|
||||
/** Wakes one waiting thread on a condition variable. Found in #DBusThreadFunctions.
|
||||
*
|
||||
* Has no error conditions. Must succeed if it returns.
|
||||
*/
|
||||
typedef void (* DBusCondVarWakeOneFunction) (DBusCondVar *cond);
|
||||
|
||||
/** Wakes all waiting threads on a condition variable. Found in #DBusThreadFunctions.
|
||||
*
|
||||
* Has no error conditions. Must succeed if it returns.
|
||||
*/
|
||||
typedef void (* DBusCondVarWakeAllFunction) (DBusCondVar *cond);
|
||||
|
||||
/**
|
||||
* Flags indicating which functions are present in #DBusThreadFunctions. Used to allow
|
||||
* the library to detect older callers of dbus_threads_init() if new possible functions
|
||||
* are added to #DBusThreadFunctions.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
DBUS_THREAD_FUNCTIONS_MUTEX_NEW_MASK = 1 << 0,
|
||||
DBUS_THREAD_FUNCTIONS_MUTEX_FREE_MASK = 1 << 1,
|
||||
DBUS_THREAD_FUNCTIONS_MUTEX_LOCK_MASK = 1 << 2,
|
||||
DBUS_THREAD_FUNCTIONS_MUTEX_UNLOCK_MASK = 1 << 3,
|
||||
DBUS_THREAD_FUNCTIONS_CONDVAR_NEW_MASK = 1 << 4,
|
||||
DBUS_THREAD_FUNCTIONS_CONDVAR_FREE_MASK = 1 << 5,
|
||||
DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_MASK = 1 << 6,
|
||||
DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_TIMEOUT_MASK = 1 << 7,
|
||||
DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ONE_MASK = 1 << 8,
|
||||
DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ALL_MASK = 1 << 9,
|
||||
DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_NEW_MASK = 1 << 10,
|
||||
DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_FREE_MASK = 1 << 11,
|
||||
DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_LOCK_MASK = 1 << 12,
|
||||
DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_UNLOCK_MASK = 1 << 13,
|
||||
DBUS_THREAD_FUNCTIONS_ALL_MASK = (1 << 14) - 1
|
||||
} DBusThreadFunctionsMask;
|
||||
|
||||
/**
|
||||
* Functions that must be implemented to make the D-Bus library
|
||||
* thread-aware.
|
||||
*
|
||||
* If you supply both recursive and non-recursive mutexes,
|
||||
* libdbus will use the non-recursive version for condition variables,
|
||||
* and the recursive version in other contexts.
|
||||
*
|
||||
* The condition variable functions have to work with nonrecursive
|
||||
* mutexes if you provide those, or with recursive mutexes if you
|
||||
* don't.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
unsigned int mask; /**< Mask indicating which functions are present. */
|
||||
|
||||
DBusMutexNewFunction mutex_new; /**< Function to create a mutex; optional and deprecated. */
|
||||
DBusMutexFreeFunction mutex_free; /**< Function to free a mutex; optional and deprecated. */
|
||||
DBusMutexLockFunction mutex_lock; /**< Function to lock a mutex; optional and deprecated. */
|
||||
DBusMutexUnlockFunction mutex_unlock; /**< Function to unlock a mutex; optional and deprecated. */
|
||||
|
||||
DBusCondVarNewFunction condvar_new; /**< Function to create a condition variable */
|
||||
DBusCondVarFreeFunction condvar_free; /**< Function to free a condition variable */
|
||||
DBusCondVarWaitFunction condvar_wait; /**< Function to wait on a condition */
|
||||
DBusCondVarWaitTimeoutFunction condvar_wait_timeout; /**< Function to wait on a condition with a timeout */
|
||||
DBusCondVarWakeOneFunction condvar_wake_one; /**< Function to wake one thread waiting on the condition */
|
||||
DBusCondVarWakeAllFunction condvar_wake_all; /**< Function to wake all threads waiting on the condition */
|
||||
|
||||
DBusRecursiveMutexNewFunction recursive_mutex_new; /**< Function to create a recursive mutex */
|
||||
DBusRecursiveMutexFreeFunction recursive_mutex_free; /**< Function to free a recursive mutex */
|
||||
DBusRecursiveMutexLockFunction recursive_mutex_lock; /**< Function to lock a recursive mutex */
|
||||
DBusRecursiveMutexUnlockFunction recursive_mutex_unlock; /**< Function to unlock a recursive mutex */
|
||||
|
||||
void (* padding1) (void); /**< Reserved for future expansion */
|
||||
void (* padding2) (void); /**< Reserved for future expansion */
|
||||
void (* padding3) (void); /**< Reserved for future expansion */
|
||||
void (* padding4) (void); /**< Reserved for future expansion */
|
||||
|
||||
} DBusThreadFunctions;
|
||||
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_threads_init (const DBusThreadFunctions *functions);
|
||||
DBUS_EXPORT
|
||||
dbus_bool_t dbus_threads_init_default (void);
|
||||
|
||||
/** @} */
|
||||
|
||||
DBUS_END_DECLS
|
||||
|
||||
#endif /* DBUS_THREADS_H */
|
|
@ -0,0 +1,179 @@
|
|||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
/* dbus-types.h types such as dbus_bool_t
|
||||
*
|
||||
* Copyright (C) 2002 Red Hat Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
|
||||
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
|
||||
#endif
|
||||
|
||||
#ifndef DBUS_TYPES_H
|
||||
#define DBUS_TYPES_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <dbus/dbus-arch-deps.h>
|
||||
|
||||
typedef dbus_uint32_t dbus_unichar_t;
|
||||
/* boolean size must be fixed at 4 bytes due to wire protocol! */
|
||||
typedef dbus_uint32_t dbus_bool_t;
|
||||
|
||||
/* Normally docs are in .c files, but there isn't a .c file for this. */
|
||||
/**
|
||||
* @defgroup DBusTypes Basic types
|
||||
* @ingroup DBus
|
||||
* @brief dbus_bool_t, dbus_int32_t, etc.
|
||||
*
|
||||
* Typedefs for common primitive types.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef dbus_bool_t
|
||||
*
|
||||
* A boolean, valid values are #TRUE and #FALSE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef dbus_uint32_t
|
||||
*
|
||||
* A 32-bit unsigned integer on all platforms.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef dbus_int32_t
|
||||
*
|
||||
* A 32-bit signed integer on all platforms.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef dbus_uint16_t
|
||||
*
|
||||
* A 16-bit unsigned integer on all platforms.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef dbus_int16_t
|
||||
*
|
||||
* A 16-bit signed integer on all platforms.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @typedef dbus_uint64_t
|
||||
*
|
||||
* A 64-bit unsigned integer.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef dbus_int64_t
|
||||
*
|
||||
* A 64-bit signed integer.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def DBUS_HAVE_INT64
|
||||
*
|
||||
* Always defined.
|
||||
*
|
||||
* In older libdbus versions, this would be undefined if there was no
|
||||
* 64-bit integer type on that platform. libdbus no longer supports
|
||||
* such platforms.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def DBUS_INT64_CONSTANT
|
||||
*
|
||||
* Declare a 64-bit signed integer constant. The macro
|
||||
* adds the necessary "LL" or whatever after the integer,
|
||||
* giving a literal such as "325145246765LL"
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def DBUS_UINT64_CONSTANT
|
||||
*
|
||||
* Declare a 64-bit unsigned integer constant. The macro
|
||||
* adds the necessary "ULL" or whatever after the integer,
|
||||
* giving a literal such as "325145246765ULL"
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def DBUS_INT64_MODIFIER
|
||||
*
|
||||
* A string literal for a length modifier that is appropriate to print
|
||||
* the #dbus_int64_t and #dbus_uint64_t types.
|
||||
* For example, it might be an empty string, "l", "ll", or "I64".
|
||||
*
|
||||
* This modifier needs to be concatenated with a literal "%" and a
|
||||
* conversion specifier that can print signed or unsigned integers,
|
||||
* for example:
|
||||
*
|
||||
* @code
|
||||
* dbus_int64_t i = -123;
|
||||
* dbus_uint64_t u = 456;
|
||||
*
|
||||
* printf ("signed: %" DBUS_INT64_MODIFIER "d\n", i);
|
||||
* printf ("unsigned decimal: %" DBUS_INT64_MODIFIER "u\n", u);
|
||||
* printf ("unsigned hex: 0x%" DBUS_INT64_MODIFIER "x\n", x);
|
||||
* @endcode
|
||||
*/
|
||||
|
||||
/**
|
||||
* An 8-byte struct you could use to access int64 without having
|
||||
* int64 support. Use #dbus_int64_t or #dbus_uint64_t instead.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
dbus_uint32_t first32; /**< first 32 bits in the 8 bytes (beware endian issues) */
|
||||
dbus_uint32_t second32; /**< second 32 bits in the 8 bytes (beware endian issues) */
|
||||
} DBus8ByteStruct;
|
||||
|
||||
/**
|
||||
* A simple value union that lets you access bytes as if they
|
||||
* were various types; useful when dealing with basic types via
|
||||
* void pointers and varargs.
|
||||
*
|
||||
* This union also contains a pointer member (which can be used
|
||||
* to retrieve a string from dbus_message_iter_get_basic(), for
|
||||
* instance), so on future platforms it could conceivably be larger
|
||||
* than 8 bytes.
|
||||
*/
|
||||
typedef union
|
||||
{
|
||||
unsigned char bytes[8]; /**< as 8 individual bytes */
|
||||
dbus_int16_t i16; /**< as int16 */
|
||||
dbus_uint16_t u16; /**< as int16 */
|
||||
dbus_int32_t i32; /**< as int32 */
|
||||
dbus_uint32_t u32; /**< as int32 */
|
||||
dbus_bool_t bool_val; /**< as boolean */
|
||||
dbus_int64_t i64; /**< as int64 */
|
||||
dbus_uint64_t u64; /**< as int64 */
|
||||
DBus8ByteStruct eight; /**< as 8-byte struct */
|
||||
double dbl; /**< as double */
|
||||
unsigned char byt; /**< as byte */
|
||||
char *str; /**< as char* (string, object path or signature) */
|
||||
int fd; /**< as Unix file descriptor */
|
||||
} DBusBasicValue;
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* DBUS_TYPES_H */
|
|
@ -0,0 +1,106 @@
|
|||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
/* dbus.h Convenience header including all other headers
|
||||
*
|
||||
* Copyright (C) 2002, 2003 Red Hat Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later
|
||||
*
|
||||
* Licensed under the Academic Free License version 2.1
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DBUS_H
|
||||
#define DBUS_H
|
||||
|
||||
#define DBUS_INSIDE_DBUS_H 1
|
||||
|
||||
#include <dbus/dbus-arch-deps.h>
|
||||
#include <dbus/dbus-address.h>
|
||||
#include <dbus/dbus-bus.h>
|
||||
#include <dbus/dbus-connection.h>
|
||||
#include <dbus/dbus-errors.h>
|
||||
#include <dbus/dbus-macros.h>
|
||||
#include <dbus/dbus-message.h>
|
||||
#include <dbus/dbus-misc.h>
|
||||
#include <dbus/dbus-pending-call.h>
|
||||
#include <dbus/dbus-protocol.h>
|
||||
#include <dbus/dbus-server.h>
|
||||
#include <dbus/dbus-shared.h>
|
||||
#include <dbus/dbus-signature.h>
|
||||
#include <dbus/dbus-syntax.h>
|
||||
#include <dbus/dbus-threads.h>
|
||||
#include <dbus/dbus-types.h>
|
||||
|
||||
#undef DBUS_INSIDE_DBUS_H
|
||||
|
||||
/**
|
||||
* @defgroup DBus D-Bus low-level public API
|
||||
* @brief The low-level public API of the D-Bus library
|
||||
*
|
||||
* libdbus provides a low-level C API intended primarily for use by
|
||||
* bindings to specific object systems and languages. D-Bus is most
|
||||
* convenient when used with the GLib bindings, Python bindings, Qt
|
||||
* bindings, Mono bindings, and so forth. This low-level API has a
|
||||
* lot of complexity useful only for bindings.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @mainpage
|
||||
*
|
||||
* This manual documents the <em>low-level</em> D-Bus C API. <b>If you use
|
||||
* this low-level API directly, you're signing up for some pain.</b>
|
||||
*
|
||||
* Caveats aside, you might get started learning the low-level API by reading
|
||||
* about @ref DBusConnection and @ref DBusMessage.
|
||||
*
|
||||
* There are several other places to look for D-Bus information, such
|
||||
* as the tutorial and the specification; those can be found at <a
|
||||
* href="http://www.freedesktop.org/wiki/Software/dbus">the D-Bus
|
||||
* website</a>. If you're interested in a sysadmin or package
|
||||
* maintainer's perspective on the dbus-daemon itself and its
|
||||
* configuration, be sure to check out the man pages as well.
|
||||
*
|
||||
* The low-level API documented in this manual deliberately lacks
|
||||
* most convenience functions - those are left up to higher-level libraries
|
||||
* based on frameworks such as GLib, Qt, Python, Mono, Java,
|
||||
* etc. These higher-level libraries (often called "D-Bus bindings")
|
||||
* have features such as object systems and main loops that allow a
|
||||
* <em>much</em> more convenient API.
|
||||
*
|
||||
* The low-level API also contains plenty of clutter to support
|
||||
* integration with arbitrary object systems, languages, main loops,
|
||||
* and so forth. These features add a lot of noise to the API that you
|
||||
* probably don't care about unless you're coding a binding.
|
||||
*
|
||||
* This manual also contains docs for @ref DBusInternals "D-Bus internals",
|
||||
* so you can use it to get oriented to the D-Bus source code if you're
|
||||
* interested in patching the code. You should also read the
|
||||
* file CONTRIBUTING.md which comes with the source code if you plan to
|
||||
* contribute to D-Bus.
|
||||
*
|
||||
* As you read the code, you can identify internal D-Bus functions
|
||||
* because they start with an underscore ('_') character. Also, any
|
||||
* identifier or macro that lacks a DBus, dbus_, or DBUS_ namepace
|
||||
* prefix is internal, with a couple of exceptions such as #NULL,
|
||||
* #TRUE, and #FALSE.
|
||||
*/
|
||||
|
||||
#endif /* DBUS_H */
|
55
code/application/source/sf_app/tools/blue/include/eti.h
Normal file
55
code/application/source/sf_app/tools/blue/include/eti.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
/****************************************************************************
|
||||
* Copyright 2020 Thomas E. Dickey *
|
||||
* Copyright 1998-2002,2003 Free Software Foundation, Inc. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the *
|
||||
* "Software"), to deal in the Software without restriction, including *
|
||||
* without limitation the rights to use, copy, modify, merge, publish, *
|
||||
* distribute, distribute with modifications, sublicense, and/or sell *
|
||||
* copies of the Software, and to permit persons to whom the Software is *
|
||||
* furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included *
|
||||
* in all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
||||
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* Except as contained in this notice, the name(s) of the above copyright *
|
||||
* holders shall not be used in advertising or otherwise to promote the *
|
||||
* sale, use or other dealings in this Software without prior written *
|
||||
* authorization. *
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Author: Juergen Pfeifer, 1995,1997 *
|
||||
****************************************************************************/
|
||||
|
||||
/* $Id: eti.h,v 1.9 2020/02/02 23:34:34 tom Exp $ */
|
||||
|
||||
#ifndef NCURSES_ETI_H_incl
|
||||
#define NCURSES_ETI_H_incl 1
|
||||
|
||||
#define E_OK (0)
|
||||
#define E_SYSTEM_ERROR (-1)
|
||||
#define E_BAD_ARGUMENT (-2)
|
||||
#define E_POSTED (-3)
|
||||
#define E_CONNECTED (-4)
|
||||
#define E_BAD_STATE (-5)
|
||||
#define E_NO_ROOM (-6)
|
||||
#define E_NOT_POSTED (-7)
|
||||
#define E_UNKNOWN_COMMAND (-8)
|
||||
#define E_NO_MATCH (-9)
|
||||
#define E_NOT_SELECTABLE (-10)
|
||||
#define E_NOT_CONNECTED (-11)
|
||||
#define E_REQUEST_DENIED (-12)
|
||||
#define E_INVALID_FIELD (-13)
|
||||
#define E_CURRENT (-14)
|
||||
|
||||
#endif
|
1064
code/application/source/sf_app/tools/blue/include/expat.h
Normal file
1064
code/application/source/sf_app/tools/blue/include/expat.h
Normal file
File diff suppressed because it is too large
Load Diff
140
code/application/source/sf_app/tools/blue/include/expat_config.h
Normal file
140
code/application/source/sf_app/tools/blue/include/expat_config.h
Normal file
|
@ -0,0 +1,140 @@
|
|||
/* expat_config.h. Generated from expat_config.h.in by configure. */
|
||||
/* expat_config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
#ifndef EXPAT_CONFIG_H
|
||||
#define EXPAT_CONFIG_H 1
|
||||
|
||||
/* Define if building universal (internal helper macro) */
|
||||
/* #undef AC_APPLE_UNIVERSAL_BUILD */
|
||||
|
||||
/* 1234 = LILENDIAN, 4321 = BIGENDIAN */
|
||||
#define BYTEORDER 1234
|
||||
|
||||
/* Define to 1 if you have the `arc4random' function. */
|
||||
/* #undef HAVE_ARC4RANDOM */
|
||||
|
||||
/* Define to 1 if you have the `arc4random_buf' function. */
|
||||
/* #undef HAVE_ARC4RANDOM_BUF */
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#define HAVE_DLFCN_H 1
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H 1
|
||||
|
||||
/* Define to 1 if you have the `getpagesize' function. */
|
||||
#define HAVE_GETPAGESIZE 1
|
||||
|
||||
/* Define to 1 if you have the `getrandom' function. */
|
||||
#define HAVE_GETRANDOM 1
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#define HAVE_INTTYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the `bsd' library (-lbsd). */
|
||||
/* #undef HAVE_LIBBSD */
|
||||
|
||||
/* Define to 1 if you have a working `mmap' system call. */
|
||||
#define HAVE_MMAP 1
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#define HAVE_STDINT_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdio.h> header file. */
|
||||
#define HAVE_STDIO_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#define HAVE_STRINGS_H 1
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if you have `syscall' and `SYS_getrandom'. */
|
||||
#define HAVE_SYSCALL_GETRANDOM 1
|
||||
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||
#define HAVE_SYS_PARAM_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Define to the sub-directory where libtool stores uninstalled libraries. */
|
||||
#define LT_OBJDIR ".libs/"
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "expat"
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT "expat-bugs@libexpat.org"
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "expat"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "expat 2.5.0"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "expat"
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#define PACKAGE_URL ""
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "2.5.0"
|
||||
|
||||
/* Define to 1 if all of the C90 standard headers exist (not just the ones
|
||||
required in a freestanding environment). This macro is provided for
|
||||
backward compatibility; new code need not use it. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "2.5.0"
|
||||
|
||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */
|
||||
#if defined AC_APPLE_UNIVERSAL_BUILD
|
||||
# if defined __BIG_ENDIAN__
|
||||
# define WORDS_BIGENDIAN 1
|
||||
# endif
|
||||
#else
|
||||
# ifndef WORDS_BIGENDIAN
|
||||
/* # undef WORDS_BIGENDIAN */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Define to allow retrieving the byte offsets for attribute names and values.
|
||||
*/
|
||||
/* #undef XML_ATTR_INFO */
|
||||
|
||||
/* Define to specify how much context to retain around the current parse
|
||||
point. */
|
||||
#define XML_CONTEXT_BYTES 1024
|
||||
|
||||
/* Define to include code reading entropy from `/dev/urandom'. */
|
||||
#define XML_DEV_URANDOM 1
|
||||
|
||||
/* Define to make parameter entity parsing functionality available. */
|
||||
#define XML_DTD 1
|
||||
|
||||
/* Define to make XML Namespaces functionality available. */
|
||||
#define XML_NS 1
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
/* #undef const */
|
||||
|
||||
/* Define to `long int' if <sys/types.h> does not define. */
|
||||
/* #undef off_t */
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
/* #undef size_t */
|
||||
|
||||
#endif // ndef EXPAT_CONFIG_H
|
|
@ -0,0 +1,165 @@
|
|||
/*
|
||||
__ __ _
|
||||
___\ \/ /_ __ __ _| |_
|
||||
/ _ \\ /| '_ \ / _` | __|
|
||||
| __// \| |_) | (_| | |_
|
||||
\___/_/\_\ .__/ \__,_|\__|
|
||||
|_| XML parser
|
||||
|
||||
Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
|
||||
Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
|
||||
Copyright (c) 2000-2004 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
|
||||
Copyright (c) 2001-2002 Greg Stein <gstein@users.sourceforge.net>
|
||||
Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
|
||||
Copyright (c) 2016 Cristian Rodríguez <crrodriguez@opensuse.org>
|
||||
Copyright (c) 2016-2019 Sebastian Pipping <sebastian@pipping.org>
|
||||
Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
|
||||
Copyright (c) 2018 Yury Gribov <tetra2005@gmail.com>
|
||||
Licensed under the MIT license:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the
|
||||
following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef Expat_External_INCLUDED
|
||||
#define Expat_External_INCLUDED 1
|
||||
|
||||
/* External API definitions */
|
||||
|
||||
/* Expat tries very hard to make the API boundary very specifically
|
||||
defined. There are two macros defined to control this boundary;
|
||||
each of these can be defined before including this header to
|
||||
achieve some different behavior, but doing so it not recommended or
|
||||
tested frequently.
|
||||
|
||||
XMLCALL - The calling convention to use for all calls across the
|
||||
"library boundary." This will default to cdecl, and
|
||||
try really hard to tell the compiler that's what we
|
||||
want.
|
||||
|
||||
XMLIMPORT - Whatever magic is needed to note that a function is
|
||||
to be imported from a dynamically loaded library
|
||||
(.dll, .so, or .sl, depending on your platform).
|
||||
|
||||
The XMLCALL macro was added in Expat 1.95.7. The only one which is
|
||||
expected to be directly useful in client code is XMLCALL.
|
||||
|
||||
Note that on at least some Unix versions, the Expat library must be
|
||||
compiled with the cdecl calling convention as the default since
|
||||
system headers may assume the cdecl convention.
|
||||
*/
|
||||
#ifndef XMLCALL
|
||||
# if defined(_MSC_VER)
|
||||
# define XMLCALL __cdecl
|
||||
# elif defined(__GNUC__) && defined(__i386) && ! defined(__INTEL_COMPILER)
|
||||
# define XMLCALL __attribute__((cdecl))
|
||||
# else
|
||||
/* For any platform which uses this definition and supports more than
|
||||
one calling convention, we need to extend this definition to
|
||||
declare the convention used on that platform, if it's possible to
|
||||
do so.
|
||||
|
||||
If this is the case for your platform, please file a bug report
|
||||
with information on how to identify your platform via the C
|
||||
pre-processor and how to specify the same calling convention as the
|
||||
platform's malloc() implementation.
|
||||
*/
|
||||
# define XMLCALL
|
||||
# endif
|
||||
#endif /* not defined XMLCALL */
|
||||
|
||||
#if ! defined(XML_STATIC) && ! defined(XMLIMPORT)
|
||||
# ifndef XML_BUILDING_EXPAT
|
||||
/* using Expat from an application */
|
||||
|
||||
# if defined(_MSC_EXTENSIONS) && ! defined(__BEOS__) && ! defined(__CYGWIN__)
|
||||
# define XMLIMPORT __declspec(dllimport)
|
||||
# endif
|
||||
|
||||
# endif
|
||||
#endif /* not defined XML_STATIC */
|
||||
|
||||
#ifndef XML_ENABLE_VISIBILITY
|
||||
# define XML_ENABLE_VISIBILITY 0
|
||||
#endif
|
||||
|
||||
#if ! defined(XMLIMPORT) && XML_ENABLE_VISIBILITY
|
||||
# define XMLIMPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
/* If we didn't define it above, define it away: */
|
||||
#ifndef XMLIMPORT
|
||||
# define XMLIMPORT
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) \
|
||||
&& (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
|
||||
# define XML_ATTR_MALLOC __attribute__((__malloc__))
|
||||
#else
|
||||
# define XML_ATTR_MALLOC
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) \
|
||||
&& ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
|
||||
# define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
|
||||
#else
|
||||
# define XML_ATTR_ALLOC_SIZE(x)
|
||||
#endif
|
||||
|
||||
#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef XML_UNICODE_WCHAR_T
|
||||
# ifndef XML_UNICODE
|
||||
# define XML_UNICODE
|
||||
# endif
|
||||
# if defined(__SIZEOF_WCHAR_T__) && (__SIZEOF_WCHAR_T__ != 2)
|
||||
# error "sizeof(wchar_t) != 2; Need -fshort-wchar for both Expat and libc"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef XML_UNICODE /* Information is UTF-16 encoded. */
|
||||
# ifdef XML_UNICODE_WCHAR_T
|
||||
typedef wchar_t XML_Char;
|
||||
typedef wchar_t XML_LChar;
|
||||
# else
|
||||
typedef unsigned short XML_Char;
|
||||
typedef char XML_LChar;
|
||||
# endif /* XML_UNICODE_WCHAR_T */
|
||||
#else /* Information is UTF-8 encoded. */
|
||||
typedef char XML_Char;
|
||||
typedef char XML_LChar;
|
||||
#endif /* XML_UNICODE */
|
||||
|
||||
#ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */
|
||||
typedef long long XML_Index;
|
||||
typedef unsigned long long XML_Size;
|
||||
#else
|
||||
typedef long XML_Index;
|
||||
typedef unsigned long XML_Size;
|
||||
#endif /* XML_LARGE_SIZE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not Expat_External_INCLUDED */
|
500
code/application/source/sf_app/tools/blue/include/ffi-arm.h
Normal file
500
code/application/source/sf_app/tools/blue/include/ffi-arm.h
Normal file
|
@ -0,0 +1,500 @@
|
|||
/* -----------------------------------------------------------------*-C-*-
|
||||
libffi 3.2.9999 - Copyright (c) 2011, 2014 Anthony Green
|
||||
- Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the ``Software''), to deal in the Software without
|
||||
restriction, including without limitation the rights to use, copy,
|
||||
modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
----------------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------
|
||||
Most of the API is documented in doc/libffi.texi.
|
||||
|
||||
The raw API is designed to bypass some of the argument packing and
|
||||
unpacking on architectures for which it can be avoided. Routines
|
||||
are provided to emulate the raw API if the underlying platform
|
||||
doesn't allow faster implementation.
|
||||
|
||||
More details on the raw API can be found in:
|
||||
|
||||
http://gcc.gnu.org/ml/java/1999-q3/msg00138.html
|
||||
|
||||
and
|
||||
|
||||
http://gcc.gnu.org/ml/java/1999-q3/msg00174.html
|
||||
-------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LIBFFI_H
|
||||
#define LIBFFI_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Specify which architecture libffi is configured for. */
|
||||
#ifndef ARM
|
||||
#define ARM
|
||||
#endif
|
||||
|
||||
/* ---- System configuration information --------------------------------- */
|
||||
|
||||
#include <ffitarget.h>
|
||||
|
||||
/* Need minimal decorations for DLLs to works on Windows. GCC has
|
||||
autoimport and autoexport. Rely on Libtool to help MSVC export
|
||||
from a DLL, but always declare data to be imported for MSVC
|
||||
clients. This costs an extra indirection for MSVC clients using
|
||||
the static version of the library, but don't worry about that.
|
||||
Besides, as a workaround, they can define FFI_BUILDING if they
|
||||
*know* they are going to link with the static library. */
|
||||
#if defined _MSC_VER && !defined FFI_STATIC_BUILD
|
||||
#ifdef FFI_BUILDING
|
||||
#define FFI_EXTERN __declspec(dllexport)
|
||||
#else
|
||||
#define FFI_EXTERN __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#define FFI_EXTERN extern
|
||||
#endif
|
||||
|
||||
#ifndef LIBFFI_ASM
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#define __attribute__(X)
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <limits.h>
|
||||
|
||||
/* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example).
|
||||
But we can find it either under the correct ANSI name, or under GNU
|
||||
C's internal name. */
|
||||
|
||||
#define FFI_64_BIT_MAX 9223372036854775807
|
||||
|
||||
#ifdef LONG_LONG_MAX
|
||||
# define FFI_LONG_LONG_MAX LONG_LONG_MAX
|
||||
#else
|
||||
# ifdef LLONG_MAX
|
||||
# define FFI_LONG_LONG_MAX LLONG_MAX
|
||||
# ifdef _AIX52 /* or newer has C99 LLONG_MAX */
|
||||
# undef FFI_64_BIT_MAX
|
||||
# define FFI_64_BIT_MAX 9223372036854775807LL
|
||||
# endif /* _AIX52 or newer */
|
||||
# else
|
||||
# ifdef __GNUC__
|
||||
# define FFI_LONG_LONG_MAX __LONG_LONG_MAX__
|
||||
# endif
|
||||
# ifdef _AIX /* AIX 5.1 and earlier have LONGLONG_MAX */
|
||||
# ifndef __PPC64__
|
||||
# if defined (__IBMC__) || defined (__IBMCPP__)
|
||||
# define FFI_LONG_LONG_MAX LONGLONG_MAX
|
||||
# endif
|
||||
# endif /* __PPC64__ */
|
||||
# undef FFI_64_BIT_MAX
|
||||
# define FFI_64_BIT_MAX 9223372036854775807LL
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The closure code assumes that this works on pointers, i.e. a size_t
|
||||
can hold a pointer. */
|
||||
|
||||
typedef struct _ffi_type
|
||||
{
|
||||
size_t size;
|
||||
unsigned short alignment;
|
||||
unsigned short type;
|
||||
struct _ffi_type **elements;
|
||||
} ffi_type;
|
||||
|
||||
#ifndef LIBFFI_HIDE_BASIC_TYPES
|
||||
#if SCHAR_MAX == 127
|
||||
# define ffi_type_uchar ffi_type_uint8
|
||||
# define ffi_type_schar ffi_type_sint8
|
||||
#else
|
||||
#error "char size not supported"
|
||||
#endif
|
||||
|
||||
#if SHRT_MAX == 32767
|
||||
# define ffi_type_ushort ffi_type_uint16
|
||||
# define ffi_type_sshort ffi_type_sint16
|
||||
#elif SHRT_MAX == 2147483647
|
||||
# define ffi_type_ushort ffi_type_uint32
|
||||
# define ffi_type_sshort ffi_type_sint32
|
||||
#else
|
||||
#error "short size not supported"
|
||||
#endif
|
||||
|
||||
#if INT_MAX == 32767
|
||||
# define ffi_type_uint ffi_type_uint16
|
||||
# define ffi_type_sint ffi_type_sint16
|
||||
#elif INT_MAX == 2147483647
|
||||
# define ffi_type_uint ffi_type_uint32
|
||||
# define ffi_type_sint ffi_type_sint32
|
||||
#elif INT_MAX == 9223372036854775807
|
||||
# define ffi_type_uint ffi_type_uint64
|
||||
# define ffi_type_sint ffi_type_sint64
|
||||
#else
|
||||
#error "int size not supported"
|
||||
#endif
|
||||
|
||||
#if LONG_MAX == 2147483647
|
||||
# if FFI_LONG_LONG_MAX != FFI_64_BIT_MAX
|
||||
#error "no 64-bit data type supported"
|
||||
# endif
|
||||
#elif LONG_MAX != FFI_64_BIT_MAX
|
||||
#error "long size not supported"
|
||||
#endif
|
||||
|
||||
#if LONG_MAX == 2147483647
|
||||
# define ffi_type_ulong ffi_type_uint32
|
||||
# define ffi_type_slong ffi_type_sint32
|
||||
#elif LONG_MAX == FFI_64_BIT_MAX
|
||||
# define ffi_type_ulong ffi_type_uint64
|
||||
# define ffi_type_slong ffi_type_sint64
|
||||
#else
|
||||
#error "long size not supported"
|
||||
#endif
|
||||
|
||||
/* These are defined in types.c. */
|
||||
FFI_EXTERN ffi_type ffi_type_void;
|
||||
FFI_EXTERN ffi_type ffi_type_uint8;
|
||||
FFI_EXTERN ffi_type ffi_type_sint8;
|
||||
FFI_EXTERN ffi_type ffi_type_uint16;
|
||||
FFI_EXTERN ffi_type ffi_type_sint16;
|
||||
FFI_EXTERN ffi_type ffi_type_uint32;
|
||||
FFI_EXTERN ffi_type ffi_type_sint32;
|
||||
FFI_EXTERN ffi_type ffi_type_uint64;
|
||||
FFI_EXTERN ffi_type ffi_type_sint64;
|
||||
FFI_EXTERN ffi_type ffi_type_float;
|
||||
FFI_EXTERN ffi_type ffi_type_double;
|
||||
FFI_EXTERN ffi_type ffi_type_pointer;
|
||||
|
||||
#if 0
|
||||
FFI_EXTERN ffi_type ffi_type_longdouble;
|
||||
#else
|
||||
#define ffi_type_longdouble ffi_type_double
|
||||
#endif
|
||||
|
||||
#ifdef FFI_TARGET_HAS_COMPLEX_TYPE
|
||||
FFI_EXTERN ffi_type ffi_type_complex_float;
|
||||
FFI_EXTERN ffi_type ffi_type_complex_double;
|
||||
#if 0
|
||||
FFI_EXTERN ffi_type ffi_type_complex_longdouble;
|
||||
#else
|
||||
#define ffi_type_complex_longdouble ffi_type_complex_double
|
||||
#endif
|
||||
#endif
|
||||
#endif /* LIBFFI_HIDE_BASIC_TYPES */
|
||||
|
||||
typedef enum {
|
||||
FFI_OK = 0,
|
||||
FFI_BAD_TYPEDEF,
|
||||
FFI_BAD_ABI
|
||||
} ffi_status;
|
||||
|
||||
typedef struct {
|
||||
ffi_abi abi;
|
||||
unsigned nargs;
|
||||
ffi_type **arg_types;
|
||||
ffi_type *rtype;
|
||||
unsigned bytes;
|
||||
unsigned flags;
|
||||
unsigned isVariadic;
|
||||
#ifdef FFI_EXTRA_CIF_FIELDS
|
||||
FFI_EXTRA_CIF_FIELDS;
|
||||
#endif
|
||||
} ffi_cif;
|
||||
|
||||
/* ---- Definitions for the raw API -------------------------------------- */
|
||||
|
||||
#ifndef FFI_SIZEOF_ARG
|
||||
# if LONG_MAX == 2147483647
|
||||
# define FFI_SIZEOF_ARG 4
|
||||
# elif LONG_MAX == FFI_64_BIT_MAX
|
||||
# define FFI_SIZEOF_ARG 8
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef FFI_SIZEOF_JAVA_RAW
|
||||
# define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG
|
||||
#endif
|
||||
|
||||
typedef union {
|
||||
ffi_sarg sint;
|
||||
ffi_arg uint;
|
||||
float flt;
|
||||
char data[FFI_SIZEOF_ARG];
|
||||
void* ptr;
|
||||
} ffi_raw;
|
||||
|
||||
#if FFI_SIZEOF_JAVA_RAW == 4 && FFI_SIZEOF_ARG == 8
|
||||
/* This is a special case for mips64/n32 ABI (and perhaps others) where
|
||||
sizeof(void *) is 4 and FFI_SIZEOF_ARG is 8. */
|
||||
typedef union {
|
||||
signed int sint;
|
||||
unsigned int uint;
|
||||
float flt;
|
||||
char data[FFI_SIZEOF_JAVA_RAW];
|
||||
void* ptr;
|
||||
} ffi_java_raw;
|
||||
#else
|
||||
typedef ffi_raw ffi_java_raw;
|
||||
#endif
|
||||
|
||||
FFI_EXTERN
|
||||
void ffi_raw_call (ffi_cif *cif,
|
||||
void (*fn)(void),
|
||||
void *rvalue,
|
||||
ffi_raw *avalue);
|
||||
|
||||
FFI_EXTERN void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw);
|
||||
FFI_EXTERN void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args);
|
||||
FFI_EXTERN size_t ffi_raw_size (ffi_cif *cif);
|
||||
|
||||
/* This is analogous to the raw API, except it uses Java parameter
|
||||
packing, even on 64-bit machines. I.e. on 64-bit machines longs
|
||||
and doubles are followed by an empty 64-bit word. */
|
||||
FFI_EXTERN
|
||||
void ffi_java_raw_call (ffi_cif *cif,
|
||||
void (*fn)(void),
|
||||
void *rvalue,
|
||||
ffi_java_raw *avalue);
|
||||
|
||||
FFI_EXTERN void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw);
|
||||
FFI_EXTERN void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args);
|
||||
FFI_EXTERN size_t ffi_java_raw_size (ffi_cif *cif);
|
||||
|
||||
/* ---- Definitions for closures ----------------------------------------- */
|
||||
|
||||
#if FFI_CLOSURES
|
||||
|
||||
#ifdef _MSC_VER
|
||||
__declspec(align(8))
|
||||
#endif
|
||||
typedef struct {
|
||||
#if 0
|
||||
void *trampoline_table;
|
||||
void *trampoline_table_entry;
|
||||
#else
|
||||
char tramp[FFI_TRAMPOLINE_SIZE];
|
||||
#endif
|
||||
ffi_cif *cif;
|
||||
void (*fun)(ffi_cif*,void*,void**,void*);
|
||||
void *user_data;
|
||||
} ffi_closure
|
||||
#ifdef __GNUC__
|
||||
__attribute__((aligned (8)))
|
||||
#endif
|
||||
;
|
||||
|
||||
#ifndef __GNUC__
|
||||
# ifdef __sgi
|
||||
# pragma pack 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
FFI_EXTERN void *ffi_closure_alloc (size_t size, void **code);
|
||||
FFI_EXTERN void ffi_closure_free (void *);
|
||||
|
||||
FFI_EXTERN ffi_status
|
||||
ffi_prep_closure (ffi_closure*,
|
||||
ffi_cif *,
|
||||
void (*fun)(ffi_cif*,void*,void**,void*),
|
||||
void *user_data)
|
||||
#if defined(__GNUC__) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 405)
|
||||
__attribute__((deprecated ("use ffi_prep_closure_loc instead")))
|
||||
#elif defined(__GNUC__) && __GNUC__ >= 3
|
||||
__attribute__((deprecated))
|
||||
#endif
|
||||
;
|
||||
|
||||
FFI_EXTERN ffi_status
|
||||
ffi_prep_closure_loc (ffi_closure*,
|
||||
ffi_cif *,
|
||||
void (*fun)(ffi_cif*,void*,void**,void*),
|
||||
void *user_data,
|
||||
void*codeloc);
|
||||
|
||||
#ifdef __sgi
|
||||
# pragma pack 8
|
||||
#endif
|
||||
typedef struct {
|
||||
#if 0
|
||||
void *trampoline_table;
|
||||
void *trampoline_table_entry;
|
||||
#else
|
||||
char tramp[FFI_TRAMPOLINE_SIZE];
|
||||
#endif
|
||||
ffi_cif *cif;
|
||||
|
||||
#if !FFI_NATIVE_RAW_API
|
||||
|
||||
/* If this is enabled, then a raw closure has the same layout
|
||||
as a regular closure. We use this to install an intermediate
|
||||
handler to do the transaltion, void** -> ffi_raw*. */
|
||||
|
||||
void (*translate_args)(ffi_cif*,void*,void**,void*);
|
||||
void *this_closure;
|
||||
|
||||
#endif
|
||||
|
||||
void (*fun)(ffi_cif*,void*,ffi_raw*,void*);
|
||||
void *user_data;
|
||||
|
||||
} ffi_raw_closure;
|
||||
|
||||
typedef struct {
|
||||
#if 0
|
||||
void *trampoline_table;
|
||||
void *trampoline_table_entry;
|
||||
#else
|
||||
char tramp[FFI_TRAMPOLINE_SIZE];
|
||||
#endif
|
||||
|
||||
ffi_cif *cif;
|
||||
|
||||
#if !FFI_NATIVE_RAW_API
|
||||
|
||||
/* If this is enabled, then a raw closure has the same layout
|
||||
as a regular closure. We use this to install an intermediate
|
||||
handler to do the translation, void** -> ffi_raw*. */
|
||||
|
||||
void (*translate_args)(ffi_cif*,void*,void**,void*);
|
||||
void *this_closure;
|
||||
|
||||
#endif
|
||||
|
||||
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*);
|
||||
void *user_data;
|
||||
|
||||
} ffi_java_raw_closure;
|
||||
|
||||
FFI_EXTERN ffi_status
|
||||
ffi_prep_raw_closure (ffi_raw_closure*,
|
||||
ffi_cif *cif,
|
||||
void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
|
||||
void *user_data);
|
||||
|
||||
FFI_EXTERN ffi_status
|
||||
ffi_prep_raw_closure_loc (ffi_raw_closure*,
|
||||
ffi_cif *cif,
|
||||
void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
|
||||
void *user_data,
|
||||
void *codeloc);
|
||||
|
||||
FFI_EXTERN ffi_status
|
||||
ffi_prep_java_raw_closure (ffi_java_raw_closure*,
|
||||
ffi_cif *cif,
|
||||
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
|
||||
void *user_data);
|
||||
|
||||
FFI_EXTERN ffi_status
|
||||
ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*,
|
||||
ffi_cif *cif,
|
||||
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
|
||||
void *user_data,
|
||||
void *codeloc);
|
||||
|
||||
#endif /* FFI_CLOSURES */
|
||||
|
||||
#if FFI_GO_CLOSURES
|
||||
|
||||
typedef struct {
|
||||
void *tramp;
|
||||
ffi_cif *cif;
|
||||
void (*fun)(ffi_cif*,void*,void**,void*);
|
||||
} ffi_go_closure;
|
||||
|
||||
FFI_EXTERN
|
||||
ffi_status ffi_prep_go_closure (ffi_go_closure*, ffi_cif *,
|
||||
void (*fun)(ffi_cif*,void*,void**,void*));
|
||||
|
||||
FFI_EXTERN
|
||||
void ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue,
|
||||
void **avalue, void *closure);
|
||||
|
||||
#endif /* FFI_GO_CLOSURES */
|
||||
|
||||
/* ---- Public interface definition -------------------------------------- */
|
||||
|
||||
FFI_EXTERN
|
||||
ffi_status ffi_prep_cif(ffi_cif *cif,
|
||||
ffi_abi abi,
|
||||
unsigned int nargs,
|
||||
ffi_type *rtype,
|
||||
ffi_type **atypes);
|
||||
|
||||
FFI_EXTERN
|
||||
ffi_status ffi_prep_cif_var(ffi_cif *cif,
|
||||
ffi_abi abi,
|
||||
unsigned int nfixedargs,
|
||||
unsigned int ntotalargs,
|
||||
ffi_type *rtype,
|
||||
ffi_type **atypes);
|
||||
|
||||
FFI_EXTERN
|
||||
void ffi_call(ffi_cif *cif,
|
||||
void (*fn)(void),
|
||||
void *rvalue,
|
||||
void **avalue);
|
||||
|
||||
FFI_EXTERN
|
||||
ffi_status ffi_get_struct_offsets (ffi_abi abi, ffi_type *struct_type,
|
||||
size_t *offsets);
|
||||
|
||||
/* Useful for eliminating compiler warnings. */
|
||||
#define FFI_FN(f) ((void (*)(void))f)
|
||||
|
||||
/* ---- Definitions shared with assembly code ---------------------------- */
|
||||
|
||||
#endif /* !LIBFFI_ASM */
|
||||
|
||||
/* If these change, update src/mips/ffitarget.h. */
|
||||
#define FFI_TYPE_VOID 0
|
||||
#define FFI_TYPE_INT 1
|
||||
#define FFI_TYPE_FLOAT 2
|
||||
#define FFI_TYPE_DOUBLE 3
|
||||
#if 0
|
||||
#define FFI_TYPE_LONGDOUBLE 4
|
||||
#else
|
||||
#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE
|
||||
#endif
|
||||
#define FFI_TYPE_UINT8 5
|
||||
#define FFI_TYPE_SINT8 6
|
||||
#define FFI_TYPE_UINT16 7
|
||||
#define FFI_TYPE_SINT16 8
|
||||
#define FFI_TYPE_UINT32 9
|
||||
#define FFI_TYPE_SINT32 10
|
||||
#define FFI_TYPE_UINT64 11
|
||||
#define FFI_TYPE_SINT64 12
|
||||
#define FFI_TYPE_STRUCT 13
|
||||
#define FFI_TYPE_POINTER 14
|
||||
#define FFI_TYPE_COMPLEX 15
|
||||
|
||||
/* This should always refer to the last type code (for sanity checks). */
|
||||
#define FFI_TYPE_LAST FFI_TYPE_COMPLEX
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
23
code/application/source/sf_app/tools/blue/include/ffi.h
Normal file
23
code/application/source/sf_app/tools/blue/include/ffi.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
/* Include the correct ffi.h automatically. This helps us create prefixes
|
||||
* with multi-lib Linux and OSX/iOS universal builds. To avoid listing all
|
||||
* possible architectures here, we try the configured target arch first and then
|
||||
* include the most common multilib/universal setups in the #elif ladder */
|
||||
#ifdef __arm__
|
||||
#include "ffi-arm.h"
|
||||
#elif defined(__i386__) || defined(_M_IX86)
|
||||
#include "ffi-x86.h"
|
||||
#elif defined(__x86_64__) || defined(_M_X64)
|
||||
#include "ffi-x86_64.h"
|
||||
#elif defined(__arm__) || defined(_M_ARM)
|
||||
#include "ffi-arm.h"
|
||||
#elif defined(__aarch64__) || defined(_M_ARM64)
|
||||
#include "ffi-aarch64.h"
|
||||
#elif defined(__powerpc__) || defined(_M_PPC)
|
||||
#include "ffi-powerpc.h"
|
||||
#elif defined(__powerpc64__)
|
||||
#include "ffi-powerpc64.h"
|
||||
#elif defined (__riscv) && __riscv_xlen == 64
|
||||
#include "ffi-riscv64.h"
|
||||
#else
|
||||
#error "Unsupported Architecture"
|
||||
#endif
|
|
@ -0,0 +1,82 @@
|
|||
/* -----------------------------------------------------------------*-C-*-
|
||||
ffitarget.h - Copyright (c) 2012 Anthony Green
|
||||
Copyright (c) 2010 CodeSourcery
|
||||
Copyright (c) 1996-2003 Red Hat, Inc.
|
||||
|
||||
Target configuration macros for ARM.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
``Software''), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
----------------------------------------------------------------------- */
|
||||
|
||||
#ifndef LIBFFI_TARGET_H
|
||||
#define LIBFFI_TARGET_H
|
||||
|
||||
#ifndef LIBFFI_H
|
||||
#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead."
|
||||
#endif
|
||||
|
||||
#ifndef LIBFFI_ASM
|
||||
typedef unsigned long ffi_arg;
|
||||
typedef signed long ffi_sarg;
|
||||
|
||||
typedef enum ffi_abi {
|
||||
FFI_FIRST_ABI = 0,
|
||||
FFI_SYSV,
|
||||
FFI_VFP,
|
||||
FFI_LAST_ABI,
|
||||
#ifdef __ARM_PCS_VFP
|
||||
FFI_DEFAULT_ABI = FFI_VFP,
|
||||
#else
|
||||
FFI_DEFAULT_ABI = FFI_SYSV,
|
||||
#endif
|
||||
} ffi_abi;
|
||||
#endif
|
||||
|
||||
#define FFI_EXTRA_CIF_FIELDS \
|
||||
int vfp_used; \
|
||||
unsigned short vfp_reg_free, vfp_nargs; \
|
||||
signed char vfp_args[16] \
|
||||
|
||||
#define FFI_TARGET_SPECIFIC_VARIADIC
|
||||
#define FFI_TARGET_HAS_COMPLEX_TYPE
|
||||
|
||||
/* ---- Definitions for closures ----------------------------------------- */
|
||||
|
||||
#define FFI_CLOSURES 1
|
||||
#define FFI_GO_CLOSURES 1
|
||||
#define FFI_NATIVE_RAW_API 0
|
||||
|
||||
#if defined (FFI_EXEC_TRAMPOLINE_TABLE) && FFI_EXEC_TRAMPOLINE_TABLE
|
||||
|
||||
#ifdef __MACH__
|
||||
#define FFI_TRAMPOLINE_SIZE 12
|
||||
#define FFI_TRAMPOLINE_CLOSURE_OFFSET 8
|
||||
#else
|
||||
#error "No trampoline table implementation"
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define FFI_TRAMPOLINE_SIZE 12
|
||||
#define FFI_TRAMPOLINE_CLOSURE_OFFSET FFI_TRAMPOLINE_SIZE
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,23 @@
|
|||
/* Include the correct ffitarget.h automatically. This helps us create prefixes
|
||||
* with multi-lib Linux and OSX/iOS universal builds. To avoid listing all
|
||||
* possible architectures here, we try the configured target arch first and then
|
||||
* include the most common multilib/universal setups in the #elif ladder */
|
||||
#ifdef __arm__
|
||||
#include "ffitarget-arm.h"
|
||||
#elif defined(__i386__) || defined(_M_IX86)
|
||||
#include "ffitarget-x86.h"
|
||||
#elif defined(__x86_64__) || defined(_M_X64)
|
||||
#include "ffitarget-x86_64.h"
|
||||
#elif defined(__arm__) || defined(_M_ARM)
|
||||
#include "ffitarget-arm.h"
|
||||
#elif defined(__aarch64__) || defined(_M_ARM64)
|
||||
#include "ffitarget-aarch64.h"
|
||||
#elif defined(__powerpc__) || defined(_M_PPC)
|
||||
#include "ffitarget-powerpc.h"
|
||||
#elif defined(__powerpc64__)
|
||||
#include "ffitarget-powerpc64.h"
|
||||
#elif defined (__riscv) && __riscv_xlen == 64
|
||||
#include "ffitarget-riscv64.h"
|
||||
#else
|
||||
#error "Unsupported Architecture"
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user