| 1 | /* |
| 2 | * libiax: An implementation of the Inter-Asterisk eXchange protocol |
| 3 | * |
| 4 | * Asterisk internal frame definitions. |
| 5 | * |
| 6 | * Copyright (C) 1999, Mark Spencer |
| 7 | * |
| 8 | * Mark Spencer <[email protected]> |
| 9 | * |
| 10 | * This program is free software, distributed under the terms of |
| 11 | * the GNU Lesser General Public License. Other components of |
| 12 | * Asterisk are distributed under The GNU General Public License |
| 13 | * only. |
| 14 | */ |
| 15 | |
| 16 | #ifndef _LIBIAX_FRAME_H |
| 17 | #define _LIBIAX_FRAME_H |
| 18 | |
| 19 | #if defined(__cplusplus) || defined(c_plusplus) |
| 20 | extern "C" { |
| 21 | #endif |
| 22 | |
| 23 | /* Frame types */ |
| 24 | #define AST_FRAME_DTMF 1 /* A DTMF digit, subclass is the digit */ |
| 25 | #define AST_FRAME_VOICE 2 /* Voice data, subclass is AST_FORMAT_* */ |
| 26 | #define AST_FRAME_VIDEO 3 /* Video frame, maybe?? :) */ |
| 27 | #define AST_FRAME_CONTROL 4 /* A control frame, subclass is AST_CONTROL_* */ |
| 28 | #define AST_FRAME_NULL 5 /* An empty, useless frame */ |
| 29 | #define AST_FRAME_IAX 6 /* Inter Aterisk Exchange private frame type */ |
| 30 | #define AST_FRAME_TEXT 7 /* Text messages */ |
| 31 | #define AST_FRAME_IMAGE 8 /* Image Frames */ |
| 32 | #define AST_FRAME_HTML 9 /* HTML Frames */ |
| 33 | #define AST_FRAME_CNG 10 /* Comfort Noise frame (subclass is level of CNG in -dBov) */ |
| 34 | |
| 35 | /* HTML subclasses */ |
| 36 | #define AST_HTML_URL 1 /* Sending a URL */ |
| 37 | #define AST_HTML_DATA 2 /* Data frame */ |
| 38 | #define AST_HTML_BEGIN 4 /* Beginning frame */ |
| 39 | #define AST_HTML_END 8 /* End frame */ |
| 40 | #define AST_HTML_LDCOMPLETE 16 /* Load is complete */ |
| 41 | #define AST_HTML_NOSUPPORT 17 /* Peer is unable to support HTML */ |
| 42 | #define AST_HTML_LINKURL 18 /* Send URL and track */ |
| 43 | #define AST_HTML_UNLINK 19 /* Request no more linkage */ |
| 44 | #define AST_HTML_LINKREJECT 20 /* Reject LINKURL */ |
| 45 | |
| 46 | /* Data formats for capabilities and frames alike */ |
| 47 | /*! G.723.1 compression */ |
| 48 | #define AST_FORMAT_G723_1 (1 << 0) |
| 49 | /*! GSM compression */ |
| 50 | #define AST_FORMAT_GSM (1 << 1) |
| 51 | /*! Raw mu-law data (G.711) */ |
| 52 | #define AST_FORMAT_ULAW (1 << 2) |
| 53 | /*! Raw A-law data (G.711) */ |
| 54 | #define AST_FORMAT_ALAW (1 << 3) |
| 55 | /*! ADPCM (G.726, 32kbps) */ |
| 56 | #define AST_FORMAT_G726 (1 << 4) |
| 57 | /*! ADPCM (IMA) */ |
| 58 | #define AST_FORMAT_ADPCM (1 << 5) |
| 59 | /*! Raw 16-bit Signed Linear (8000 Hz) PCM */ |
| 60 | #define AST_FORMAT_SLINEAR (1 << 6) |
| 61 | /*! LPC10, 180 samples/frame */ |
| 62 | #define AST_FORMAT_LPC10 (1 << 7) |
| 63 | /*! G.729A audio */ |
| 64 | #define AST_FORMAT_G729A (1 << 8) |
| 65 | /*! SpeeX Free Compression */ |
| 66 | #define AST_FORMAT_SPEEX (1 << 9) |
| 67 | /*! iLBC Free Compression */ |
| 68 | #define AST_FORMAT_ILBC (1 << 10) |
| 69 | /*! Maximum audio format */ |
| 70 | #define AST_FORMAT_MAX_AUDIO (1 << 15) |
| 71 | /*! JPEG Images */ |
| 72 | #define AST_FORMAT_JPEG (1 << 16) |
| 73 | /*! PNG Images */ |
| 74 | #define AST_FORMAT_PNG (1 << 17) |
| 75 | /*! H.261 Video */ |
| 76 | #define AST_FORMAT_H261 (1 << 18) |
| 77 | /*! H.263 Video */ |
| 78 | #define AST_FORMAT_H263 (1 << 19) |
| 79 | /*! H.263+ Video */ |
| 80 | #define AST_FORMAT_H263p (1 << 20) |
| 81 | /*! H.264 Video*/ |
| 82 | #define AST_FORMAT_H264 (1 << 21) |
| 83 | /*! MPEG4 Video*/ |
| 84 | #define AST_FORMAT_MPEG4 (1 << 22) |
| 85 | /*! Theora Video */ |
| 86 | #define AST_FORMAT_THEORA (1 << 24) |
| 87 | /*! Max one */ |
| 88 | #define AST_FORMAT_MAX_VIDEO (1 << 24) |
| 89 | |
| 90 | /* Control frame types */ |
| 91 | #define AST_CONTROL_HANGUP 1 /* Other end has hungup */ |
| 92 | #define AST_CONTROL_RING 2 /* Local ring */ |
| 93 | #define AST_CONTROL_RINGING 3 /* Remote end is ringing */ |
| 94 | #define AST_CONTROL_ANSWER 4 /* Remote end has answered */ |
| 95 | #define AST_CONTROL_BUSY 5 /* Remote end is busy */ |
| 96 | #define AST_CONTROL_TAKEOFFHOOK 6 /* Make it go off hook */ |
| 97 | #define AST_CONTROL_OFFHOOK 7 /* Line is off hook */ |
| 98 | #define AST_CONTROL_CONGESTION 8 /* Congestion (circuits busy) */ |
| 99 | #define AST_CONTROL_FLASH 9 /* Flash hook */ |
| 100 | #define AST_CONTROL_WINK 10 /* Wink */ |
| 101 | #define AST_CONTROL_OPTION 11 /* Set an option */ |
| 102 | |
| 103 | #define AST_FRIENDLY_OFFSET 64 /* Reserved header space */ |
| 104 | |
| 105 | struct ast_frame { |
| 106 | /*! Kind of frame */ |
| 107 | int frametype; |
| 108 | /*! Subclass, frame dependent */ |
| 109 | int subclass; |
| 110 | /*! Length of data */ |
| 111 | int datalen; |
| 112 | /*! Number of 8khz samples in this frame */ |
| 113 | int samples; |
| 114 | /*! Was the data malloc'd? i.e. should we free it when we discard the f |
| 115 | rame? */ |
| 116 | int mallocd; |
| 117 | /*! How far into "data" the data really starts */ |
| 118 | int offset; |
| 119 | /*! Optional source of frame for debugging */ |
| 120 | char *src; |
| 121 | /*! Pointer to actual data */ |
| 122 | void *data; |
| 123 | /*! Next/Prev for linking stand alone frames */ |
| 124 | struct ast_frame *prev; |
| 125 | /*! Next/Prev for linking stand alone frames */ |
| 126 | struct ast_frame *next; |
| 127 | /* Unused except |
| 128 | if debugging is turned on, but left |
| 129 | in the struct |
| 130 | so that it can be turned on without |
| 131 | requiring a r |
| 132 | ecompile of the whole thing */ |
| 133 | }; |
| 134 | |
| 135 | |
| 136 | |
| 137 | #if defined(__cplusplus) || defined(c_plusplus) |
| 138 | } |
| 139 | #endif |
| 140 | |
| 141 | |
| 142 | #endif |