/* Copyright 2001-2005 The Apache Software Foundation or its licensors, as
 * applicable.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef MOD_ARM4_H
#define MOD_ARM4_H

/*
 * Some ARM agents authorize users to ARM 4 interfaces
 * thru Posix capabilities. IBM EWLM on AIX is one such 
 * agent. 
 */
#ifdef _AIX
#define USE_CAP_ARM_APPLICATION
#endif

/* Since POSIX capabilities aren't fully standardized across platforms
 * hide all the cruft here so that we can keep mod_arm4 module as clean
 * as possible.
 */
#ifdef USE_CAP_ARM_APPLICATION

#ifdef _AIX
#include <sys/capabilities.h>
/* Define the capability number for the CAP_ARM_APPLICATION 
 * capability in the case this program is compiled on a version 
 * of AIX that does not have the capability defined in 
 * capabilities.h
 */
#ifndef CAP_ARM_APPLICATION
#define CAP_ARM_APPLICATION 5
#endif
/* Declare all the agent functions that -should- be declared in
 * sys/capabilities.h.
 */
void cap_clear(cap_t);
cap_t cap_init();
cap_t cap_dup(cap_t);
int cap_free(void *);
int cap_get_flag(cap_t, cap_value_t, cap_flag_t, cap_flag_value_t *);
int cap_get_proc(void);
int cap_set_proc(cap_t);
int cap_set_flag(cap_t cap_p, cap_flag_t flag, int ncap,
                    cap_value_t caps[], cap_flag_value_t value);
#else
/* Linux (and others?) use capability.h */
#include <sys/capability.h>
#endif /* ifdef _AIX */

#endif /* ifdef USE_CAP_ARM_APPLICATION */

#endif /* ifndef MOD_ARM4_H */
