[Asterisk-cvs] asterisk/include/asterisk channel.h, 1.89, 1.90 linkedlists.h, 1.14, 1.15 pbx.h, 1.47, 1.48

kpfleming at lists.digium.com kpfleming at lists.digium.com
Fri Jul 8 17:06:00 CDT 2005


Update of /usr/cvsroot/asterisk/include/asterisk
In directory localhost.localdomain:/tmp/cvs-serv23507/include/asterisk

Modified Files:
	channel.h linkedlists.h pbx.h 
Log Message:
queue device state changes and handle them serially in a background thread
optimize device state related functions
add ast_get_channel_by_name_prefix to allow searching for matching channels in O(1) operation


Index: channel.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/channel.h,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -d -r1.89 -r1.90
--- channel.h	5 Jul 2005 17:16:17 -0000	1.89
+++ channel.h	8 Jul 2005 21:14:34 -0000	1.90
@@ -444,21 +444,6 @@
 /*! Do not transmit voice data */
 #define AST_STATE_MUTE		(1 << 16)	
 
-/*! Device is valid but channel didn't know state */
-#define AST_DEVICE_UNKNOWN	0
-/*! Device is not used */
-#define AST_DEVICE_NOT_INUSE	1
-/*! Device is in use */
-#define AST_DEVICE_INUSE	2
-/*! Device is busy */
-#define AST_DEVICE_BUSY		3
-/*! Device is invalid */
-#define AST_DEVICE_INVALID	4
-/*! Device is unavailable */
-#define AST_DEVICE_UNAVAILABLE	5
-/*! Device is ringing */
-#define AST_DEVICE_RINGING	6
-
 /*! Create a channel structure */
 /*! Returns NULL on failure to allocate. New channels are 
 	by default set to the "default" context and
@@ -494,27 +479,6 @@
  */
 struct ast_channel *ast_request(const char *type, int format, void *data, int *status);
 
-/*! Search the Channels by Name */
-/*!
- * \param device like a dialstring
- * Search the Device in active channels by compare the channelname against 
- * the devicename. Compared are only the first chars to the first '-' char.
- * Returns an AST_DEVICE_UNKNOWN if no channel found or
- * AST_DEVICE_INUSE if a channel is found
- */
-int ast_parse_device_state(char *device);
-
-/*! Asks a channel for device state */
-/*!
- * \param device like a dialstring
- * Asks a channel for device state, data is  normaly a number from dialstring
- * used by the low level module
- * Trys the channel devicestate callback if not supported search in the
- * active channels list for the device.
- * Returns an AST_DEVICE_??? state -1 on failure
- */
-int ast_device_state(char *device);
-
 /*!
  * \param type type of channel to request
  * \param format requested channel format
@@ -545,6 +509,12 @@
  */
 void ast_channel_unregister(const struct ast_channel_tech *tech);
 
+/*! Get a channel technology structure by name
+ * \param name name of technology to find
+ * \return a pointer to the structure, or NULL if no matching technology found
+ */
+const struct ast_channel_tech *ast_get_channel_tech(const char *name);
+
 /*! Hang up a channel  */
 /*! 
  * \param chan channel to hang up
@@ -759,6 +729,9 @@
 /*! Get channel by name (locks channel) */
 struct ast_channel *ast_get_channel_by_name_locked(const char *chan);
 
+/*! Get channel by name prefix (locks channel) */
+struct ast_channel *ast_get_channel_by_name_prefix_locked(const char *name, const int namelen);
+
 /*! Waits for a digit */
 /*! 
  * \param c channel to wait for a digit on

Index: linkedlists.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/linkedlists.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- linkedlists.h	6 Jun 2005 20:27:51 -0000	1.14
+++ linkedlists.h	8 Jul 2005 21:14:34 -0000	1.15
@@ -306,11 +306,13 @@
   used to link entries of this list together.
 
   Removes the head entry from the list, and returns a pointer to it. The
-  forward-link pointer in the returned entry is \b not cleared.
+  forward-link pointer in the returned entry is \b not cleared. This macro
+  is safe to call on an empty list.
  */
 #define AST_LIST_REMOVE_HEAD(head, field) ({				\
 		typeof((head)->first) cur = (head)->first;		\
-		(head)->first = (head)->first->field.next;		\
+		if (cur)						\
+			(head)->first = cur->field.next;		\
 		cur;							\
 	})
 

Index: pbx.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/pbx.h,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- pbx.h	18 May 2005 01:49:13 -0000	1.47
+++ pbx.h	8 Jul 2005 21:14:34 -0000	1.48
@@ -51,8 +51,6 @@
 
 typedef int (*ast_state_cb_type)(char *context, char* id, int state, void *data);
 
-typedef int (*ast_devstate_cb_type)(const char *dev, int state, void *data);
-
 /*! Data structure associated with a custom function */
 struct ast_custom_function {
 	char *name;
@@ -253,16 +251,6 @@
  */
 int ast_extension_state(struct ast_channel *c, char *context, char *exten);
 
-/*! Tells Asterisk the State for Device is changed */
-/*!
- * \param fmt devicename like a dialstring with format parameters
- * Asterisk polls the new extensionstates and calls the registered
- * callbacks for the changed extensions
- * Returns 0 on success, -1 on failure
- */
-int ast_device_state_changed(const char *fmt, ...)
-	__attribute__ ((format (printf, 1, 2)));
-
 /*! Registers a state change callback */
 /*!
  * \param context which context to look in
@@ -275,15 +263,6 @@
 int ast_extension_state_add(const char *context, const char *exten, 
 			    ast_state_cb_type callback, void *data);
 
-/*! Registers a device state change callback */
-/*!
- * \param data to pass to callback
- * The callback is called if the state for extension is changed
- * Return -1 on failure, ID on success
- */ 
-int ast_devstate_add(ast_devstate_cb_type callback, void *data);
-void ast_devstate_del(ast_devstate_cb_type callback, void *data);
-
 /*! Deletes a registered state change callback by ID */
 /*!
  * \param id of the callback to delete
@@ -629,6 +608,8 @@
  */
 void ast_func_write(struct ast_channel *chan, const char *in, const char *value);
 
+void ast_hint_state_changed(const char *device);
+
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif




More information about the svn-commits mailing list