/usr/include/player-3.0/libplayerinterface/functiontable.h is in libplayerinterface3.0-dev 3.0.2+dfsg-4.1ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | /*
* Player - One Hell of a Robot Server
* Copyright (C) 2005 -
* Brian Gerkey
*
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/********************************************************************
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
********************************************************************/
/*
* $Id: functiontable.h 8026 2009-07-15 07:58:09Z gbiggs $
*
* Functions for looking up the appropriate XDR pack/unpack function for a
* given message type and subtype.
*/
#ifndef _FUNCTIONTABLE_H_
#define _FUNCTIONTABLE_H_
#if defined (WIN32)
#if defined (PLAYER_STATIC)
#define PLAYERXDR_EXPORT
#elif defined (playerxdr_EXPORTS)
#define PLAYERXDR_EXPORT __declspec (dllexport)
#else
#define PLAYERXDR_EXPORT __declspec (dllimport)
#endif
#else
#define PLAYERXDR_EXPORT
#endif
#include <playerconfig.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef HAVE_XDR_LONGLONG_T
#include <rpc/types.h>
#include <rpc/xdr.h>
bool_t xdr_longlong_t(XDR *xdrs, long long int *llp);
#endif
/** @addtogroup libplayerinterface libplayerinterface @{ */
/** Generic Prototype for a player XDR packing function */
typedef int (*player_pack_fn_t) (void* buf, size_t buflen, void* msg, int op);
/** Generic Prototype for a player message structure deep copy function */
typedef unsigned int (*player_copy_fn_t) (void* dest, const void* src);
/** Generic Prototype for a player message structure cleanup function */
typedef void (*player_cleanup_fn_t) (void* msg);
/** Generic Prototype for a player message structure clone function */
typedef void * (*player_clone_fn_t) (void* msg);
/** Generic Prototype for a player message structure free function */
typedef void (*player_free_fn_t) (void* msg);
/** Generic Prototype for a player message structure sizeof function */
typedef unsigned int (*player_sizeof_fn_t) (void* msg);
/** Structure to link an (interface,type,subtype) tuple with an XDR
* pack/unpack function, a deep copy function and a delete function */
typedef struct
{
uint16_t interf;
uint8_t type;
uint8_t subtype;
player_pack_fn_t packfunc;
player_copy_fn_t copyfunc;
player_cleanup_fn_t cleanupfunc;
player_clone_fn_t clonefunc;
player_free_fn_t freefunc;
player_sizeof_fn_t sizeoffunc;
} playerxdr_function_t;
/** @brief Look up the XDR packing function for a given message signature.
*
* @param interf : The interface
* @param type : The message type
* @param subtype : The message subtype
*
* @returns A pointer to the appropriate function, or NULL if one cannot be
* found.
*/
PLAYERXDR_EXPORT player_pack_fn_t playerxdr_get_packfunc(uint16_t interf, uint8_t type,
uint8_t subtype);
PLAYERXDR_EXPORT player_copy_fn_t playerxdr_get_copyfunc(uint16_t interf, uint8_t type,
uint8_t subtype);
PLAYERXDR_EXPORT player_cleanup_fn_t playerxdr_get_cleanupfunc(uint16_t interf, uint8_t type,
uint8_t subtype);
PLAYERXDR_EXPORT player_clone_fn_t playerxdr_get_clonefunc(uint16_t interf, uint8_t type,
uint8_t subtype);
PLAYERXDR_EXPORT player_free_fn_t playerxdr_get_freefunc(uint16_t interf, uint8_t type,
uint8_t subtype);
PLAYERXDR_EXPORT player_sizeof_fn_t playerxdr_get_sizeoffunc(uint16_t interf, uint8_t type,
uint8_t subtype);
/** @brief Add an entry to the function table.
*
* @param f : the message signature and function to add
* @param replace : whether any existing function for the same signature
* should be replaced.
*
* @returns 0 on success (new entry was entered, replacing old one if
* necessary), -1 on failure (an existing entry matched the given
* signature, but @p replace was 0)
*/
PLAYERXDR_EXPORT int playerxdr_ftable_add(playerxdr_function_t f, int replace);
/** @brief Add multiple entries to the function table.
*
* @param f : a pointer to the function table entries to add (NULL terminated
* array).
* @param replace : whether any existing functions should be replaced.
*
* @returns 0 on success, -1 on failure
*/
PLAYERXDR_EXPORT int playerxdr_ftable_add_multi(playerxdr_function_t *flist, int replace);
/** @brief Initialize the XDR function table.
*
* This function adds all the standard Player message types into the table
* that is searched by the playerxdr_get_* functions.
*/
PLAYERXDR_EXPORT void playerxdr_ftable_init(void);
/** @brief Deep copy a message structure.
*
* Copies the dynamically allocated parts of a message structure from src to
* dest using the message type/subtype's deep copy function.
*
* @param src : The source message
* @param dest : The destination message
*
* @returns : The number of bytes copied.
*/
PLAYERXDR_EXPORT unsigned int playerxdr_deepcopy_message(void* src, void* dest, uint16_t interf, uint8_t type,
uint8_t subtype);
/** @brief Clones a message structure.
*
* Allocates memory for and copies the src message. The caller is responsible for player_type_free'ing the returned data
*
* @param src : The source message
*
* @returns : The message clone
*/
PLAYERXDR_EXPORT void * playerxdr_clone_message(void* msg, uint16_t interf, uint8_t type, uint8_t subtype);
/** @brief Delete a message structure's dynamic elements.
*
* Deletes any dynamically allocated data used by a message structure and then
* frees the structure itself
*
* @param msg : The message to clean up.
*
* @returns: Nothing.
*/
PLAYERXDR_EXPORT void playerxdr_free_message(void* msg, uint16_t interf, uint8_t type,
uint8_t subtype);
/** @brief Cleanup a message structure's dynamic elements.
*
* Deletes any dynamically allocated data used by a message structure, It does not
* free the structure itself.
*
* @param msg : The message to clean up.
*
* @returns: Nothing.
*/
PLAYERXDR_EXPORT void playerxdr_cleanup_message(void* msg, uint16_t interf, uint8_t type,
uint8_t subtype);
/** @} */
#ifdef __cplusplus
}
#endif
#endif
|