2005-11-19 20:07:43 +00:00
|
|
|
/*
|
|
|
|
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
|
|
|
* Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
|
|
|
|
*
|
|
|
|
* Version: MPL 1.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (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.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Anthony Minessale II <anthmct@yahoo.com>
|
|
|
|
* Portions created by the Initial Developer are Copyright (C)
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Anthony Minessale II <anthmct@yahoo.com>
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* switch_console.h -- Simple Console
|
|
|
|
*
|
|
|
|
*/
|
2006-01-03 00:48:52 +00:00
|
|
|
/*! \file switch_console.h
|
|
|
|
\brief Simple Console
|
2006-01-05 21:03:22 +00:00
|
|
|
|
|
|
|
This module implements a basic console i/o and by basic I mean, um yeah, basic
|
|
|
|
Right now the primary function of this portion of the program is to keep it from exiting.
|
2006-01-01 15:23:12 +00:00
|
|
|
*/
|
|
|
|
|
2005-11-19 20:07:43 +00:00
|
|
|
#ifndef SWITCH_CONSOLE_H
|
|
|
|
#define SWITCH_CONSOLE_H
|
|
|
|
|
|
|
|
#include <switch.h>
|
|
|
|
|
2006-09-07 14:23:31 +00:00
|
|
|
SWITCH_BEGIN_EXTERN_C
|
2006-09-07 03:58:01 +00:00
|
|
|
#define SWITCH_CMD_CHUNK_LEN 1024
|
2007-02-14 15:08:49 +00:00
|
|
|
#define SWITCH_STANDARD_STREAM(s) if ((s.data = malloc(SWITCH_CMD_CHUNK_LEN))) { \
|
2006-09-07 03:58:01 +00:00
|
|
|
memset(s.data, 0, SWITCH_CMD_CHUNK_LEN); \
|
|
|
|
s.end = s.data;\
|
|
|
|
s.data_size = SWITCH_CMD_CHUNK_LEN;\
|
|
|
|
s.write_function = switch_console_stream_write;\
|
|
|
|
s.alloc_len = SWITCH_CMD_CHUNK_LEN;\
|
|
|
|
s.alloc_chunk = SWITCH_CMD_CHUNK_LEN;\
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-04-28 20:04:08 +00:00
|
|
|
|
2006-01-05 21:03:22 +00:00
|
|
|
/*!
|
|
|
|
\brief A simple comand loop that reads input from the terminal
|
|
|
|
*/
|
2005-11-19 20:07:43 +00:00
|
|
|
SWITCH_DECLARE(void) switch_console_loop(void);
|
2006-01-05 21:03:22 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief A method akin to printf that allows you to redirect output to a specific console "channel"
|
|
|
|
*/
|
2007-02-13 21:03:06 +00:00
|
|
|
SWITCH_DECLARE(void) switch_console_printf(switch_text_channel_t channel, const char *file, const char *func, int line, const char *fmt, ...) PRINTF_FUNCTION(5,6);
|
2005-11-19 20:07:43 +00:00
|
|
|
|
2006-05-10 15:47:54 +00:00
|
|
|
/*!
|
|
|
|
\brief A method akin to printf for dealing with api streams
|
|
|
|
*/
|
2007-02-14 02:53:23 +00:00
|
|
|
SWITCH_DECLARE(switch_status_t) switch_console_stream_write(switch_stream_handle_t *handle, const char *fmt, ...) PRINTF_FUNCTION(2,3);
|
2006-09-07 15:15:39 +00:00
|
|
|
SWITCH_END_EXTERN_C
|
2005-11-19 20:07:43 +00:00
|
|
|
|
|
|
|
#endif
|
2006-11-27 22:30:48 +00:00
|
|
|
|
|
|
|
/* For Emacs:
|
|
|
|
* Local Variables:
|
|
|
|
* mode:c
|
2007-02-09 02:36:03 +00:00
|
|
|
* indent-tabs-mode:t
|
2006-11-27 22:30:48 +00:00
|
|
|
* tab-width:4
|
|
|
|
* c-basic-offset:4
|
|
|
|
* End:
|
|
|
|
* For VIM:
|
|
|
|
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
|
|
|
|
*/
|