jdk/src/jdk.net/solaris/native/libextnet/SolarisSocketOptions.h
author chegar
Wed, 27 Apr 2016 20:36:02 +0100
changeset 37676 24ef455da1b0
permissions -rw-r--r--
8044773: Refactor jdk.net API so that it can be moved out of the base module Reviewed-by: alanb, erikj, mchung
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37676
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
     1
/*
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
     4
 *
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    10
 *
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    15
 * accompanied this code).
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    16
 *
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    20
 *
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    23
 * questions.
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    24
 */
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    25
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    26
#ifndef SOLARIS_SOCKET_OPTIONS_H
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    27
#define SOLARIS_SOCKET_OPTIONS_H
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    28
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    29
#include <sys/socket.h>
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    30
#include <jni.h>
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    31
#include <string.h>
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    32
#include <errno.h>
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    33
#include <unistd.h>
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    34
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    35
#include "jni_util.h"
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    36
#include "jdk_net_SocketFlow.h"
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    37
#include "SolarisSocketOptions.h"
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    38
#include "jdk_net_SolarisSocketOptions.h"
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    39
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    40
#ifndef SO_FLOW_SLA
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    41
#define SO_FLOW_SLA 0x1018
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    42
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    43
#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    44
#pragma pack(4)
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    45
#endif
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    46
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    47
/*
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    48
 * Used with the setsockopt(SO_FLOW_SLA, ...) call to set
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    49
 * per socket service level properties.
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    50
 * When the application uses per-socket API, we will enforce the properties
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    51
 * on both outbound and inbound packets.
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    52
 *
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    53
 * For now, only priority and maxbw are supported in SOCK_FLOW_PROP_VERSION1.
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    54
 */
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    55
typedef struct sock_flow_props_s {
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    56
        int             sfp_version;
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    57
        uint32_t        sfp_mask;
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    58
        int             sfp_priority;   /* flow priority */
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    59
        uint64_t        sfp_maxbw;      /* bandwidth limit in bps */
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    60
        int             sfp_status;     /* flow create status for getsockopt */
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    61
} sock_flow_props_t;
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    62
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    63
#define SOCK_FLOW_PROP_VERSION1 1
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    64
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    65
/* bit mask values for sfp_mask */
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    66
#define SFP_MAXBW       0x00000001      /* Flow Bandwidth Limit */
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    67
#define SFP_PRIORITY    0x00000008      /* Flow priority */
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    68
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    69
/* possible values for sfp_priority */
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    70
#define SFP_PRIO_NORMAL 1
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    71
#define SFP_PRIO_HIGH   2
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    72
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    73
#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    74
#pragma pack()
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    75
#endif /* _LONG_LONG_ALIGNMENT */
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    76
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    77
#endif /* SO_FLOW_SLA */
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    78
24ef455da1b0 8044773: Refactor jdk.net API so that it can be moved out of the base module
chegar
parents:
diff changeset
    79
#endif /* SOLARIS_SOCKET_OPTIONS_H */