#ifndef _UTIL_H_
#define _UTIL_H_ 1
+#if !defined(WIN32)
#include <sys/param.h>
+#endif
#include <string.h>
#include <errno.h>
#include <krb5.h>
+#if defined(WIN32)
+#define INLINE __inline
+typedef unsigned __int16 uint16_t;
+typedef unsigned __int32 uint32_t;
+#else
+#define INLINE inline
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
const gss_buffer_t src,
gss_buffer_t dst);
-static inline int
+static INLINE int
bufferEqual(const gss_buffer_t b1, const gss_buffer_t b2)
{
return (b1->length == b2->length &&
memcmp(b1->value, b2->value, b2->length) == 0);
}
-static inline int
+static INLINE int
bufferEqualString(const gss_buffer_t b1, const char *s)
{
gss_buffer_desc b2;
const gss_OID_set src,
gss_OID_set *dst);
-static inline int
+static INLINE int
oidEqual(const gss_OID_desc *o1, const gss_OID_desc *o2)
{
if (o1 == GSS_C_NO_OID)
#define GSSEAP_ONCE_INITIALIZER PTHREAD_ONCE_INIT
/* Helper functions */
-static inline void
+static INLINE void
store_uint16_be(uint16_t val, void *vp)
{
unsigned char *p = (unsigned char *)vp;
p[1] = (val ) & 0xff;
}
-static inline uint16_t
+static INLINE uint16_t
load_uint16_be(const void *cvp)
{
const unsigned char *p = (const unsigned char *)cvp;
return (p[1] | (p[0] << 8));
}
-static inline void
+static INLINE void
store_uint32_be(uint32_t val, void *vp)
{
unsigned char *p = (unsigned char *)vp;
p[3] = (val ) & 0xff;
}
-static inline uint32_t
+static INLINE uint32_t
load_uint32_be(const void *cvp)
{
const unsigned char *p = (const unsigned char *)cvp;
| ((uint32_t) p[0] << 24));
}
-static inline void
+static INLINE void
store_uint64_be(uint64_t val, void *vp)
{
unsigned char *p = (unsigned char *)vp;
p[7] = (unsigned char)((val ) & 0xff);
}
-static inline uint64_t
+static INLINE uint64_t
load_uint64_be(const void *cvp)
{
const unsigned char *p = (const unsigned char *)cvp;
return ((uint64_t)load_uint32_be(p) << 32) | load_uint32_be(p + 4);
}
-static inline unsigned char *
+static INLINE unsigned char *
store_buffer(gss_buffer_t buffer, void *vp, int wide_nums)
{
unsigned char *p = (unsigned char *)vp;
return p;
}
-static inline unsigned char *
+static INLINE unsigned char *
load_buffer(const void *cvp, size_t length, gss_buffer_t buffer)
{
buffer->length = 0;
return (unsigned char *)cvp + length;
}
-static inline unsigned char *
+static INLINE unsigned char *
store_oid(gss_OID oid, void *vp)
{
gss_buffer_desc buf;
return store_buffer(&buf, vp, FALSE);
}
-static inline void
+static INLINE void
krbDataToGssBuffer(krb5_data *data, gss_buffer_t buffer)
{
buffer->value = (void *)data->data;
buffer->length = data->length;
}
-static inline void
+static INLINE void
krbPrincComponentToGssBuffer(krb5_principal krbPrinc,
int index, gss_buffer_t buffer)
{
#endif /* HAVE_HEIMDAL_VERSION */
}
-static inline void
+static INLINE void
krbPrincRealmToGssBuffer(krb5_principal krbPrinc, gss_buffer_t buffer)
{
#ifdef HAVE_HEIMDAL_VERSION
#endif
}
-static inline void
+static INLINE void
gssBufferToKrbData(gss_buffer_t buffer, krb5_data *data)
{
data->data = (char *)buffer->value;