Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create stubs file; fix clang warnings. #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
200 changes: 2 additions & 198 deletions radius.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ any other GPL-like (LGPL, GPL2) License.
#include "php_radius.h"
#include "radlib.h"
#include "radlib_private.h"
#include "radius_arginfo.h"

#ifndef PHP_WIN32
#include <sys/socket.h>
Expand All @@ -68,211 +69,14 @@ ZEND_DECLARE_MODULE_GLOBALS(radius)
/* True global resources - no need for thread safety here */
static int le_radius;

/* {{{ arginfo */
ZEND_BEGIN_ARG_INFO_EX(arginfo_radius_auth_open, 0, 0, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_radius_acct_open, 0, 0, 0)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_radius_close, 0, 0, 1)
ZEND_ARG_INFO(0, radius_handle)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_radius_strerror, 0, 0, 1)
ZEND_ARG_INFO(0, radius_handle)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_radius_config, 0, 0, 2)
ZEND_ARG_INFO(0, radius_handle)
ZEND_ARG_INFO(0, file)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_radius_add_server, 0, 0, 6)
ZEND_ARG_INFO(0, radius_handle)
ZEND_ARG_INFO(0, hostname)
ZEND_ARG_INFO(0, port)
ZEND_ARG_INFO(0, secret)
ZEND_ARG_INFO(0, timeout)
ZEND_ARG_INFO(0, max_tries)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_radius_create_request, 0, 0, 2)
ZEND_ARG_INFO(0, radius_handle)
ZEND_ARG_INFO(0, type)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_radius_put_string, 0, 0, 3)
ZEND_ARG_INFO(0, radius_handle)
ZEND_ARG_INFO(0, type)
ZEND_ARG_INFO(0, value)
ZEND_ARG_INFO(0, options)
ZEND_ARG_INFO(0, tag)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_radius_put_int, 0, 0, 3)
ZEND_ARG_INFO(0, radius_handle)
ZEND_ARG_INFO(0, type)
ZEND_ARG_INFO(0, value)
ZEND_ARG_INFO(0, options)
ZEND_ARG_INFO(0, tag)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_radius_put_attr, 0, 0, 3)
ZEND_ARG_INFO(0, radius_handle)
ZEND_ARG_INFO(0, type)
ZEND_ARG_INFO(0, value)
ZEND_ARG_INFO(0, options)
ZEND_ARG_INFO(0, tag)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_radius_put_addr, 0, 0, 3)
ZEND_ARG_INFO(0, radius_handle)
ZEND_ARG_INFO(0, type)
ZEND_ARG_INFO(0, addr)
ZEND_ARG_INFO(0, options)
ZEND_ARG_INFO(0, tag)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_radius_put_vendor_string, 0, 0, 4)
ZEND_ARG_INFO(0, radius_handle)
ZEND_ARG_INFO(0, vendor)
ZEND_ARG_INFO(0, type)
ZEND_ARG_INFO(0, value)
ZEND_ARG_INFO(0, options)
ZEND_ARG_INFO(0, tag)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_radius_put_vendor_int, 0, 0, 4)
ZEND_ARG_INFO(0, radius_handle)
ZEND_ARG_INFO(0, vendor)
ZEND_ARG_INFO(0, type)
ZEND_ARG_INFO(0, value)
ZEND_ARG_INFO(0, options)
ZEND_ARG_INFO(0, tag)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_radius_put_vendor_attr, 0, 0, 4)
ZEND_ARG_INFO(0, radius_handle)
ZEND_ARG_INFO(0, vendor)
ZEND_ARG_INFO(0, type)
ZEND_ARG_INFO(0, value)
ZEND_ARG_INFO(0, options)
ZEND_ARG_INFO(0, tag)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_radius_put_vendor_addr, 0, 0, 4)
ZEND_ARG_INFO(0, radius_handle)
ZEND_ARG_INFO(0, vendor)
ZEND_ARG_INFO(0, type)
ZEND_ARG_INFO(0, addr)
ZEND_ARG_INFO(0, options)
ZEND_ARG_INFO(0, tag)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_radius_send_request, 0, 0, 1)
ZEND_ARG_INFO(0, radius_handle)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_radius_get_attr, 0, 0, 1)
ZEND_ARG_INFO(0, radius_handle)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_radius_get_tagged_attr_data, 0, 0, 1)
ZEND_ARG_INFO(0, data)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_radius_get_tagged_attr_tag, 0, 0, 1)
ZEND_ARG_INFO(0, data)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_radius_get_vendor_attr, 0, 0, 1)
ZEND_ARG_INFO(0, data)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_radius_cvt_addr, 0, 0, 1)
ZEND_ARG_INFO(0, data)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_radius_cvt_int, 0, 0, 1)
ZEND_ARG_INFO(0, data)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_radius_cvt_string, 0, 0, 1)
ZEND_ARG_INFO(0, data)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_radius_salt_encrypt_attr, 0, 0, 2)
ZEND_ARG_INFO(0, radius_handle)
ZEND_ARG_INFO(0, data)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_radius_request_authenticator, 0, 0, 1)
ZEND_ARG_INFO(0, radius_handle)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_radius_server_secret, 0, 0, 1)
ZEND_ARG_INFO(0, radius_handle)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_radius_demangle, 0, 0, 2)
ZEND_ARG_INFO(0, radius_handle)
ZEND_ARG_INFO(0, mangled)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_radius_demangle_mppe_key, 0, 0, 2)
ZEND_ARG_INFO(0, radius_handle)
ZEND_ARG_INFO(0, mangled)
ZEND_END_ARG_INFO()

/* }}} */


/* {{{ radius_functions[]
*
* Every user visible function must have an entry in radius_functions[].
*/
zend_function_entry radius_functions[] = {
PHP_FE(radius_auth_open, arginfo_radius_auth_open)
PHP_FE(radius_acct_open, arginfo_radius_acct_open)
PHP_FE(radius_close, arginfo_radius_close)
PHP_FE(radius_strerror, arginfo_radius_strerror)
PHP_FE(radius_config, arginfo_radius_config)
PHP_FE(radius_add_server, arginfo_radius_add_server)
PHP_FE(radius_create_request, arginfo_radius_create_request)
PHP_FE(radius_put_string, arginfo_radius_put_string)
PHP_FE(radius_put_int, arginfo_radius_put_int)
PHP_FE(radius_put_attr, arginfo_radius_put_attr)
PHP_FE(radius_put_addr, arginfo_radius_put_addr)
PHP_FE(radius_put_vendor_string, arginfo_radius_put_vendor_string)
PHP_FE(radius_put_vendor_int, arginfo_radius_put_vendor_int)
PHP_FE(radius_put_vendor_attr, arginfo_radius_put_vendor_attr)
PHP_FE(radius_put_vendor_addr, arginfo_radius_put_vendor_addr)
PHP_FE(radius_send_request, arginfo_radius_get_attr)
PHP_FE(radius_get_attr, arginfo_radius_get_attr)
PHP_FE(radius_get_tagged_attr_data, arginfo_radius_get_tagged_attr_data)
PHP_FE(radius_get_tagged_attr_tag, arginfo_radius_get_tagged_attr_tag)
PHP_FE(radius_get_vendor_attr, arginfo_radius_get_vendor_attr)
PHP_FE(radius_cvt_addr, arginfo_radius_cvt_addr)
PHP_FE(radius_cvt_int, arginfo_radius_cvt_int)
PHP_FE(radius_cvt_string, arginfo_radius_cvt_string)
PHP_FE(radius_salt_encrypt_attr, arginfo_radius_salt_encrypt_attr)
PHP_FE(radius_request_authenticator, arginfo_radius_request_authenticator)
PHP_FE(radius_server_secret, arginfo_radius_server_secret)
PHP_FE(radius_demangle, arginfo_radius_demangle)
PHP_FE(radius_demangle_mppe_key, arginfo_radius_demangle_mppe_key)
{NULL, NULL, NULL} /* Must be the last line in radius_functions[] */
};
/* }}} */

