aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2001-12-25 21:12:07 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2001-12-25 21:12:07 +0000
commit2ec0e7173627c60082309f3b4bed31a4d4350bf2 (patch)
tree478308e9771ec6ebdffba099906fc57c0b9bae7a /include
parentf3a2afa02ecccbf4300c74b832248630a761df6a (diff)
Version 0.1.10 from FTP
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@396 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rwxr-xr-xinclude/asterisk/crypto.h71
-rwxr-xr-xinclude/asterisk/io.h70
-rwxr-xr-xinclude/asterisk/md5.h5
-rwxr-xr-xinclude/asterisk/options.h2
4 files changed, 131 insertions, 17 deletions
diff --git a/include/asterisk/crypto.h b/include/asterisk/crypto.h
new file mode 100755
index 000000000..4aac31b1d
--- /dev/null
+++ b/include/asterisk/crypto.h
@@ -0,0 +1,71 @@
+/*
+ * Asterisk -- A telephony toolkit for Linux.
+ *
+ * Provide cryptographic signature routines
+ *
+ * Copyright (C) 1999, Mark Spencer
+ *
+ * Mark Spencer <markster@linux-support.net>
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License
+ */
+
+#ifndef _ASTERISK_CRYPTO_H
+#define _ASTERISK_CRYPTO_H
+
+#include <asterisk/channel.h>
+#include <asterisk/file.h>
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+#define AST_KEY_PUBLIC (1 << 0)
+#define AST_KEY_PRIVATE (1 << 1)
+
+struct ast_key;
+
+//! Retrieve a key
+/*!
+ * \param name of the key we are retrieving
+ * \param int type of key (AST_KEY_PUBLIC or AST_KEY_PRIVATE)
+ *
+ * Returns the key on success or NULL on failure
+ */
+extern struct ast_key *ast_key_get(char *key, int type);
+
+//! Initialize keys (that is, retrieve pass codes for all private keys)
+/*!
+ * \param fd a file descriptor for I/O for passwords
+ *
+ */
+extern int ast_key_init(int fd);
+
+//! Check the authenticity of a message signature using a given public key
+/*!
+ * \param key a public key to use to verify
+ * \param msg the message that has been signed
+ * \param sig the proposed valid signature in mime64-like encoding
+ *
+ * Returns 0 if the signature is valid, or -1 otherwise
+ *
+ */
+extern int ast_check_signature(struct ast_key *key, char *msg, char *sig);
+
+/*!
+ * \param key a private key to use to create the signature
+ * \param msg the message to sign
+ * \param sig a pointer to a buffer of at least 256 bytes in which the
+ * mime64-like encoded signature will be stored
+ *
+ * Returns 0 on success or -1 on failure.
+ *
+ */
+extern int ast_sign(struct ast_key *key, char *msg, char *sig);
+
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#endif
diff --git a/include/asterisk/io.h b/include/asterisk/io.h
index 82060c20d..d8d8d46e1 100755
--- a/include/asterisk/io.h
+++ b/include/asterisk/io.h
@@ -20,14 +20,20 @@
extern "C" {
#endif
-#define AST_IO_IN POLLIN /* Input ready */
-#define AST_IO_OUT POLLOUT /* Output ready */
-#define AST_IO_PRI POLLPRI /* Priority input ready */
+/*! Input ready */
+#define AST_IO_IN POLLIN
+/*! Output ready */
+#define AST_IO_OUT POLLOUT
+/*! Priority input ready */
+#define AST_IO_PRI POLLPRI
/* Implicitly polled for */
-#define AST_IO_ERR POLLERR /* Error condition (errno or getsockopt) */
-#define AST_IO_HUP POLLHUP /* Hangup */
-#define AST_IO_NVAL POLLNVAL /* Invalid fd */
+/*! Error condition (errno or getsockopt) */
+#define AST_IO_ERR POLLERR
+/*! Hangup */
+#define AST_IO_HUP POLLHUP
+/*! Invalid fd */
+#define AST_IO_NVAL POLLNVAL
/*
* An Asterisk IO callback takes its id, a file descriptor, list of events, and
@@ -37,34 +43,63 @@ extern "C" {
struct io_context;
-/* Create a context for I/O operations */
+//! Creates a context
+/*!
+ * Create a context for I/O operations
+ * Basically mallocs an IO structure and sets up some default values.
+ * Returns an allocated io_context structure
+ */
extern struct io_context *io_context_create(void);
-/* Destroy a context for I/O operations */
+//! Destroys a context
+/*
+ * \param ioc structure to destroy
+ * Destroy a context for I/O operations
+ * Frees all memory associated with the given io_context structure along with the structure itself
+ */
extern void io_context_destroy(struct io_context *ioc);
typedef int (*ast_io_cb)(int *id, int fd, short events, void *cbdata);
#define AST_IO_CB(a) ((ast_io_cb)(a))
-/*
+//! Adds an IO context
+/*!
+ * \param ioc which context to use
+ * \param fd which fd to monitor
+ * \param callback callback function to run
+ * \param events event mask of events to wait for
+ * \param data data to pass to the callback
* Watch for any of revents activites on fd, calling callback with data as
* callback data. Returns a pointer to ID of the IO event, or NULL on failure.
*/
extern int *ast_io_add(struct io_context *ioc, int fd, ast_io_cb callback, short events, void *data);
-/*
+//! Changes an IO handler
+/*!
+ * \param ioc which context to use
+ * \param id
+ * \param fd the fd you wish it to contain now
+ * \param callback new callback function
+ * \param events event mask to wait for
+ * \param data data to pass to the callback function
* Change an i/o handler, updating fd if > -1, callback if non-null, and revents
* if >-1, and data if non-null. Returns a pointero to the ID of the IO event,
* or NULL on failure.
*/
extern int *ast_io_change(struct io_context *ioc, int *id, int fd, ast_io_cb callback, short events, void *data);
-/*
+//! Removes an IO context
+/*!
+ * \param ioc which io_context to remove it from
+ * \param id which ID to remove
* Remove an I/O id from consideration Returns 0 on success or -1 on failure.
*/
extern int ast_io_remove(struct io_context *ioc, int *id);
-/*
+//! Waits for IO
+/*!
+ * \param ioc which context to act upon
+ * \param howlong how many milliseconds to wait
* Wait for I/O to happen, returning after
* howlong milliseconds, and after processing
* any necessary I/O. Returns the number of
@@ -72,11 +107,22 @@ extern int ast_io_remove(struct io_context *ioc, int *id);
*/
extern int ast_io_wait(struct io_context *ioc, int howlong);
+//! Dumps the IO array
/*
* Debugging: Dump everything in the I/O array
*/
extern void ast_io_dump(struct io_context *ioc);
+//! Set fd into non-echoing mode (if fd is a tty)
+
+extern int ast_hide_password(int fd);
+
+//! Restores TTY mode
+/*
+ * Call with result from previous ast_hide_password
+ */
+extern int ast_restore_tty(int fd, int oldstatus);
+
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
diff --git a/include/asterisk/md5.h b/include/asterisk/md5.h
index e264f686d..53a40c272 100755
--- a/include/asterisk/md5.h
+++ b/include/asterisk/md5.h
@@ -19,9 +19,4 @@ void MD5Update(struct MD5Context *context, unsigned char const *buf,
void MD5Final(unsigned char digest[16], struct MD5Context *context);
void MD5Transform(uint32 buf[4], uint32 const in[16]);
-/*
- * This is needed to make RSAREF happy on some MS-DOS compilers.
- */
-typedef struct MD5Context MD5_CTX;
-
#endif /* !MD5_H */
diff --git a/include/asterisk/options.h b/include/asterisk/options.h
index 9cd0b5ef9..375b216a1 100755
--- a/include/asterisk/options.h
+++ b/include/asterisk/options.h
@@ -23,12 +23,14 @@ extern int option_debug;
extern int option_nofork;
extern int option_quiet;
extern int option_console;
+extern int option_initcrypto;
extern int fully_booted;
extern char defaultlanguage[];
#define VERBOSE_PREFIX_1 " "
#define VERBOSE_PREFIX_2 " == "
#define VERBOSE_PREFIX_3 " -- "
+#define VERBOSE_PREFIX_4 " > "
#if defined(__cplusplus) || defined(c_plusplus)
}