<p>George Joseph has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14630">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">frame.c:  Make debugging easier<br><br> * ast_frame_subclass2str() and ast_frame_type2str() now return<br>   a pointer to the buffer that was passed in instead of void.<br>   This makes it easier to use these functions inline in<br>   printf-style debugging statements.<br><br> * Added many missing control frame entries in<br>   ast_frame_subclass2str.<br><br>Change-Id: Ifd0d6578e758cd644c96d17a5383ff2128c572fc<br>---<br>M include/asterisk/frame.h<br>M main/frame.c<br>2 files changed, 89 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/30/14630/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/asterisk/frame.h b/include/asterisk/frame.h</span><br><span>index 9c18227..c8359ec 100644</span><br><span>--- a/include/asterisk/frame.h</span><br><span>+++ b/include/asterisk/frame.h</span><br><span>@@ -635,9 +635,10 @@</span><br><span>  * \param slen Length of subclass buffer</span><br><span>  * \param moreinfo Buffer to fill with additional information</span><br><span>  * \param mlen Length of moreinfo buffer</span><br><span style="color: hsl(120, 100%, 40%);">+ * \return Pointer to subclass</span><br><span>  * \since 11</span><br><span>  */</span><br><span style="color: hsl(0, 100%, 40%);">-void ast_frame_subclass2str(struct ast_frame *f, char *subclass, size_t slen, char *moreinfo, size_t mlen);</span><br><span style="color: hsl(120, 100%, 40%);">+char *ast_frame_subclass2str(struct ast_frame *f, char *subclass, size_t slen, char *moreinfo, size_t mlen);</span><br><span> </span><br><span> /*!</span><br><span>  * \brief Copy the discription of a frame type into the provided string</span><br><span>@@ -645,9 +646,10 @@</span><br><span>  * \param frame_type The frame type to be described</span><br><span>  * \param ftype Buffer to fill with frame type description</span><br><span>  * \param len Length of subclass buffer</span><br><span style="color: hsl(120, 100%, 40%);">+ * \return Pointer to ftype</span><br><span>  * \since 11</span><br><span>  */</span><br><span style="color: hsl(0, 100%, 40%);">-void ast_frame_type2str(enum ast_frame_type frame_type, char *ftype, size_t len);</span><br><span style="color: hsl(120, 100%, 40%);">+char *ast_frame_type2str(enum ast_frame_type frame_type, char *ftype, size_t len);</span><br><span> </span><br><span> #if defined(__cplusplus) || defined(c_plusplus)</span><br><span> }</span><br><span>diff --git a/main/frame.c b/main/frame.c</span><br><span>index 4ae732b..4eeb3b6 100644</span><br><span>--- a/main/frame.c</span><br><span>+++ b/main/frame.c</span><br><span>@@ -394,7 +394,7 @@</span><br><span>           dst_s[i] = (src_s[i]<<8) | (src_s[i]>>8);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-void ast_frame_subclass2str(struct ast_frame *f, char *subclass, size_t slen, char *moreinfo, size_t mlen)</span><br><span style="color: hsl(120, 100%, 40%);">+char *ast_frame_subclass2str(struct ast_frame *f, char *subclass, size_t slen, char *moreinfo, size_t mlen)</span><br><span> {</span><br><span>   switch(f->frametype) {</span><br><span>    case AST_FRAME_DTMF_BEGIN:</span><br><span>@@ -477,6 +477,85 @@</span><br><span>                    snprintf(subclass, slen, "T38_Parameters/%s", message);</span><br><span>                    break;</span><br><span>               }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+           case AST_CONTROL_STREAM_STOP:</span><br><span style="color: hsl(120, 100%, 40%);">+                 ast_copy_string(subclass, "Stop stream", slen);</span><br><span style="color: hsl(120, 100%, 40%);">+                     break;</span><br><span style="color: hsl(120, 100%, 40%);">+                case AST_CONTROL_STREAM_SUSPEND:</span><br><span style="color: hsl(120, 100%, 40%);">+                      ast_copy_string(subclass, "Suspend stream", slen);</span><br><span style="color: hsl(120, 100%, 40%);">+                  break;</span><br><span style="color: hsl(120, 100%, 40%);">+                case AST_CONTROL_STREAM_RESTART:</span><br><span style="color: hsl(120, 100%, 40%);">+                      ast_copy_string(subclass, "Restart stream", slen);</span><br><span style="color: hsl(120, 100%, 40%);">+                  break;</span><br><span style="color: hsl(120, 100%, 40%);">+                case AST_CONTROL_STREAM_REVERSE:</span><br><span style="color: hsl(120, 100%, 40%);">+                      ast_copy_string(subclass, "Reverse stream", slen);</span><br><span style="color: hsl(120, 100%, 40%);">+                  break;</span><br><span style="color: hsl(120, 100%, 40%);">+                case AST_CONTROL_STREAM_FORWARD:</span><br><span style="color: hsl(120, 100%, 40%);">+                      ast_copy_string(subclass, "Forward stream", slen);</span><br><span style="color: hsl(120, 100%, 40%);">+                  break;</span><br><span style="color: hsl(120, 100%, 40%);">+                case AST_CONTROL_RECORD_CANCEL:</span><br><span style="color: hsl(120, 100%, 40%);">+                       ast_copy_string(subclass, "Cancel stream", slen);</span><br><span style="color: hsl(120, 100%, 40%);">+                   break;</span><br><span style="color: hsl(120, 100%, 40%);">+                case AST_CONTROL_RECORD_STOP:</span><br><span style="color: hsl(120, 100%, 40%);">+                 ast_copy_string(subclass, "Record stop", slen);</span><br><span style="color: hsl(120, 100%, 40%);">+                     break;</span><br><span style="color: hsl(120, 100%, 40%);">+                case AST_CONTROL_RECORD_SUSPEND:</span><br><span style="color: hsl(120, 100%, 40%);">+                      ast_copy_string(subclass, "Record suspend", slen);</span><br><span style="color: hsl(120, 100%, 40%);">+                  break;</span><br><span style="color: hsl(120, 100%, 40%);">+                case AST_CONTROL_RECORD_MUTE:</span><br><span style="color: hsl(120, 100%, 40%);">+                 ast_copy_string(subclass, "Record mute", slen);</span><br><span style="color: hsl(120, 100%, 40%);">+                     break;</span><br><span style="color: hsl(120, 100%, 40%);">+                case AST_CONTROL_SRCUPDATE:</span><br><span style="color: hsl(120, 100%, 40%);">+                   ast_copy_string(subclass, "Media source update", slen);</span><br><span style="color: hsl(120, 100%, 40%);">+                     break;</span><br><span style="color: hsl(120, 100%, 40%);">+                case AST_CONTROL_TRANSFER:</span><br><span style="color: hsl(120, 100%, 40%);">+                    ast_copy_string(subclass, "Transfer", slen);</span><br><span style="color: hsl(120, 100%, 40%);">+                        break;</span><br><span style="color: hsl(120, 100%, 40%);">+                case AST_CONTROL_CONNECTED_LINE:</span><br><span style="color: hsl(120, 100%, 40%);">+                      ast_copy_string(subclass, "Connected line update", slen);</span><br><span style="color: hsl(120, 100%, 40%);">+                   break;</span><br><span style="color: hsl(120, 100%, 40%);">+                case AST_CONTROL_REDIRECTING:</span><br><span style="color: hsl(120, 100%, 40%);">+                 ast_copy_string(subclass, "Redirect", slen);</span><br><span style="color: hsl(120, 100%, 40%);">+                        break;</span><br><span style="color: hsl(120, 100%, 40%);">+                case AST_CONTROL_CC:</span><br><span style="color: hsl(120, 100%, 40%);">+                  ast_copy_string(subclass, "CC", slen);</span><br><span style="color: hsl(120, 100%, 40%);">+                      break;</span><br><span style="color: hsl(120, 100%, 40%);">+                case AST_CONTROL_SRCCHANGE:</span><br><span style="color: hsl(120, 100%, 40%);">+                   ast_copy_string(subclass, "Media SSRC change", slen);</span><br><span style="color: hsl(120, 100%, 40%);">+                       break;</span><br><span style="color: hsl(120, 100%, 40%);">+                case AST_CONTROL_READ_ACTION:</span><br><span style="color: hsl(120, 100%, 40%);">+                 ast_copy_string(subclass, "Read action", slen);</span><br><span style="color: hsl(120, 100%, 40%);">+                     break;</span><br><span style="color: hsl(120, 100%, 40%);">+                case AST_CONTROL_AOC:</span><br><span style="color: hsl(120, 100%, 40%);">+                 ast_copy_string(subclass, "AOC", slen);</span><br><span style="color: hsl(120, 100%, 40%);">+                     break;</span><br><span style="color: hsl(120, 100%, 40%);">+                case AST_CONTROL_END_OF_Q:</span><br><span style="color: hsl(120, 100%, 40%);">+                    ast_copy_string(subclass, "Endof Q", slen);</span><br><span style="color: hsl(120, 100%, 40%);">+                 break;</span><br><span style="color: hsl(120, 100%, 40%);">+                case AST_CONTROL_INCOMPLETE:</span><br><span style="color: hsl(120, 100%, 40%);">+                  ast_copy_string(subclass, "Incomplete", slen);</span><br><span style="color: hsl(120, 100%, 40%);">+                      break;</span><br><span style="color: hsl(120, 100%, 40%);">+                case AST_CONTROL_MCID:</span><br><span style="color: hsl(120, 100%, 40%);">+                        ast_copy_string(subclass, "MCID", slen);</span><br><span style="color: hsl(120, 100%, 40%);">+                    break;</span><br><span style="color: hsl(120, 100%, 40%);">+                case AST_CONTROL_UPDATE_RTP_PEER:</span><br><span style="color: hsl(120, 100%, 40%);">+                     ast_copy_string(subclass, "Update RTP peer", slen);</span><br><span style="color: hsl(120, 100%, 40%);">+                 break;</span><br><span style="color: hsl(120, 100%, 40%);">+                case AST_CONTROL_PVT_CAUSE_CODE:</span><br><span style="color: hsl(120, 100%, 40%);">+                      ast_copy_string(subclass, "Private Cause Code", slen);</span><br><span style="color: hsl(120, 100%, 40%);">+                      break;</span><br><span style="color: hsl(120, 100%, 40%);">+                case AST_CONTROL_MASQUERADE_NOTIFY:</span><br><span style="color: hsl(120, 100%, 40%);">+                   ast_copy_string(subclass, "Masquerade notify", slen);</span><br><span style="color: hsl(120, 100%, 40%);">+                       break;</span><br><span style="color: hsl(120, 100%, 40%);">+                case AST_CONTROL_STREAM_TOPOLOGY_REQUEST_CHANGE:</span><br><span style="color: hsl(120, 100%, 40%);">+                      ast_copy_string(subclass, "Stream topology request change", slen);</span><br><span style="color: hsl(120, 100%, 40%);">+                  break;</span><br><span style="color: hsl(120, 100%, 40%);">+                case AST_CONTROL_STREAM_TOPOLOGY_CHANGED:</span><br><span style="color: hsl(120, 100%, 40%);">+                     ast_copy_string(subclass, "Stream topology changed", slen);</span><br><span style="color: hsl(120, 100%, 40%);">+                 break;</span><br><span style="color: hsl(120, 100%, 40%);">+                case AST_CONTROL_STREAM_TOPOLOGY_SOURCE_CHANGED:</span><br><span style="color: hsl(120, 100%, 40%);">+                      ast_copy_string(subclass, "Stream topology source changed", slen);</span><br><span style="color: hsl(120, 100%, 40%);">+                  break;</span><br><span>               case -1:</span><br><span>                     ast_copy_string(subclass, "Stop generators", slen);</span><br><span>                        break;</span><br><span>@@ -567,9 +646,11 @@</span><br><span>                ast_copy_string(subclass, "Unknown Subclass", slen);</span><br><span>               break;</span><br><span>       }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   return subclass;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-void ast_frame_type2str(enum ast_frame_type frame_type, char *ftype, size_t len)</span><br><span style="color: hsl(120, 100%, 40%);">+char *ast_frame_type2str(enum ast_frame_type frame_type, char *ftype, size_t len)</span><br><span> {</span><br><span>    switch (frame_type) {</span><br><span>        case AST_FRAME_DTMF_BEGIN:</span><br><span>@@ -624,6 +705,8 @@</span><br><span>             snprintf(ftype, len, "Unknown Frametype '%u'", frame_type);</span><br><span>                break;</span><br><span>       }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   return ftype;</span><br><span> }</span><br><span> </span><br><span> /*! Dump a frame for debugging purposes */</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/14630">change 14630</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/14630"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ifd0d6578e758cd644c96d17a5383ff2128c572fc </div>
<div style="display:none"> Gerrit-Change-Number: 14630 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>