MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / parse_extra_avps

Function parse_extra_avps

modules/aaa_diameter/app_opensips/avps.c:1037–1118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1035
1036
1037int parse_extra_avps(const char *extra_avps_file)
1038{
1039 FILE *fp;
1040 char *line = NULL;
1041 size_t len = 0;
1042 ssize_t read;
1043 int answers_needed = 0, rc, ret = 0;
1044
1045 if (!extra_avps_file)
1046 return 0;
1047
1048 fp = fopen(extra_avps_file, "r");
1049 if (!fp)
1050 return -1;
1051
1052 while ((read = getline(&line, &len, fp)) != -1) {
1053 char *p = line;
1054
1055 while (isspace(*p))
1056 p++;
1057
1058 // comment or empty line
1059 if (*p == '#' || p - line >= read)
1060 continue;
1061
1062 rc = parse_app_vendor(p, fp);
1063 if (rc < 0) {
1064 ret = -1;
1065 goto out;
1066 } else if (rc == 0) {
1067 continue;
1068 }
1069
1070 rc = parse_attr_def(p, fp);
1071 if (rc < 0) {
1072 ret = -1;
1073 goto out;
1074 } else if (rc == 0) {
1075 continue;
1076 }
1077
1078 rc = parse_app_def(p, fp);
1079 if (rc < 0) {
1080 ret = -1;
1081 goto out;
1082 } else if (rc == 0) {
1083 continue;
1084 }
1085
1086 rc = parse_command_def(p, fp, CMD_REQUEST);
1087 if (rc < 0) {
1088 ret = -1;
1089 goto out;
1090 } else if (rc == 0) {
1091 answers_needed++;
1092 continue;
1093 }
1094

Callers 3

dm_peer_loopFunction · 0.85
dm_init_protFunction · 0.85
os_entryFunction · 0.85

Calls 4

parse_app_vendorFunction · 0.85
parse_attr_defFunction · 0.85
parse_app_defFunction · 0.85
parse_command_defFunction · 0.85

Tested by

no test coverage detected