Changeset 26:b4684b76c6ab in freeDiameter for freeDiameter/server.c
- Timestamp:
- Oct 26, 2009, 4:44:16 PM (15 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
freeDiameter/server.c
r25 r26 100 100 struct client * c = arg; 101 101 struct server * s = NULL; 102 uint8_t * buf = NULL; 103 size_t bufsz; 104 struct msg * msg = NULL; 105 struct msg_hdr *hdr = NULL; 102 106 103 107 TRACE_ENTRY("%p", c); … … 127 131 c->ts.tv_sec += INCNX_TIMEOUT; 128 132 129 TODO("receive message until c->ts"); 130 131 TODO("Timeout => close"); 132 TODO("Message != CER => close"); 133 TODO("Message == CER : "); 133 /* Receive the first Diameter message on the connection -- cleanup in case of timeout */ 134 CHECK_FCT_DO( fd_cnx_receive(c->conn, &c->ts, &buf, &bufsz), goto cleanup ); 135 136 TRACE_DEBUG(FULL, "Received %zb from new client '%s'", bufsz, fd_cnx_getid(c->conn)); 137 138 /* Try parsing this message */ 139 CHECK_FCT_DO( fd_msg_parse_buffer( &buf, bufsz, &msg ), /* Parsing failed */ goto cleanup ); 140 141 /* We expect a CER, it must parse with our dictionary */ 142 CHECK_FCT_DO( fd_msg_parse_dict( msg, fd_g_config->cnf_dict ), /* Parsing failed */ goto cleanup ); 143 144 if (TRACE_BOOL(FULL)) { 145 fd_log_debug("Received Diameter message from new client '%s':\n", fd_cnx_getid(c->conn)); 146 fd_msg_dump_walk(FULL, msg); 147 } 148 149 /* Now check we received a CER */ 150 CHECK_FCT_DO( fd_msg_hdr ( msg, &hdr ), goto fatal_error ); 151 152 CHECK_PARAMS_DO( (hdr->msg_appl == 0) && (hdr->msg_flags & CMD_FLAG_REQUEST) && (hdr->msg_code == CC_CAPABILITIES_EXCHANGE), 153 { fd_log_debug("Connection '%s', expecting CER, received something else, closing...\n", fd_cnx_getid(c->conn)); goto cleanup; } ); 154 155 134 156 TODO("Search matching peer"); 135 157 TODO("Send event to the peer"); … … 146 168 if (c->conn) 147 169 fd_cnx_destroy(c->conn); 170 171 /* Cleanup the received buffer if any */ 172 free(buf); 173 174 /* Cleanup the parsed message if any */ 175 if (msg) { 176 CHECK_FCT_DO( fd_msg_free(msg), /* continue */); 177 } 148 178 149 179 /* Detach the thread, cleanup the client structure */
Note: See TracChangeset
for help on using the changeset viewer.