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

Function get_algo

modules/compression/compression.c:1641–1680  ·  view source on GitHub ↗

* */

Source from the content-addressed store, hash-verified

1639 *
1640 */
1641static int get_algo(str* tok)
1642{
1643 #define GZIP 0x70697a67
1644 #define DEFL 0x6C666564
1645 #define ATE 0x00657461
1646 #define BASE 0x65736162
1647 #define B64 0x00003436 /* actually only 64 */
1648 #define FIRST_THREE(_str_) (_str_ & 0xFFFFFF)
1649 #define FIRST_TWO(_str_) (_str_ & 0xFFFF)
1650
1651 switch (DWORD(tok->s)) {
1652 case DEFL:
1653 break;
1654 case GZIP:
1655 return 1;
1656 case BASE:
1657 goto check_b64;
1658 default:
1659 return -1;
1660 }
1661
1662 if (FIRST_THREE(DWORD(tok->s+4)) == ATE)
1663 return 0;
1664
1665 return -1;
1666
1667check_b64:
1668 if (FIRST_TWO(DWORD(tok->s+4)) == B64)
1669 return 2;
1670
1671 return -1;
1672
1673 #undef GZIP
1674 #undef DEFL
1675 #undef ATE
1676 #undef BASE
1677 #undef B64
1678 #undef FIRST_TWO
1679 #undef FIRST_THREE
1680}
1681
1682
1683/*

Callers 1

parse_algo_hdrFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected