MCPcopy Create free account
hub / github.com/SIPp/sipp / getCommonAttributes

Method getCommonAttributes

src/scenario.cpp:1854–1909  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1852}
1853
1854void scenario::getCommonAttributes(message *message)
1855{
1856 const char *ptr;
1857
1858 getBookKeeping(message);
1859 getActionForThisMessage(message);
1860
1861 if ((ptr = xp_get_value("lost"))) {
1862 message -> lost = get_double(ptr, "lost percentage");
1863 lose_packets = 1;
1864 }
1865
1866 if ((ptr = xp_get_value("crlf"))) {
1867 message -> crlf = 1;
1868 }
1869
1870 if ((ptr = xp_get_value("ignoresdp"))) {
1871 message->ignoresdp = get_bool(ptr, "ignoresdp");
1872 }
1873
1874 if (xp_get_value("hiderest")) {
1875 hidedefault = xp_get_bool("hiderest", "hiderest");
1876 }
1877 message -> hide = xp_get_bool("hide", "hide", hidedefault);
1878 if((ptr = xp_get_value((char *)"display"))) {
1879 message -> display_str = strdup(ptr);
1880 }
1881
1882 message -> condexec = xp_get_var("condexec", "condexec variable", -1);
1883 message -> condexec_inverse = xp_get_bool("condexec_inverse", "condexec_inverse", false);
1884
1885 if ((ptr = xp_get_value("next"))) {
1886 if (found_timewait) {
1887 ERROR("next labels are not allowed in <timewait> elements.");
1888 }
1889 message->nextLabel = strdup(ptr);
1890 message->test = xp_get_var("test", "test variable", -1);
1891 if ( 0 != ( ptr = xp_get_value((char *)"chance") ) ) {
1892 float chance = get_double(ptr,"chance");
1893 /* probability of branch to next */
1894 if (( chance < 0.0 ) || (chance > 1.0 )) {
1895 ERROR("Chance %s not in range [0..1]", ptr);
1896 }
1897 message -> chance = (int)((1.0-chance)*RAND_MAX);
1898 } else {
1899 message -> chance = 0; /* always */
1900 }
1901 }
1902
1903 if ((ptr = xp_get_value((char *)"ontimeout"))) {
1904 if (found_timewait) {
1905 ERROR("ontimeout labels are not allowed in <timewait> elements.");
1906 }
1907 message -> onTimeoutLabel = strdup(ptr);
1908 }
1909}
1910
1911int createStringTable(const char* inputString, char*** stringList, int* sizeOfList)

Callers

nothing calls this directly

Calls 5

xp_get_valueFunction · 0.85
get_doubleFunction · 0.85
get_boolFunction · 0.85
xp_get_boolFunction · 0.85
ERRORFunction · 0.85

Tested by

no test coverage detected