* Parse contact header field body */
| 70 | * Parse contact header field body |
| 71 | */ |
| 72 | int parse_contact(struct hdr_field* _h) |
| 73 | { |
| 74 | contact_body_t* b; |
| 75 | |
| 76 | if (_h->parsed != 0) { |
| 77 | return 0; /* Already parsed */ |
| 78 | } |
| 79 | |
| 80 | b = (contact_body_t*)pkg_malloc(sizeof(contact_body_t)); |
| 81 | if (b == 0) { |
| 82 | LM_ERR("no pkg memory left\n"); |
| 83 | return -1; |
| 84 | } |
| 85 | |
| 86 | memset(b, 0, sizeof(contact_body_t)); |
| 87 | |
| 88 | if (contact_parser(_h->body.s, _h->body.len, b) < 0) { |
| 89 | LM_ERR("failed to parse contact\n"); |
| 90 | pkg_free(b); |
| 91 | set_err_info(OSER_EC_PARSER, OSER_EL_MEDIUM, |
| 92 | "error parsing CONTACT headers"); |
| 93 | set_err_reply(400, "bad headers"); |
| 94 | return -2; |
| 95 | } |
| 96 | |
| 97 | _h->parsed = (void*)b; |
| 98 | return 0; |
| 99 | } |
| 100 | |
| 101 | |
| 102 | /* |
no test coverage detected