[asterisk-commits] kpfleming: branch group/t38_gateway r264948 - in /team/group/t38_gateway: inc...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri May 21 07:54:30 CDT 2010


Author: kpfleming
Date: Fri May 21 07:54:28 2010
New Revision: 264948

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=264948
Log:
Group technology module fields into functional groups


Modified:
    team/group/t38_gateway/include/asterisk/res_fax.h
    team/group/t38_gateway/res/res_fax.c
    team/group/t38_gateway/res/res_fax_spandsp.c

Modified: team/group/t38_gateway/include/asterisk/res_fax.h
URL: http://svnview.digium.com/svn/asterisk/team/group/t38_gateway/include/asterisk/res_fax.h?view=diff&rev=264948&r1=264947&r2=264948
==============================================================================
--- team/group/t38_gateway/include/asterisk/res_fax.h (original)
+++ team/group/t38_gateway/include/asterisk/res_fax.h Fri May 21 07:54:28 2010
@@ -211,36 +211,44 @@
 	const enum ast_fax_capabilities caps;
 	/*! module information for the fax technology */
 	struct ast_module *module;
-	/*! reserves a session for future use; returns a token */
-	struct ast_fax_tech_token *(* const reserve_session)(struct ast_fax_session *);
-	/*! releases an unused session token */
-	void (* const release_token)(struct ast_fax_tech_token *);
-	/*! creates a new fax session, optionally using a previously-reserved token */
-	void *(* const new_session)(struct ast_fax_session *, struct ast_fax_tech_token *);
-	/*! destroys an existing fax session */
-	void (* const destroy_session)(struct ast_fax_session *);
-	/*! sends an Asterisk frame to res_fax */
-	struct ast_frame *(* const read)(struct ast_fax_session *);
-	/*! writes an Asterisk frame to the fax session */
-	int (* const write)(struct ast_fax_session *, const struct ast_frame *);
-	/*! starts the fax session */
-	int (* const start_session)(struct ast_fax_session *);
-	/*! cancels a fax session */
-	int (* const cancel_session)(struct ast_fax_session *);
-	/*! initiates the generation of silence to the fax session */
-	int (* const generate_silence)(struct ast_fax_session *);
-	/*! switches an existing dual-mode session from audio to T.38 */
-	int (* const switch_to_t38)(struct ast_fax_session *);
-	/*! displays capabilities of the fax technology */
-	char * (* const cli_show_capabilities)(int);
-	/*! displays details about the fax session */
-	char * (* const cli_show_session)(struct ast_fax_session *, int);
-	/*! displays statistics from the fax technology module */
-	char * (* const cli_show_stats)(int);
-	/*! displays settings from the fax technology module */
-	char * (* const cli_show_settings)(int);
-};
-  
+	struct {
+		/*! reserves a session for future use; returns a token */
+		struct ast_fax_tech_token *(* const reserve_session)(struct ast_fax_session *);
+		/*! releases an unused session token */
+		void (* const release_token)(struct ast_fax_tech_token *);
+		/*! creates a new fax session, optionally using a previously-reserved token */
+		void *(* const new_session)(struct ast_fax_session *, struct ast_fax_tech_token *);
+		/*! destroys an existing fax session */
+		void (* const destroy_session)(struct ast_fax_session *);
+		/*! sends an Asterisk frame to res_fax */
+		struct ast_frame *(* const read)(struct ast_fax_session *);
+		/*! writes an Asterisk frame to the fax session */
+		int (* const write)(struct ast_fax_session *, const struct ast_frame *);
+		/*! starts the fax session */
+		int (* const start_session)(struct ast_fax_session *);
+		/*! cancels a fax session */
+		int (* const cancel_session)(struct ast_fax_session *);
+		/*! initiates the generation of silence to the fax session */
+		int (* const generate_silence)(struct ast_fax_session *);
+		/*! switches an existing dual-mode session from audio to T.38 */
+		int (* const switch_to_t38)(struct ast_fax_session *);
+	} endpoint;
+	struct {
+	} gateway;
+	struct {
+	} preamble_detector;
+	struct {
+		/*! displays capabilities of the fax technology */
+		char * (* const show_capabilities)(int);
+		/*! displays details about the fax session */
+		char * (* const show_session)(struct ast_fax_session *, int);
+		/*! displays statistics from the fax technology module */
+		char * (* const show_stats)(int);
+		/*! displays settings from the fax technology module */
+		char * (* const show_settings)(int);
+	} cli;
+};
+
 /*! \brief register a fax technology */
 int ast_fax_tech_register(struct ast_fax_tech *tech);
 

