* Create a decoding session. * * A session holds all decoder instances, their stack relationships and * output callbacks. * * @param sess A pointer which will hold a pointer to a newly * initialized session on return. Must not be NULL. * * @return SRD_OK upon success, a (negative) error code otherwise. * * @since 0.3.0 */
| 62 | * @since 0.3.0 |
| 63 | */ |
| 64 | SRD_API int srd_session_new(struct srd_session **sess) |
| 65 | { |
| 66 | struct srd_session *se = NULL; |
| 67 | |
| 68 | if (!sess) |
| 69 | return SRD_ERR_ARG; |
| 70 | |
| 71 | se = malloc(sizeof(struct srd_session)); |
| 72 | if (se == NULL){ |
| 73 | srd_err("%s,ERROR:failed to alloc memory.", __func__); |
| 74 | return SRD_ERR; |
| 75 | } |
| 76 | memset(se, 0, sizeof(struct srd_session)); |
| 77 | |
| 78 | se->session_id = ++max_session_id; |
| 79 | |
| 80 | /* Keep a list of all sessions, so we can clean up as needed. */ |
| 81 | sessions = g_slist_append(sessions, se); |
| 82 | |
| 83 | *sess = se; |
| 84 | |
| 85 | //srd_info("Creating session %d.", (*sess)->session_id); |
| 86 | |
| 87 | return SRD_OK; |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * Start a decoding session. |
no outgoing calls
no test coverage detected