36 #include <sys/socket.h> 62 #define LOCAL_NBSCAT "/usr/local/bin/nbscat8k" 63 #define NBSCAT "/usr/bin/nbscat8k" 66 #define AF_LOCAL AF_UNIX 69 static char *
app =
"NBScat";
87 dup2(fd, STDOUT_FILENO);
92 fprintf(stderr,
"Execute of nbscat8k failed\n");
101 fds[0].events = POLLIN;
107 return read(fd, data, datalen);
126 if (socketpair(
AF_LOCAL, SOCK_STREAM, 0, fds)) {
145 myf.f.src = __PRETTY_FUNCTION__;
146 myf.f.delivery.tv_sec = 0;
147 myf.f.delivery.tv_usec = 0;
148 myf.f.data.ptr = myf.frdata;
161 res =
timed_read(fds[0], myf.frdata,
sizeof(myf.frdata));
164 myf.f.samples = res / 2;
185 ast_debug(1,
"Null frame == hangup() detected\n");
206 if (!res && owriteformat)
AST_MODULE_INFO_STANDARD_DEPRECATED(ASTERISK_GPL_KEY, "Silly NBS Stream Application")
Main Channel structure associated with a channel.
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
Support for translation of data formats. translate.c.
void ast_close_fds_above_n(int n)
Common routine for child processes, to close all fds prior to exec(2)
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
static int NBScat_exec(struct ast_channel *chan, const char *data)
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
int ast_unregister_application(const char *app)
Unregister an application.
#define ast_debug(level,...)
Log a DEBUG message.
General Asterisk PBX channel definitions.
#define AST_FRIENDLY_OFFSET
Offset into a frame's data buffer.
#define ast_poll(a, b, c)
Asterisk internal frame definitions.
struct timeval ast_samp2tv(unsigned int _nsamp, unsigned int _rate)
Returns a timeval corresponding to the duration of n samples at rate r. Useful to convert samples to ...
int ast_set_write_format(struct ast_channel *chan, struct ast_format *format)
Sets write format on channel chan.
Core PBX routines and definitions.
int ast_set_priority(int)
We set ourselves to a high priority, that we might pre-empt everything else. If your PBX has heavy ac...
int ast_safe_fork(int stop_reaper)
Common routine to safely fork without a chance of a signal handler firing badly in the child...
struct timeval ast_tvadd(struct timeval a, struct timeval b)
Returns the sum of two timevals a + b.
static int timed_read(int fd, void *data, int datalen)
int ast_write(struct ast_channel *chan, struct ast_frame *frame)
Write a frame to a channel This function writes the given frame to the indicated channel.
int ast_waitfor(struct ast_channel *chan, int ms)
Wait for input on a channel.
static int load_module(void)
Data structure associated with a single frame of data.
enum ast_frame_type frametype
static int NBScatplay(int fd)
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
struct ast_format * ast_channel_writeformat(struct ast_channel *chan)
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
static int unload_module(void)
int ast_stopstream(struct ast_channel *c)
Stops a stream.
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
#define ast_opt_high_priority