/* {{{ radius_module_entry
*/
zend_module_entry radius_module_entry = {
#if ZEND_MODULE_API_NO >= 20010901
STANDARD_MODULE_HEADER,
#endif
"radius",
radius_functions,
ext_functions,
PHP_MINIT(radius),
PHP_MSHUTDOWN(radius),
NULL,
Expand Down
126 changes: 126 additions & 0 deletions radius.stub.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<?php

/** @generate-function-entries */

/**
* @return resource|false
*/
function radius_acct_open ( ) {}

/**
* @param resource $radius_handle
*/
function radius_add_server ( $radius_handle , string $hostname , int $port , string $secret , int $timeout , int $max_tries ) : bool {}

/**
* @return resource|false
*/
function radius_auth_open ( ) {}

/**
* @param resource $radius_handle
*/
function radius_close ( $radius_handle ) : bool {}

/**
* @param resource $radius_handle
*/
function radius_config ( $radius_handle , string $file ) : bool {}

/**
* @param resource $radius_handle
*/
function radius_create_request ( $radius_handle , int $type ) : bool {}

function radius_cvt_addr ( string $data ) : string {}

function radius_cvt_int ( string $data ) : int {}

function radius_cvt_string ( string $data ) : string {}

/**
* @param resource $radius_handle
*/
function radius_demangle_mppe_key ( $radius_handle , string $mangled ) : string|false {}

/**
* @param resource $radius_handle
*/
function radius_demangle ( $radius_handle , string $mangled ) : string|false {}

/**
* @param resource $radius_handle
*/
function radius_get_attr ( $radius_handle ) : array|int {}

function radius_get_tagged_attr_data ( string $data ) : string|false {}

function radius_get_tagged_attr_tag ( string $data ) : int|false {}

function radius_get_vendor_attr ( string $data ) : array|false {}

/**
* @param resource $radius_handle
*/
function radius_put_addr ( $radius_handle , int $type , string $address , ?int $options = 0 , int $tag = 0 ) : bool {}

/**
* @param resource $radius_handle
*/
function radius_put_attr ( $radius_handle , int $type , string $value , ?int $options = 0 , int $tag = 0 ) : bool {}

/**
* @param resource $radius_handle
*/
function radius_put_int ( $radius_handle , int $type , int $value , ?int $options = 0 , int $tag = 0 ) : bool {}

/**
* @param resource $radius_handle
*/
function radius_put_string ( $radius_handle , int $type , string $value , ?int $options = 0 , int $tag = 0 ) : bool {}

/**
* @param resource $radius_handle
*/
function radius_put_vendor_addr ( $radius_handle , int $vendor , int $type , string $address ) : bool {}

/**
* @param resource $radius_handle
*/
function radius_put_vendor_attr ( $radius_handle , int $vendor , int $type , string $value , ?int $options = 0 , int $tag = 0 ) : bool {}

/**
* @param resource $radius_handle
*/
function radius_put_vendor_int ( $radius_handle , int $vendor , int $type , int $value , ?int $options = 0 , int $tag = 0 ) : bool {}

/**
* @param resource $radius_handle
*/
function radius_put_vendor_string ( $radius_handle , int $vendor , int $type , string $value , ?int $options = 0 , int $tag = 0 ) : bool {}

/**
* @param resource $radius_handle
*/
function radius_request_authenticator ( $radius_handle ) : string|false {}

/**
* @param resource $radius_handle
*/
function radius_salt_encrypt_attr ( $radius_handle , string $data ) : string|false {}

/**
* @param resource $radius_handle
*/
function radius_send_request ( $radius_handle ) : int|false {}

/**
* @param resource $radius_handle
*/
function radius_server_secret ( $radius_handle ) : string {}

/**
* @param resource $radius_handle
*/
function radius_strerror ( $radius_handle ) : string {}

Loading