components/openssh/dtrace_sftp/sftp_provider_impl.h
author Tomas Kuthan <tomas.kuthan@oracle.com>
Fri, 27 Jan 2017 11:50:56 -0800
branchs11u3-sru
changeset 7619 4e1d20a92c16
permissions -rw-r--r--
20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7619
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
     1
/*
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
     2
 * CDDL HEADER START
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
     3
 *
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
     4
 * The contents of this file are subject to the terms of the
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
     5
 * Common Development and Distribution License (the "License").
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
     6
 * You may not use this file except in compliance with the License.
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
     7
 *
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
     8
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
     9
 * or http://www.opensolaris.org/os/licensing.
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    10
 * See the License for the specific language governing permissions
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    11
 * and limitations under the License.
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    12
 *
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    13
 * When distributing Covered Code, include this CDDL HEADER in each
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    14
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    15
 * If applicable, add the following below this CDDL HEADER, with the
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    16
 * fields enclosed by brackets "[]" replaced with your own identifying
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    17
 * information: Portions Copyright [yyyy] [name of copyright owner]
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    18
 *
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    19
 * CDDL HEADER END
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    20
 */
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    21
/*
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    22
 * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    23
 */
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    24
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    25
#ifndef	_SFTP_PROVIDER_IMPL_H
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    26
#define	_SFTP_PROVIDER_IMPL_H
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    27
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    28
#ifdef	__cplusplus
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    29
extern "C" {
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    30
#endif
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    31
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    32
/*
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    33
 * This structure must match the definition of same in sftp.d.
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    34
 */
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    35
typedef struct sftpproto {
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    36
	int64_t sftp_nbytes;		/* bytes writtten or read */
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    37
	const char *sftp_user;		/* user name */
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    38
	const char *sftp_operation;	/* SFTP Operation */
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    39
	const char *sftp_raddr;		/* remote address */
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    40
	const char *sftp_pathname;	/* path with file name */
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    41
	int32_t sftp_fd;		/* fd for transfer, if any */
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    42
} sftpproto_t;
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    43
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    44
#define	SFTP_TRANSFER_PROTO(proto, op, fd, path, len) \
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    45
	bzero((proto), sizeof (struct sftpproto)); \
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    46
	(proto)->sftp_user = (pw->pw_name ? pw->pw_name : "UNKNOWN"); \
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    47
	(proto)->sftp_operation = (op ? op : "UNKNOWN"); \
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    48
	(proto)->sftp_raddr = (client_addr); \
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    49
	(proto)->sftp_fd = (fd); \
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    50
	(proto)->sftp_pathname = (path ? path : "UNKNOWN"); \
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    51
	(proto)->sftp_nbytes = (len); \
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    52
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    53
#define	SFTP_TRANSFER_START_OP(op, fd, path, len) \
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    54
	if (SFTP_TRANSFER_START_ENABLED()) { \
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    55
		sftpproto_t proto; \
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    56
		SFTP_TRANSFER_PROTO(&proto, op, fd, path, len); \
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    57
		SFTP_TRANSFER_START(&proto); \
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    58
	} \
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    59
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    60
#define	SFTP_TRANSFER_DONE_OP(op, fd, path, len) \
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    61
	if (SFTP_TRANSFER_DONE_ENABLED()) { \
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    62
		sftpproto_t proto; \
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    63
		SFTP_TRANSFER_PROTO(&proto, op, fd, path, len); \
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    64
		SFTP_TRANSFER_DONE(&proto); \
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    65
	} \
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    66
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    67
#include <sftp_provider.h>
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    68
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    69
#ifdef	__cplusplus
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    70
}
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    71
#endif
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    72
4e1d20a92c16 20459133 Backport 18127340 to S11.3: migrate the sftp dtrace provider feature from SunSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff changeset
    73
#endif /* _SFTP_PROVIDER_IMPL_H */