On passing remove presumably duplicate code to generate
the message for the manager_hooks:
in the previous version, the message was almost the same as the one sent
to regular sessions, with the exception of the empty line at the end, and
a few (presumably unintentional) differences e.g. timestamps,
debugging, and lowercase headers for "event" and "privilege".
now we reuse the same message as before.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48553 65c4cc65-6c06-0410-ace0-fbb531ad65f3
renaming them to ast_str ... and putting the
struct ast_threadstorage pointer into the struct ast_str.
This makes the code a lot more readable.
At this point we can use these routines also to
replace ast_build_string().
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48510 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Not long ago i replaced lseek() with fseek() but
forgot that filr FILE's you need ftell to
give you the current position.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48501 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Long explaination:
The behaviour of the underlying malloc(0) differs depending on the
operating system. Some return NULL (SysV behaviour); some still
allocate a small chunk of memory and return a valid pointer (e.g.
traditional BSD); some (e.g. FreeBSD 6.x) return a non-null pointer
that causes a memory fault if used, even just for reading.
Given the above variety, better never call malloc(0).
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48389 65c4cc65-6c06-0410-ace0-fbb531ad65f3
are passed as an argument.
- Update the code in main/http.c to use the new interface
(the diff is large but mostly mechanical, due to the name change of
several variables);
- And since now it is trivial, implement "AMI over TLS", and document
the possible options in manager.conf
- And since the test client (openssl s_client -connect host:port )
does not generate \r\n as a line terminator, make get_input()
also accept just a \n as a line terminator (Mac users: do you
also need the \r-only version ?)
The option parsing in manager.conf is not very efficient, and needs
to be cleaned up and made similar to what we have in http.conf
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48351 65c4cc65-6c06-0410-ace0-fbb531ad65f3
https://origsvn.digium.com/svn/asterisk/trunk
................
r47986 | oej | 2006-11-24 07:00:19 -0700 (Fri, 24 Nov 2006) | 6 lines
Doxygen update
- Document cause codes
- Document a bit more on channel variables - global, predefined and local
- Fix some doxygen in channel.h. Adding one comment for two definitions does not
work. They won't be copied to each.
................
r47995 | murf | 2006-11-24 10:40:49 -0700 (Fri, 24 Nov 2006) | 1 line
This fix inspired by a patch supplied in bug 8189, which points out problems with the PLC code
................
r47997 | murf | 2006-11-24 11:17:25 -0700 (Fri, 24 Nov 2006) | 1 line
removed the svnmerge-integrated property from trunk; it's confusing svnmerge in newly created branches
................
r48001 | rizzo | 2006-11-25 02:02:42 -0700 (Sat, 25 Nov 2006) | 5 lines
set pointers to NULL after freeing memory to avoid multiple free()
probably 1.4/1.2 issue as well if someone can look into that.
................
r48003 | oej | 2006-11-25 02:45:57 -0700 (Sat, 25 Nov 2006) | 9 lines
- Adding comment on suspicious memory allocation. Seems like it's never freed, but I don't
have a clear understanding of the frame allocation/deallocation, so I just mark this
for investigation. (Reported by Ed Guy). We're trying to see if a free() hurts...
- Doxygen comments on p2p rtp bridge stuff. I am a bit worried about shortcutting
rtcp this way, but will need feedback from rtcp gurus. This should work for
video calls too, and possibly UDPTL.
................
r48004 | oej | 2006-11-25 02:48:30 -0700 (Sat, 25 Nov 2006) | 2 lines
Changing ERROR to lesser level. Imported from 1.2/1.4
................
r48008 | rizzo | 2006-11-25 10:37:04 -0700 (Sat, 25 Nov 2006) | 7 lines
generalize a bit the functions used to create an tcp socket
and then run a service on it.
The code in manager.c does essentially the same things,
so we will be able to reuse the code in here (probably
moving it to netsock.c or another appropriate library file).
................
r48009 | mattf | 2006-11-25 13:30:04 -0700 (Sat, 25 Nov 2006) | 1 line
Updates to show linkset command
................
r48010 | mattf | 2006-11-25 13:54:38 -0700 (Sat, 25 Nov 2006) | 2 lines
Add ss7 show linkset command
................
r48011 | mattf | 2006-11-25 14:32:33 -0700 (Sat, 25 Nov 2006) | 1 line
Make sure we don't send a group reset on a group larger than 32 CICs
................
r48012 | mattf | 2006-11-25 14:35:23 -0700 (Sat, 25 Nov 2006) | 1 line
bug fix
................
r48013 | mattf | 2006-11-25 14:46:58 -0700 (Sat, 25 Nov 2006) | 1 line
Make compiler happier
................
r48014 | mattf | 2006-11-25 14:50:42 -0700 (Sat, 25 Nov 2006) | 1 line
Little fix so we use the right message
................
r48016 | murf | 2006-11-25 17:15:42 -0700 (Sat, 25 Nov 2006) | 9 lines
Merged revisions 48015 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r48015 | murf | 2006-11-25 17:01:34 -0700 (Sat, 25 Nov 2006) | 1 line
A little bit of func_cdr documentation upgrade-- no bug# involved, although 8221 may have inspired it.
........
................
r48018 | murf | 2006-11-25 17:31:13 -0700 (Sat, 25 Nov 2006) | 9 lines
Merged revisions 48017 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r48017 | murf | 2006-11-25 17:26:16 -0700 (Sat, 25 Nov 2006) | 1 line
might as well also document the raw values of the flag vars
........
................
r48019 | russell | 2006-11-25 23:55:33 -0700 (Sat, 25 Nov 2006) | 6 lines
- Add some comments on thread storage with a brief explanation of what it is
as well as what the motivation is for using it.
- Add a comment by the declaration of ast_inet_ntoa() noting that this function
is not reentrant, and the result of a previous call to the function is no
longer valid after calling it again.
................
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48350 65c4cc65-6c06-0410-ace0-fbb531ad65f3
the infrastructure exposed in http.c earlier today.
As a bonus, now we can restart the session on a different
port just reloading the module.
On passing, fix a bug in the handling of 'enabled' in the configuration
file - previously, a missing "enabled=" line in manager.conf meant
"whatever the state was before" instead of a specific value.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48338 65c4cc65-6c06-0410-ace0-fbb531ad65f3
as described in
http://lists.digium.com/pipermail/asterisk-dev/2006-December/025213.html
In detail, this commit does the following:
b) change the function get_input() to use fread() instead of read()
to collect the data. One can still do the ast_wait_for_input() on
the original descriptor returned by accept().
c) change the function send_string() to work on the FILE *.
As a side effect, this change now really guarantees that
we don't spend more than "writetimeout" milliseconds on
each line sent.
d) modify the function action_command() so that it creates a
temporary file descriptor to be passed to ast_cli_command(),
and then read back the data from the temp file and write it
to the output with send_string(). The code is similar to
what is done in generic_http_callback() to support AMI-over-HTTP.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48332 65c4cc65-6c06-0410-ace0-fbb531ad65f3
an extra allocation on a path where we have way too many already.
Unfortunately the AMI-over-HTTP requires multiple copies,
because we need to generate a header, then the raw output to
an intermediate buffer, then convert it to html/xml, and
finally copy everything into a malloc'ed buffer because
that's what the generic_http_callback interface expects.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48090 65c4cc65-6c06-0410-ace0-fbb531ad65f3
to simplify the body of the main loop of the accepting thread.
Rename purge_unused() to purge_events() so one knows what the
function does.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48081 65c4cc65-6c06-0410-ace0-fbb531ad65f3
+ use a wrapper around ast_carefulwrite(), used in two places,
to make life easier when we decide to use a different interface
to the socket.
+ put an ast_verbose() message on astman_append on a case that
should never happen now that we use a temporary file for
AMI-over-HTTP sessions
+ document and slightly simplify process_events() by removing
unnecessary parentheses.
+ in get_input(), use ast_wait_for_input() instead of poll().
We may want to move to a completely non-blocking
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48080 65c4cc65-6c06-0410-ace0-fbb531ad65f3
debugging code in the manager.
At the moment the debugging code is very lightweight, if the option
is enabled manager messages also carry a sequence number and
the info where they have been generated e.g.
SequenceNumber: 10
File: chan_sip.c
Line: 11927
Func: handle_response_register
It is not worthwhile having this as a compile time option
right now, because the extra work involved at runtime is
just checking one variable.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47132 65c4cc65-6c06-0410-ace0-fbb531ad65f3
- Check the channel name string length to be zero, not non-zero
- Check the message string length to be zero, not non-zero
- unlock the channel *after* calling sendtext
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46661 65c4cc65-6c06-0410-ace0-fbb531ad65f3
simplifies the manager queue handling as described in
the comment, and will make a lot easier to make further
work on this code.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
to minimize diffs with future modifications.
The current implementation is problematic for the following reasons:
+ all insertions are O(N) because the event list does not have a tail
pointer;
+ there is only a single lock protecting both session and users queues.
+ the implementation of the queue itself is not documented.
I think i have figured it out, more or less, but am unclear on
whether there is proper locking in place
The rewrite (which i have working locally) uses a tailq so insertions
are O(1), separate locks for the event and session queues, and has
a documented implementation so hopefully we can figure out if/where
bug exist.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45753 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Of interest:
+ ast_get_manager_by_name_locked() is now without the ast_
prefix as it is a local function;
+ unuse_eventqent() renamed to unref_event(), and returns
the pointer to the next entry.
+ marked with XXX a couple of usages of unref_event()
because i suspect we are addressing the wrong entry.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45648 65c4cc65-6c06-0410-ace0-fbb531ad65f3
be called for each thread specific object after they are allocated. Note that
there was already the ability to define a custom cleanup function. Also, if
the custom cleanup function is used, it *MUST* call free on the thread
specific object at the end. There is no way to have this magically done that
I can think of because the cleanup function registered with the pthread
implementation will only call the function back with a pointer to the
thread specific object, not the parent ast_threadstorage object.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45623 65c4cc65-6c06-0410-ace0-fbb531ad65f3
+ more comments on struct mansession and global variables;
+ small improvements to the session matching code so it supports
multiple sessions from the same IP
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45597 65c4cc65-6c06-0410-ace0-fbb531ad65f3
around so that functions belonging to the same group are
close to each other.
At the beginning of each group i have added a bit of documentation
to explain what the group does and what is the typical flow - basically,
all i have learned by code inspection over the past few days should
be documented for you to read.
I have not put many doxygen annotations just because i am not
sure what are the proper ones. Hopefully some doxygen experts will jump in.
Next on the plate: try to figure out how "struct eventqent"
are supposed to work.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45582 65c4cc65-6c06-0410-ace0-fbb531ad65f3