responder_packet.c revision 19b4bb652f5cdc2797b66595eaf8811881aa9873
/*
SSSD
SSS Client Responder, command parser
Copyright (C) Simo Sorce <ssorce@redhat.com> 2008
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 <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include <errno.h>
#include <talloc.h>
#include "responder/common/responder_packet.h"
#define SSSSRV_PACKET_MEM_SIZE 512
struct sss_packet {
/* header */
/* io pointer */
};
/*
* Allocate a new packet structure
*
* - if size is defined use it otherwise the default packet will be
* SSSSRV_PACKET_MEM_SIZE bytes.
*/
enum sss_cli_command cmd,
struct sss_packet **rpacket)
{
struct sss_packet *packet;
if (size) {
} else {
}
return ENOMEM;
}
return EOK;
}
/* grows a packet size only in SSSSRV_PACKET_MEM_SIZE chunks */
{
if (size == 0) {
return EOK;
}
/* make sure we do not overflow */
totlen += n * SSSSRV_PACKET_MEM_SIZE;
return EINVAL;
}
}
if (!newmem) {
return ENOMEM;
}
/* re-set pointers if realloc had to move memory */
}
}
return 0;
}
/* reclaim backet previously resrved space in the packet
* usually done in functione recovering from not fatal erros */
{
return 0;
}
{
/* make sure we do not overflow */
return 0;
}
{
void *buf;
/* check for wrapping */
return EINVAL;
}
errno = 0;
if (rb == -1) {
return EAGAIN;
} else {
return errno;
}
}
if (rb == 0) {
return ENODATA;
}
return EINVAL;
}
return EAGAIN;
}
return EAGAIN;
}
return EOK;
}
{
void *buf;
if (!packet) {
/* No packet object to write to? */
return EINVAL;
}
errno = 0;
if (rb == -1) {
return EAGAIN;
} else {
return errno;
}
}
if (rb == 0) {
return EIO;
}
return EAGAIN;
}
return EOK;
}
{
}
{
}
{
}