dect
/
asterisk
Archived
13
0
Fork 0
Commit Graph

355 Commits

Author SHA1 Message Date
markster 6e270f0ae8 Fix comment preservation code (thanks murf!)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@46288 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-26 01:38:47 +00:00
rizzo 2e548a50d5 i really think it is safe to commit this version, that
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: http://svn.digium.com/svn/asterisk/trunk@46120 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-24 17:14:12 +00:00
rizzo 5e167d54c8 minor comment changes, code rearrangement and field renaming
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: http://svn.digium.com/svn/asterisk/trunk@45753 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-20 11:24:43 +00:00
oej bc7883b922 Doxygen corrections
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45742 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-20 08:00:13 +00:00
rizzo 9fc4cf6980 more fixes to comments and very minor code rearrangement.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45696 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-19 17:26:20 +00:00
rizzo 96167b391b implement proper XML/HTML formatting of multiple messages
(e.g. the result of waitevent).

Also fix some comments.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45690 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-19 17:07:08 +00:00
rizzo cc60583cb6 more documentation of data structure and functions.
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: http://svn.digium.com/svn/asterisk/trunk@45648 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-19 07:43:43 +00:00
russell 21cbb8bb68 Extend the thread storage API such that a custom initialization function can
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: http://svn.digium.com/svn/asterisk/trunk@45623 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-19 01:00:57 +00:00
rizzo 6a1a45a520 silent warning from a debugging message (which will go away
soon, anyways)



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45611 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 22:40:02 +00:00
rizzo fb300e0612 remove trailing whitespace
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45599 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 21:41:09 +00:00
rizzo d68ba2d09f ouch! remember to unlink temporary files once done with them.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45598 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 21:36:20 +00:00
rizzo 93784d6aba + move output_format variables in the http section of the file;
+ 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: http://svn.digium.com/svn/asterisk/trunk@45597 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 21:30:21 +00:00
rizzo 90c480f49d another bunch of comments on the data structures.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45583 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 17:53:47 +00:00
rizzo 713b6b817a despite the large changes, this commit only moves functions
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: http://svn.digium.com/svn/asterisk/trunk@45582 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 17:45:50 +00:00
rizzo 78cdd30eba more comment and formatting fixes, small simplifications
to functions get_input() and session_do()



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45572 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 16:52:13 +00:00
mogorman da8aef1fc3 rizzo compile then commit, maybe even run it too ^_^
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45571 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 16:45:22 +00:00
rizzo 13dc47f57d comment and cleanup the main thread.
On passing, fix a bug: close the socket if the allocation
of a structure for the new session fails.
(the bugfix is a candidate for 1.4)



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45561 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 15:49:40 +00:00
rizzo fdb5962fae create a new (internal, for the time being) function astman_start_ack()
to start manager responses that need further lines.
This removes a lot of duplicate code from the various handlers
that at the moment build an ActionID string themselves.

Once settled, the function should move to manager.h so
it can be used by other files (chan_agent, chan_iax2, chan_sip,
chan_zap, res_jabber and app_queue).

I am not totally clear if there is a preferred position for
the ActionID: line in a message. Some instances put it at
the end, but one would argue that it is preferable to have
it at the beginning.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45551 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 14:21:15 +00:00
rizzo 59bee9954d more indentation cleanup from previous commits,
and remove the "busy" field from struct mansession
as it was not used correctly anyways.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45541 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 13:42:14 +00:00
rizzo 67fc1bcd75 create proper handlers for "Challenge" and "Login" actions,
rather than use inline code for them.
Things are more readable this way, and also error processing
is more consistent.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45540 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 13:23:22 +00:00
rizzo 2a74685732 fix indentation from a commit of a couple of days ago
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45530 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 12:55:12 +00:00
rizzo 18827b8ac3 another batch of simplifications to authenticate()
(they are committed a bit at a time so it is easier to
revert them in case we find a bug at a later time).



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45529 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 12:38:24 +00:00
rizzo 3933708d51 remove unused fields and unimplemented options.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45518 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 11:59:08 +00:00
rizzo 440510b692 first pass as simplifying authenticate(), avoiding whitespace changes
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45516 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 11:54:06 +00:00
rizzo fbe8d94965 more code simplifications
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45515 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 11:43:31 +00:00
rizzo ab2bb64d8a simplify ast_strings_to_mask
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45505 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 10:14:58 +00:00
rizzo 22d613b827 add a comment to remember that a block of code is
completely redundant.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45495 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 08:48:50 +00:00
rizzo 155fe80952 + move the enum declaration for output formats near the head
of the file, so it can be used from more places;
+ make the declaration of contenttype[] more robust;
+ remove the wrappers around __xml_translate(), since they were
  used only in one place, and rename to xml_translate().
  This allows for a bit of simplifications.
