17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* 237c478bd9Sstevel@tonic-gate * Copyright (c) 2000 by Sun Microsystems, Inc. 247c478bd9Sstevel@tonic-gate * All rights reserved. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 27*1f4c6dbcSPeter Tribble /* 28*1f4c6dbcSPeter Tribble * Copyright 2019 Peter Tribble. 29*1f4c6dbcSPeter Tribble */ 30*1f4c6dbcSPeter Tribble 317c478bd9Sstevel@tonic-gate #ifndef _SYS_SCKM_IO_H 327c478bd9Sstevel@tonic-gate #define _SYS_SCKM_IO_H 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #ifdef __cplusplus 357c478bd9Sstevel@tonic-gate extern "C" { 367c478bd9Sstevel@tonic-gate #endif 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate /* 397c478bd9Sstevel@tonic-gate * This header file defines the interface between the sckmd daemon and 407c478bd9Sstevel@tonic-gate * the sckmdrv driver. 417c478bd9Sstevel@tonic-gate */ 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gate #include <sys/types.h> 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate #define SCKM_IOC ('s' << 8) 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gate enum sckm_ioctl { 487c478bd9Sstevel@tonic-gate SCKM_IOCTL_GETREQ = SCKM_IOC, 497c478bd9Sstevel@tonic-gate SCKM_IOCTL_STATUS 507c478bd9Sstevel@tonic-gate }; 517c478bd9Sstevel@tonic-gate 527c478bd9Sstevel@tonic-gate /* 537c478bd9Sstevel@tonic-gate * Structure passed by sckmd daemon to the sckmdrv driver during 547c478bd9Sstevel@tonic-gate * a SCKM_IOCTL_GETREQ ioctl call. 557c478bd9Sstevel@tonic-gate */ 567c478bd9Sstevel@tonic-gate typedef struct sckm_ioctl_getreq { 577c478bd9Sstevel@tonic-gate uint64_t transid; /* returned by driver */ 587c478bd9Sstevel@tonic-gate uint32_t type; /* message type */ 597c478bd9Sstevel@tonic-gate caddr_t buf; /* user buffer to store msg */ 607c478bd9Sstevel@tonic-gate uint32_t buf_len; /* size of buf */ 617c478bd9Sstevel@tonic-gate } sckm_ioctl_getreq_t; 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 647c478bd9Sstevel@tonic-gate typedef struct sckm_ioctl_getreq_32 { 657c478bd9Sstevel@tonic-gate uint64_t transid; /* returned by driver */ 667c478bd9Sstevel@tonic-gate uint32_t type; /* message type */ 677c478bd9Sstevel@tonic-gate caddr32_t buf; /* user buffer to store msg */ 687c478bd9Sstevel@tonic-gate uint32_t buf_len; /* size of buf */ 697c478bd9Sstevel@tonic-gate } sckm_ioctl_getreq32_t; 707c478bd9Sstevel@tonic-gate #endif /* defined(_SYSCALL32) */ 717c478bd9Sstevel@tonic-gate 727c478bd9Sstevel@tonic-gate /* 737c478bd9Sstevel@tonic-gate * Structure passed by sckmd daemon to the sckmdrv driver during 747c478bd9Sstevel@tonic-gate * a SCKM_IOCTL_STATUS ioctl call. 757c478bd9Sstevel@tonic-gate */ 767c478bd9Sstevel@tonic-gate typedef struct sckm_ioctl_status { 777c478bd9Sstevel@tonic-gate uint64_t transid; /* set by daemon */ 787c478bd9Sstevel@tonic-gate uint32_t status; /* execution status */ 797c478bd9Sstevel@tonic-gate uint32_t sadb_msg_errno; /* PF_KEY errno, if applicable */ 807c478bd9Sstevel@tonic-gate uint32_t sadb_msg_version; /* PF_KEY version, if applicable */ 817c478bd9Sstevel@tonic-gate } sckm_ioctl_status_t; 827c478bd9Sstevel@tonic-gate 837c478bd9Sstevel@tonic-gate /* 847c478bd9Sstevel@tonic-gate * Valid request types returned by the SCKM_IOCTL_GETREQ ioctl. 857c478bd9Sstevel@tonic-gate */ 867c478bd9Sstevel@tonic-gate #define SCKM_IOCTL_REQ_SADB 0x0 /* SADB message */ 877c478bd9Sstevel@tonic-gate 887c478bd9Sstevel@tonic-gate /* 897c478bd9Sstevel@tonic-gate * Valid values for the status field of the sckm_ioctl_status structure. 907c478bd9Sstevel@tonic-gate */ 917c478bd9Sstevel@tonic-gate #define SCKM_IOCTL_STAT_SUCCESS 0x0 /* operation success */ 927c478bd9Sstevel@tonic-gate #define SCKM_IOCTL_STAT_ERR_PFKEY 0x1 /* PF_KEY error */ 937c478bd9Sstevel@tonic-gate #define SCKM_IOCTL_STAT_ERR_REQ 0x2 /* invalid request */ 947c478bd9Sstevel@tonic-gate #define SCKM_IOCTL_STAT_ERR_VERSION 0x3 /* not supp. PF_KEY version */ 957c478bd9Sstevel@tonic-gate #define SCKM_IOCTL_STAT_ERR_TIMEOUT 0x4 /* no response from PF_KEY */ 967c478bd9Sstevel@tonic-gate #define SCKM_IOCTL_STAT_ERR_OTHER 0x5 /* other daemon error */ 977c478bd9Sstevel@tonic-gate #define SCKM_IOCTL_STAT_ERR_SADB_TYPE 0x6 /* bad SADB msg type */ 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1007c478bd9Sstevel@tonic-gate } 1017c478bd9Sstevel@tonic-gate #endif 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate #endif /* _SYS_SCKM_IO_H */ 104