Modified: team/group/t38_gateway/res/res_fax.c
URL: http://svnview.digium.com/svn/asterisk/team/group/t38_gateway/res/res_fax.c?view=diff&rev=264948&r1=264947&r2=264948
==============================================================================
--- team/group/t38_gateway/res/res_fax.c (original)
+++ team/group/t38_gateway/res/res_fax.c Fri May 21 07:54:28 2010
@@ -480,7 +480,7 @@
 
 	if (s->tech) {
 		if (s->tech_pvt) {
-			s->tech->destroy_session(s);
+			s->tech->endpoint.destroy_session(s);
 		}
 		ast_module_unref(s->tech->module);
 	}
@@ -565,7 +565,7 @@
 		ao2_ref(s, -1);
 		return NULL;
 	}
-	if (!(s->tech_pvt = s->tech->new_session(s, NULL))) {
+	if (!(s->tech_pvt = s->tech->endpoint.new_session(s, NULL))) {
 		ast_log(LOG_ERROR, "FAX session failed to initialize.\n");
 		ao2_ref(s, -1);
 		ast_module_unref(faxmod->tech->module);
@@ -825,7 +825,7 @@
 	if (fax->debug_info) {
 		fax->debug_info->base_tv = ast_tvnow();
 	}
-	if (fax->tech->start_session(fax) < 0) {
+	if (fax->tech->endpoint.start_session(fax) < 0) {
 		GENERIC_FAX_EXEC_ERROR(fax, chan, "failed to start FAX session");
 	}
 
@@ -854,9 +854,9 @@
 				c = NULL;
 				chancount = 0;
 				timeout -= (1000 - ms);
-				fax->tech->cancel_session(fax);
-				if (fax->tech->generate_silence) {
-					fax->tech->generate_silence(fax);
+				fax->tech->endpoint.cancel_session(fax);
+				if (fax->tech->endpoint.generate_silence) {
+					fax->tech->endpoint.generate_silence(fax);
 				}
 				continue;
 			}
@@ -884,7 +884,7 @@
 					break;
 				}
 				if (t38negotiated && !was_t38) {
-					fax->tech->switch_to_t38(fax);
+					fax->tech->endpoint.switch_to_t38(fax);
 					details->caps &= ~AST_FAX_TECH_AUDIO;
 					expected_frametype = AST_FRAME_MODEM;
 					expected_framesubclass.codec = AST_MODEM_T38;
@@ -911,7 +911,7 @@
 							debug_check_frame_for_silence(fax, 1, f);
 						}
 						/* write the frame to the FAX stack */
-						fax->tech->write(fax, f);
+						fax->tech->endpoint.write(fax, f);
 						fax->frames_received++;
 						if (f != frame) {
 							ast_frfree(f);
@@ -919,7 +919,7 @@
 					}
 				} else {
 					/* write the frame to the FAX stack */
-					fax->tech->write(fax, frame);
+					fax->tech->endpoint.write(fax, frame);
 					fax->frames_received++;
 				}
 				timeout = RES_FAX_TIMEOUT;
@@ -928,7 +928,7 @@
 		} else if (ofd == fax->fd) {
 			/* read a frame from the FAX stack and send it out the channel.
  			 * the FAX stack will return a NULL if the FAX session has already completed */
-			if (!(frame = fax->tech->read(fax))) {
+			if (!(frame = fax->tech->endpoint.read(fax))) {
 				break;
 			}
 
@@ -1826,7 +1826,7 @@
 	AST_RWLIST_RDLOCK(&faxmodules);
 	AST_RWLIST_TRAVERSE(&faxmodules, fax, list) {
 		ast_cli(a->fd, "%-15s : %s\n%-15s : %s\n%-15s : ", "Type", fax->tech->type, "Description", fax->tech->description, "Capabilities");
-		fax->tech->cli_show_capabilities(a->fd);
+		fax->tech->cli.show_capabilities(a->fd);
 		num_modules++;
 	}
 	AST_RWLIST_UNLOCK(&faxmodules);
@@ -1863,7 +1863,7 @@
 	AST_RWLIST_RDLOCK(&faxmodules);
 	AST_RWLIST_TRAVERSE(&faxmodules, fax, list) {
 		ast_cli(a->fd, "%s (%s) Settings:\n", fax->tech->type, fax->tech->description);
-		fax->tech->cli_show_settings(a->fd);
+		fax->tech->cli.show_settings(a->fd);
 	}
 	AST_RWLIST_UNLOCK(&faxmodules);
 
@@ -1898,7 +1898,7 @@
 	ast_cli(a->fd, "\nFAX Session Details:\n--------------------\n\n");
 	s = ao2_find(faxregistry.container, &tmp, OBJ_POINTER);
 	if (s) {
-		s->tech->cli_show_session(s, a->fd);
+		s->tech->cli.show_session(s, a->fd);
 		ao2_ref(s, -1);
 	}
 	ast_cli(a->fd, "\n\n");
@@ -1930,7 +1930,7 @@
 	ast_cli(a->fd, "%-20.20s : %d\n", "Failed FAXes", faxregistry.fax_failures);
 	AST_RWLIST_RDLOCK(&faxmodules);
 	AST_RWLIST_TRAVERSE(&faxmodules, fax, list) {
-		fax->tech->cli_show_stats(a->fd);
+		fax->tech->cli.show_stats(a->fd);
 	}
 	AST_RWLIST_UNLOCK(&faxmodules);
 	ast_cli(a->fd, "\n\n");

Modified: team/group/t38_gateway/res/res_fax_spandsp.c
URL: http://svnview.digium.com/svn/asterisk/team/group/t38_gateway/res/res_fax_spandsp.c?view=diff&rev=264948&r1=264947&r2=264948
==============================================================================
--- team/group/t38_gateway/res/res_fax_spandsp.c (original)
+++ team/group/t38_gateway/res/res_fax_spandsp.c Fri May 21 07:54:28 2010
@@ -76,17 +76,17 @@
 	.version = "pre-20090220",
 #endif
 	.caps = AST_FAX_TECH_AUDIO | AST_FAX_TECH_T38 | AST_FAX_TECH_SEND | AST_FAX_TECH_RECEIVE,
-	.new_session = spandsp_fax_new,
-	.destroy_session = spandsp_fax_destroy,
-	.read = spandsp_fax_read,
-	.write = spandsp_fax_write,
-	.start_session = spandsp_fax_start,
-	.cancel_session = spandsp_fax_cancel,
-	.switch_to_t38 = spandsp_fax_switch_to_t38,
-	.cli_show_capabilities = spandsp_fax_cli_show_capabilities,
-	.cli_show_session = spandsp_fax_cli_show_session,
-	.cli_show_stats = spandsp_fax_cli_show_stats,
-	.cli_show_settings = spandsp_fax_cli_show_settings,
+	.endpoint.new_session = spandsp_fax_new,
+	.endpoint.destroy_session = spandsp_fax_destroy,
+	.endpoint.read = spandsp_fax_read,
+	.endpoint.write = spandsp_fax_write,
+	.endpoint.start_session = spandsp_fax_start,
+	.endpoint.cancel_session = spandsp_fax_cancel,
+	.endpoint.switch_to_t38 = spandsp_fax_switch_to_t38,
+	.cli.show_capabilities = spandsp_fax_cli_show_capabilities,
+	.cli.show_session = spandsp_fax_cli_show_session,
+	.cli.show_stats = spandsp_fax_cli_show_stats,
+	.cli.show_settings = spandsp_fax_cli_show_settings,
 };
 
 struct spandsp_fax_stats {




More information about the asterisk-commits mailing list