+ document the output produced by the above function.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45485 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 06:28:34 +00:00
rizzo 519206a7ef merge xml_translate() and html_translate() into one function since
they do similar things.

Add a small form on top of the html output so request like
http://foo:8088/asterisk/manager will suggest you what to do.

Note: i suspect there is still a bug somewhere in the session matching
code, as sometimes you have to login twice in order for the following
commands to be recognised.

Apart from this, the cli now is basically usable from a web form!



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45475 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 05:31:54 +00:00
file b31277825f Warning be gone!
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45398 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-17 21:09:49 +00:00
rizzo 7813852f07 simplify authority_to_str() using ast_build_string()
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45351 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-17 18:08:51 +00:00
rizzo 04aba2dbed Improve the XML formatting of responses coming from web interface.
Normal responses are sequences of lines of the form "Name: value",
with \r\n as line terminators and an empty line as a response
terminator.

Generi CLI commands, however, do not have such a clean formatting,
and the existing code failed to generate valid XML for them.
Obviously we can only use heuristics here, and we do the following:
- accept either \r or \n as a line terminator, trimming trailing whitespace;
- if a line does not have a ":" in it, assume that from this point on
  we have unformatted data, and use "Opaque-data:" as a name;
- if a line does have a ":" in it, the Name field is not always
  a legal identifier, so replace non-alphanum characters with underscores;

All the above is to be refined as we improve the formatting of
responses from the CLI.

And, all the above ought to go as a comment in the code rather than
just in a commit message...
  


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45334 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-17 17:51:34 +00:00
rizzo 2e31cdbf7e open a temporary file to receive the output from cli commands
invoked through the http interface.

It is not terribly efficient but better than no output at all.
Todo: use a configurable /tmp directory instead of a hardwired one.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45330 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-17 17:41:59 +00:00
rizzo 7673e5c24a document xml_copy_escape() and add an extra function, namely
replace non-alphanum chars with underscore.
This is useful when building field names in xml formatting.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45325 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-17 17:19:31 +00:00
rizzo ec8004ac16 + comment some unclear fields of struct mansession;
+ let some commands (Challenge, Login) be processed even if
  already authenticated, as it doesn't harm and prevents some
  incorrect error messages

+ remove custom code for Logoff - the existing handler was ok.

Some indentation fixes may be necessary



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45219 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-16 14:00:53 +00:00
rizzo 661ccc5d4b + comment some unclear requirements for master_eventq
+ remove the need for an snprintf in astman_get_header()
+ fix comment for manager list eventq
+ localize one variable and minor code simplifications.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45185 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-16 11:29:22 +00:00
rizzo 2f69cfdbe4 protect access to first_action with actionlock.
Mark with XXX one place (during command execution) where
navigation should be protected with actionlock, but is not
because it would block requests for a long time.

To solve this properly we need to put reference counts in
the struct manager_action.
A suboptimal fix is to copy the record on a search and then
unlock the list while we work on the copy.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45177 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-16 09:33:00 +00:00
russell aabdfc585b Merged revisions 44945 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r44945 | russell | 2006-10-12 12:56:32 -0400 (Thu, 12 Oct 2006) | 2 lines

fix a silly typo in a comment that I saw while reading the commit list

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44946 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-12 16:57:36 +00:00
nadi 9f77d518ea Merged revisions 44921 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r44921 | nadi | 2006-10-12 14:55:25 +0200 (Do, 12 Okt 2006) | 2 lines

