Whamcloud - gitweb
LU-7845 gss: support namespace in lgss_keyring
[fs/lustre-release.git] / lustre / utils / gss / lsupport.h
index 2640210..72b7224 100644 (file)
@@ -1,13 +1,47 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
+/*
+ * GPL HEADER START
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA
+ *
+ * GPL HEADER END
+ */
+/*
+ * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Use is subject to license terms.
+ *
+ * Copyright (c) 2012, 2014 Intel Corporation.
+ */
+/*
+ * This file is part of Lustre, http://www.lustre.org/
+ * Lustre is a trademark of Sun Microsystems, Inc.
+ *
+ * lustre/utils/gss/lsupport.h
  */
 
-#ifndef __LIBCFS_H__
-#define __LIBCFS_H__
+#ifndef __LSUPPORT_H__
+#define __LSUPPORT_H__
 
+#include <assert.h>
 #include <unistd.h>
 #include <stdint.h>
 
+#include <lnet/types.h>
+
 #define GSSD_CLI        (0)
 #define GSSD_SVC        (1)
 
@@ -18,8 +52,35 @@ void gssd_exit_unique(int type);
  * copied from lustre source
  */
 
-#define LUSTRE_GSS_SVC_MDS      0
-#define LUSTRE_GSS_SVC_OSS      1
+#define LUSTRE_GSS_SVC_MGS      0
+#define LUSTRE_GSS_SVC_MDS      1
+#define LUSTRE_GSS_SVC_OSS      2
+
+#define LUSTRE_GSS_SVC_MASK    0x0000FFFF
+#define LUSTRE_GSS_MECH_MASK   0xFFFF0000
+#define LUSTRE_GSS_MECH_SHIFT  16
+
+extern const char * lustre_svc_name[];
+
+enum lgss_mech {
+       LGSS_MECH_KRB5  = 0,
+       LGSS_MECH_NULL  = 1,
+       LGSS_MECH_SK    = 2,
+};
+
+enum {
+       /* sec part flags */
+       LGSS_ROOT_CRED_ROOT     = 0x01,
+       LGSS_ROOT_CRED_MDT      = 0x02,
+       LGSS_ROOT_CRED_OST      = 0x04,
+       /* service type flags */
+       LGSS_SVC_NULL           = 0x10,
+       LGSS_SVC_AUTH           = 0x20,
+       LGSS_SVC_INTG           = 0x40,
+       LGSS_SVC_PRIV           = 0x80,
+       /* Number of sec part flags */
+       LGSS_ROOT_CRED_NR       = 3,
+};
 
 struct lgssd_upcall_data {
         uint32_t        seq;
@@ -30,10 +91,13 @@ struct lgssd_upcall_data {
         char            obd[64];
 };
 
-#define GSSD_INTERFACE_VERSION        (1)
+#define GSSD_INTERFACE_VERSION          GSSD_INTERFACE_VERSION_V2
+#define GSSD_INTERFACE_VERSION_V2       (2)
+#define GSSD_INTERFACE_VERSION_V1       (1)
 
 struct lgssd_ioctl_param {
         int             version;        /* in   */
+        int             secid;          /* in   */
         char           *uuid;           /* in   */
         int             lustre_svc;     /* in   */
         uid_t           uid;            /* in   */
@@ -49,41 +113,8 @@ struct lgssd_ioctl_param {
 #define GSSD_DEFAULT_GETHOSTNAME_EX     "/etc/lustre/nid2hostname"
 #define MAPPING_DATABASE_FILE           "/etc/lustre/idmap.conf"
 
-typedef uint64_t lnet_nid_t;
-typedef uint32_t lnet_netid_t;
-
-#define LNET_NID_ANY      ((lnet_nid_t) -1)
-#define LNET_PID_ANY      ((lnet_pid_t) -1)
-
-enum {
-        /* Only add to these values (i.e. don't ever change or redefine them):
-         * network addresses depend on them... */
-        QSWLND    = 1,
-        SOCKLND   = 2,
-        GMLND     = 3,
-        PTLLND    = 4,
-        O2IBLND   = 5,
-        CIBLND    = 6,
-        OPENIBLND = 7,
-        IIBLND    = 8,
-        LOLND     = 9,
-        RALND     = 10,
-        VIBLND    = 11,
-        LND_ENUM_END_MARKER
-};
-
 int lnet_nid2hostname(lnet_nid_t nid, char *buf, int buflen);
 void cleanup_mapping(void);
-int lookup_mapping(char *princ, uint64_t nid, uid_t *uid);
-lnet_nid_t libcfs_str2nid(char *str);
-
-/* how an LNET NID encodes net:address */
-#define LNET_NIDADDR(nid)      ((uint32_t)((nid) & 0xffffffff))
-#define LNET_NIDNET(nid)       ((uint32_t)(((nid) >> 32)) & 0xffffffff)
-#define LNET_MKNID(net,addr)   ((((uint64_t)(net))<<32)|((uint64_t)(addr)))
-/* how net encodes type:number */
-#define LNET_NETNUM(net)       ((net) & 0xffff)
-#define LNET_NETTYP(net)       (((net) >> 16) & 0xffff)
-#define LNET_MKNET(typ,num)    ((((uint32_t)(typ))<<16)|((uint32_t)(num)))
-
-#endif /* __LIBCFS_H__ */
+int lookup_mapping(char *princ, lnet_nid_t nid, uid_t *uid);
+
+#endif /* __LSUPPORT_H__ */