|
1 /* |
|
2 * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. |
|
3 */ |
|
4 |
|
5 #pragma D depends_on library net.d |
|
6 #pragma D depends_on library io.d |
|
7 #pragma D depends_on module lofs |
|
8 |
|
9 typedef struct sftpinfo { |
|
10 string sfi_user; /* user name */ |
|
11 string sfi_operation; /* SFTP Operation */ |
|
12 ssize_t sfi_nbytes; /* bytes transferred, if any */ |
|
13 string sfi_pathname; /* pathname of transfer */ |
|
14 string sfi_fsresource; /* Dataset(ZFS) or resource name */ |
|
15 } sftpinfo_t; |
|
16 |
|
17 /* |
|
18 * This structure must match the definition of same in sftp_provider_impl.h. |
|
19 */ |
|
20 typedef struct sftpproto { |
|
21 int64_t sftp_nbytes; /* bytes written or read */ |
|
22 uint64_t sftp_user; /* user name */ |
|
23 uint64_t sftp_operation; /* SFTP operation */ |
|
24 uint64_t sftp_raddr; /* remote address */ |
|
25 uint64_t sftp_pathname; /* path with file name */ |
|
26 int32_t sftp_fd; /* fd for transfer, if any */ |
|
27 } sftpproto_t; |
|
28 |
|
29 #pragma D binding "1.6.1" translator |
|
30 translator conninfo_t <sftpproto_t *s> { |
|
31 ci_protocol = "tcp"; |
|
32 ci_remote = copyinstr((uintptr_t) |
|
33 *(uint64_t *)copyin((uintptr_t)&s->sftp_raddr, sizeof (uint64_t))); |
|
34 ci_local = "<unknown>"; |
|
35 }; |
|
36 |
|
37 #pragma D binding "1.6.1" translator |
|
38 translator sftpinfo_t <sftpproto_t *s> { |
|
39 sfi_user = copyinstr((uintptr_t) |
|
40 *(uint64_t *)copyin((uintptr_t)&s->sftp_user, sizeof (uint64_t))); |
|
41 sfi_operation = copyinstr((uintptr_t) |
|
42 *(uint64_t *)copyin((uintptr_t)&s->sftp_operation, |
|
43 sizeof (uint64_t))); |
|
44 sfi_nbytes = |
|
45 *(uint64_t *)copyin((uintptr_t)&s->sftp_nbytes, sizeof (uint64_t)); |
|
46 sfi_fsresource = stringof(fds[*(int32_t *)copyin((uintptr_t)&s->sftp_fd, |
|
47 sizeof (int32_t))].fi_fs) == "lofs" ? stringof(((struct loinfo *) |
|
48 curthread->t_procp->p_user.u_finfo.fi_list[*(int32_t *)copyin( |
|
49 (uintptr_t)&s->sftp_fd, sizeof (int32_t))].uf_file->f_vnode-> |
|
50 v_vfsp->vfs_data)->li_realvfs->vfs_resource->rs_string) : |
|
51 stringof(curthread->t_procp->p_user.u_finfo.fi_list[ |
|
52 *(int32_t *)copyin((uintptr_t)&s->sftp_fd, sizeof (int32_t))]. |
|
53 uf_file->f_vnode->v_vfsp->vfs_resource->rs_string); |
|
54 sfi_pathname = copyinstr((uintptr_t)*(uint64_t *)copyin( |
|
55 (uintptr_t)&s->sftp_pathname, sizeof (uint64_t))); |
|
56 }; |