aboutsummaryrefslogtreecommitdiffstats
path: root/include/asterisk/file.h
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>1999-11-21 02:26:43 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>1999-11-21 02:26:43 +0000
commit4c63f091a4767fbd5c0cefed92446a1a184065d0 (patch)
tree5d6ff7a3fa451a38d36e8e29c76e2ad73910b110 /include/asterisk/file.h
parentb3f95b5b13bd294be77c0cbe0a807c565ef568b0 (diff)
Version 0.1.0 from FTP
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@65 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include/asterisk/file.h')
-rwxr-xr-xinclude/asterisk/file.h84
1 files changed, 84 insertions, 0 deletions
diff --git a/include/asterisk/file.h b/include/asterisk/file.h
new file mode 100755
index 000000000..da4ffaa42
--- /dev/null
+++ b/include/asterisk/file.h
@@ -0,0 +1,84 @@
+/*
+ * Asterisk -- A telephony toolkit for Linux.
+ *
+ * Generic File Format Support.
+ *
+ * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ *
+ * Mark Spencer <markster@linux-support.net>
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License
+ */
+
+#ifndef _ASTERISK_FILE_H
+#define _ASTERISK_FILE_H
+
+#include <asterisk/channel.h>
+#include <asterisk/frame.h>
+#include <fcntl.h>
+
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+
+/* Convenient for waiting */
+#define AST_DIGIT_ANY "0123456789#*"
+
+/* Defined by individual formats. First item MUST be a
+ pointer for use by the stream manager */
+struct ast_filestream;
+
+/* Register a new file format capability */
+int ast_format_register(char *name, char *exts, int format,
+ struct ast_filestream * (*open)(int fd),
+ struct ast_filestream * (*rewrite)(int fd, char *comment),
+ int (*apply)(struct ast_channel *, struct ast_filestream *),
+ int (*write)(struct ast_filestream *, struct ast_frame *),
+ struct ast_frame * (*read)(struct ast_filestream *),
+ void (*close)(struct ast_filestream *),
+ char * (*getcomment)(struct ast_filestream *));
+
+int ast_format_unregister(char *name);
+
+/* Start streaming a file */
+int ast_streamfile(struct ast_channel *c, char *filename);
+
+/* Stop playback of a stream */
+int ast_stopstream(struct ast_channel *c);
+
+/* See if a given file exists in a given format. If fmt is NULL, any format is accepted.*/
+int ast_fileexists(char *filename, char *fmt);
+
+/* Rename a given file in a given format, or if fmt is NULL, then do so for all */
+int ast_filerename(char *oldname, char *newname, char *fmt);
+
+/* Delete a given file in a given format, or if fmt is NULL, then do so for all */
+int ast_filedelete(char *filename, char *fmt);
+
+/* Wait for a stream to stop or for any one of a given digit to arrive, Returns
+ 0 if the stream finishes, the character if it was interrupted, and -1 on error */
+char ast_waitstream(struct ast_channel *c, char *breakon);
+
+/* Create an outgoing file stream. oflags are flags for the open() command, and
+ if check is non-zero, then it will not write a file if there are any files that
+ start with that name and have an extension */
+struct ast_filestream *ast_writefile(char *filename, char *type, char *comment, int oflags, int check, mode_t mode);
+
+/* Send a frame to a filestream -- note: does NOT free the frame, call ast_frfree manually */
+int ast_writestream(struct ast_filestream *fs, struct ast_frame *f);
+
+/* Close a playback or recording stream */
+int ast_closestream(struct ast_filestream *f);
+
+#define AST_RESERVED_POINTERS 4
+
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+
+
+#endif