append_event must be called while holding the session lock

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44922 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-12 13:04:03 +00:00
rizzo fea07f8eea basically fix indentation of a large function after previous
simplifications. On passing, use a single exit point.

(once done with the cleanup i will merge the changes into 1.4,
if applicable)



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44626 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-06 21:04:43 +00:00
rizzo 6e5dda36f5 s cannot be null here, so remove the useless test and error-handling block.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44617 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-06 20:34:11 +00:00
rizzo 1a51660834 simplify logic in preparation to reduce indentation
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44616 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-06 20:16:13 +00:00
rizzo d70733010d make sure sockets are blocking when they should be blocking.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44568 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-06 15:59:57 +00:00
kpfleming 1a08d9e31b Merged revisions 44378 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r44378 | kpfleming | 2006-10-04 14:47:22 -0500 (Wed, 04 Oct 2006) | 4 lines

update thread creation code a bit
reduce standard thread stack size slightly to allow the pthreads library to allocate the stack+data and not overflow a power-of-2 allocation in the kernel and waste memory/address space
add a new stack size for 'background' threads (those that don't handle PBX calls) when LOW_MEMORY is defined

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44379 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-04 19:51:38 +00:00
mogorman 4a1aaf52ae bug #8076 check option_debug before printing to debug channel.
patch provided in bugnote, with minor changes.


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44253 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-03 15:53:07 +00:00
tilghman 33d8fe4c3e Remove deprecated CLI apps from the core
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43449 f38db490-d61c-443f-a65b-d21fe96a405b
2006-09-21 21:17:39 +00:00
tilghman c8a470374f Remove 1.4 changes from UPGRADE.txt, remove deprecated callerid field, remove deprecated SetGlobalVar app
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43444 f38db490-d61c-443f-a65b-d21fe96a405b
2006-09-21 20:01:54 +00:00
tilghman e8ef9fd3ba Constify the result of a config retrieval function, to avoid mutilation (issue 7983).
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43364 f38db490-d61c-443f-a65b-d21fe96a405b
2006-09-20 20:40:39 +00:00
qwell 3a260bee7e Commit the changes from issue #5240.
Original patch by junky, modified by anthonyl, modified again by jcolp (with minor modifications by me)


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43300 f38db490-d61c-443f-a65b-d21fe96a405b
2006-09-19 22:01:23 +00:00
qwell 46e384f88c After discussing this with other people, we decided we'd like to try to do this a little differently.
Stay tuned.


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43290 f38db490-d61c-443f-a65b-d21fe96a405b
2006-09-19 19:58:09 +00:00
anthonyl ff5e99c7e0 5240 update
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43289 f38db490-d61c-443f-a65b-d21fe96a405b
2006-09-19 19:28:57 +00:00
kpfleming 5aacb6a82d merge qwell's CLI verbification work
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43212 f38db490-d61c-443f-a65b-d21fe96a405b
2006-09-18 19:54:18 +00:00
kpfleming 5c0e56df21 merge markster's usersconf branch with some slight changes
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43052 f38db490-d61c-443f-a65b-d21fe96a405b
2006-09-16 23:53:58 +00:00
russell f0779c48bc - simplify and improve astmm by using thread storage instead of a dynamic
allocation and free on every call of the function for preparing the string
  that will be appended.  Then, use the ast_dynamic_str() code instead of the
  open coded version that is appended to when waiting for it to be delivered.
- use for loops for list traversals
- convert the manager sessions list to use list macros
- use atomic operations for num_sessions and usecounts
- convert some defines to the equivalent enum


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@40783 f38db490-d61c-443f-a65b-d21fe96a405b
2006-08-21 19:42:29 +00:00
kpfleming 8b0c007ad9 merge new_loader_completion branch, including (at least):
- restructured build tree and makefiles to eliminate recursion problems
  - support for embedded modules
  - support for static builds
  - simpler cross-compilation support
  - simpler module/loader interface (no exported symbols)



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@40722 f38db490-d61c-443f-a65b-d21fe96a405b
2006-08-21 02:11:39 +00:00