Changeset 26:b4684b76c6ab in freeDiameter
- Timestamp:
- Oct 26, 2009, 4:44:16 PM (15 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- freeDiameter
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
freeDiameter/cnxctx.c
r25 r26 504 504 || (length > DIAMETER_MSG_SIZE_MAX)) { /* to avoid too big mallocs */ 505 505 /* The message is suspect */ 506 TRACE_DEBUG(INFO, "Received suspect header [ver: %d, size: % g], assume disconnection", (int)header[0], length);506 TRACE_DEBUG(INFO, "Received suspect header [ver: %d, size: %z], assume disconnection", (int)header[0], length); 507 507 goto error; /* Stop the thread, the recipient of the event will cleanup */ 508 508 } … … 630 630 || (length > DIAMETER_MSG_SIZE_MAX)) { /* to avoid too big mallocs */ 631 631 /* The message is suspect */ 632 TRACE_DEBUG(INFO, "Received suspect header [ver: %d, size: % g], assume disconnection", (int)header[0], length);632 TRACE_DEBUG(INFO, "Received suspect header [ver: %d, size: %z], assume disconnection", (int)header[0], length); 633 633 goto out; 634 634 } … … 895 895 ssize_t ret; 896 896 size_t sent = 0; 897 TRACE_ENTRY("%p %p % g", conn, buf, len);897 TRACE_ENTRY("%p %p %z", conn, buf, len); 898 898 do { 899 899 if (conn->cc_tls) { … … 910 910 int fd_cnx_send(struct cnxctx * conn, unsigned char * buf, size_t len) 911 911 { 912 TRACE_ENTRY("%p %p % g", conn, buf, len);912 TRACE_ENTRY("%p %p %z", conn, buf, len); 913 913 914 914 CHECK_PARAMS(conn && (conn->cc_socket > 0) && buf && len); 915 915 916 TRACE_DEBUG(FULL, "Sending % gb %sdata on connection %s", len, conn->cc_tls ? "TLS-protected ":"", conn->cc_id);916 TRACE_DEBUG(FULL, "Sending %zb %sdata on connection %s", len, conn->cc_tls ? "TLS-protected ":"", conn->cc_id); 917 917 918 918 switch (conn->cc_proto) { -
freeDiameter/p_psm.c
r25 r26 164 164 /* Get next event */ 165 165 CHECK_FCT_DO( fd_event_timedget(peer->p_events, &peer->p_psm_timer, FDEVP_PSM_TIMEOUT, &event, &ev_sz, &ev_data), goto psm_end ); 166 TRACE_DEBUG(FULL, "'%s'\t<-- '%s'\t(%p,% g)\t'%s'",166 TRACE_DEBUG(FULL, "'%s'\t<-- '%s'\t(%p,%z)\t'%s'", 167 167 STATE_STR(peer->p_hdr.info.pi_state), 168 168 fd_pev_str(event), ev_data, ev_sz, -
freeDiameter/sctp.c
r25 r26 764 764 if (sz != sizeof(status)) 765 765 { 766 TRACE_DEBUG(INFO, "Invalid size of socket option: %d / % g", sz, sizeof(status));766 TRACE_DEBUG(INFO, "Invalid size of socket option: %d / %z", sz, sizeof(status)); 767 767 return ENOTSUP; 768 768 } … … 911 911 ssize_t ret; 912 912 913 TRACE_ENTRY("%d %hu %p % g", sock, strid, buf, len);913 TRACE_ENTRY("%d %hu %p %z", sock, strid, buf, len); 914 914 915 915 memset(&mhdr, 0, sizeof(mhdr)); -
freeDiameter/sctps.c
r25 r26 136 136 struct sctps_ctx * ctx = (struct sctps_ctx *) tr; 137 137 138 TRACE_ENTRY("%p %p % g", tr, data, len);138 TRACE_ENTRY("%p %p %z", tr, data, len); 139 139 CHECK_PARAMS_DO( tr && data, { errno = EINVAL; return -1; } ); 140 140 … … 151 151 int emptied; 152 152 153 TRACE_ENTRY("%p %p % g", tr, buf, len);153 TRACE_ENTRY("%p %p %z", tr, buf, len); 154 154 CHECK_PARAMS_DO( tr && buf, { errno = EINVAL; return -1; } ); 155 155 -
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.