sftp_provider_impl.h revision 2738
2738N/A/*
2738N/A * CDDL HEADER START
2738N/A *
2738N/A * The contents of this file are subject to the terms of the
2738N/A * Common Development and Distribution License (the "License").
2738N/A * You may not use this file except in compliance with the License.
2738N/A *
2738N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2738N/A * or http://www.opensolaris.org/os/licensing.
2738N/A * See the License for the specific language governing permissions
2738N/A * and limitations under the License.
2738N/A *
2738N/A * When distributing Covered Code, include this CDDL HEADER in each
2738N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2738N/A * If applicable, add the following below this CDDL HEADER, with the
2738N/A * fields enclosed by brackets "[]" replaced with your own identifying
2738N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2738N/A *
2738N/A * CDDL HEADER END
2738N/A */
2738N/A/*
2738N/A * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
2738N/A */
2738N/A
2738N/A#ifndef _SFTP_PROVIDER_IMPL_H
2738N/A#define _SFTP_PROVIDER_IMPL_H
2738N/A
2738N/A#ifdef __cplusplus
2738N/Aextern "C" {
2738N/A#endif
2738N/A
2738N/A/*
2738N/A * This structure must match the definition of same in sftp.d.
2738N/A */
2738N/Atypedef struct sftpproto {
2738N/A int64_t sftp_nbytes; /* bytes writtten or read */
2738N/A const char *sftp_user; /* user name */
2738N/A const char *sftp_operation; /* SFTP Operation */
2738N/A const char *sftp_raddr; /* remote address */
2738N/A const char *sftp_pathname; /* path with file name */
2738N/A int32_t sftp_fd; /* fd for transfer, if any */
2738N/A} sftpproto_t;
2738N/A
2738N/A#define SFTP_TRANSFER_PROTO(proto, op, fd, path, len) \
2738N/A bzero((proto), sizeof (struct sftpproto)); \
2738N/A (proto)->sftp_user = (pw->pw_name ? pw->pw_name : "UNKNOWN"); \
2738N/A (proto)->sftp_operation = (op ? op : "UNKNOWN"); \
2738N/A (proto)->sftp_raddr = (client_addr); \
2738N/A (proto)->sftp_fd = (fd); \
2738N/A (proto)->sftp_pathname = (path ? path : "UNKNOWN"); \
2738N/A (proto)->sftp_nbytes = (len); \
2738N/A
2738N/A#define SFTP_TRANSFER_START_OP(op, fd, path, len) \
2738N/A if (SFTP_TRANSFER_START_ENABLED()) { \
2738N/A sftpproto_t proto; \
2738N/A SFTP_TRANSFER_PROTO(&proto, op, fd, path, len); \
2738N/A SFTP_TRANSFER_START(&proto); \
2738N/A } \
2738N/A
2738N/A#define SFTP_TRANSFER_DONE_OP(op, fd, path, len) \
2738N/A if (SFTP_TRANSFER_DONE_ENABLED()) { \
2738N/A sftpproto_t proto; \
2738N/A SFTP_TRANSFER_PROTO(&proto, op, fd, path, len); \
2738N/A SFTP_TRANSFER_DONE(&proto); \
2738N/A } \
2738N/A
2738N/A#include <sftp_provider.h>
2738N/A
2738N/A#ifdef __cplusplus
2738N/A}
2738N/A#endif
2738N/A
2738N/A#endif /* _SFTP_PROVIDER_IMPL_H */