! \brief * Parse the whole message and bodies of all header fields * that will be needed by registrar */
| 43 | * that will be needed by registrar |
| 44 | */ |
| 45 | int parse_reg_headers(struct sip_msg* _m) |
| 46 | { |
| 47 | struct hdr_field* ptr; |
| 48 | |
| 49 | if (parse_headers(_m, HDR_EOH_F, 0) == -1) { |
| 50 | rerrno = R_PARSE; |
| 51 | LM_ERR("failed to parse headers\n"); |
| 52 | return -1; |
| 53 | } |
| 54 | |
| 55 | if (!_m->to) { |
| 56 | rerrno = R_TO_MISS; |
| 57 | LM_ERR("To not found\n"); |
| 58 | return -2; |
| 59 | } |
| 60 | |
| 61 | if (!_m->callid) { |
| 62 | rerrno = R_CID_MISS; |
| 63 | LM_ERR("Call-ID not found\n"); |
| 64 | return -3; |
| 65 | } |
| 66 | |
| 67 | if (!_m->cseq) { |
| 68 | rerrno = R_CS_MISS; |
| 69 | LM_ERR("CSeq not found\n"); |
| 70 | return -4; |
| 71 | } |
| 72 | |
| 73 | if (_m->expires && !_m->expires->parsed && (parse_expires(_m->expires) < 0)) { |
| 74 | rerrno = R_PARSE_EXP; |
| 75 | LM_ERR("failed to parse expires body\n"); |
| 76 | return -5; |
| 77 | } |
| 78 | |
| 79 | if (_m->contact) { |
| 80 | for (ptr = _m->contact; ptr; ptr = ptr->next) { |
| 81 | if (ptr->type == HDR_CONTACT_T && !ptr->parsed && |
| 82 | parse_contact(ptr) < 0) { |
| 83 | rerrno = R_PARSE_CONT; |
| 84 | LM_ERR("failed to parse Contact body\n"); |
| 85 | return -6; |
| 86 | } |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | return 0; |
| 91 | } |
| 92 | |
| 93 | |
| 94 | /*! \brief |
no test coverage detected