Changeset 1382:f62e18dc4800 in freeDiameter for extensions/test_ccload
- Timestamp:
- Jul 6, 2019, 1:31:50 AM (5 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/test_ccload/test_ccload.c
r1381 r1382 32 32 /* This extension waits for a signal (SIGUSR2). When it gets it, it 33 33 * generates messages as quickly as possible to the configured target 34 * host; a second SIGUSR2 signal will stop this */ 34 * host; a second SIGUSR2 signal will stop this. 35 * If the target host starts with "REALM:", send to that Destination-Realm instead 36 * of a particular host. */ 35 37 36 38 #include <freeDiameter/extension.h> … … 197 199 } 198 200 199 /* Destination-Host */ 200 fd_msg_avp_new(dh_avp_do, 0, &avp); 201 memset(&val, 0, sizeof(val)); 202 val.os.data = (uint8_t *)target; 203 val.os.len = strlen(target); 204 if (fd_msg_avp_setvalue(avp, &val) != 0) { 205 fd_msg_free(msg); 206 fd_log_error("can't set value for 'Destination-Host' for 'Credit-Control-Request' message"); 207 return NULL; 208 } 209 fd_msg_avp_add(msg, MSG_BRW_LAST_CHILD, avp); 210 211 if ((realm = strchr(target, '.')) == NULL) { 212 fd_msg_free(msg); 213 fd_log_error("can't extract realm from host '%s'", target); 214 return NULL; 215 } 216 /* skip dot */ 217 realm++; 201 if (strncmp("REALM:", target, 6) != 0) { 202 /* Destination-Host */ 203 fd_msg_avp_new(dh_avp_do, 0, &avp); 204 memset(&val, 0, sizeof(val)); 205 val.os.data = (uint8_t *)target; 206 val.os.len = strlen(target); 207 if (fd_msg_avp_setvalue(avp, &val) != 0) { 208 fd_msg_free(msg); 209 fd_log_error("can't set value for 'Destination-Host' for 'Credit-Control-Request' message"); 210 return NULL; 211 } 212 fd_msg_avp_add(msg, MSG_BRW_LAST_CHILD, avp); 213 214 if ((realm = strchr(target, '.')) == NULL) { 215 fd_msg_free(msg); 216 fd_log_error("can't extract realm from host '%s'", target); 217 return NULL; 218 } 219 /* skip dot */ 220 realm++; 221 } else { 222 realm = target + 6; /* skip "REALM:" */ 223 } 218 224 /* Destination-Realm */ 219 225 fd_msg_avp_new(dr_avp_do, 0, &avp);
Note: See TracChangeset
for help on using the changeset viewer.