Last active
August 6, 2019 17:24
-
-
Save rpothier/e297d913fd1a664f179a7bfeada80052 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
lib = 'ssl' | |
libsize = 3 | |
if len(sys.argv) > 1: | |
lib = sys.argv[1] | |
libsize = len(sys.argv[1]) | |
print '/* OpenSSL error counters from {}err.h */'.format(lib) | |
filename = lib + "err.h" | |
f = open(filename, "r") | |
for x in f: | |
y = x.split() | |
if len(y) > 3: | |
rc = y[2][:libsize+3] | |
if rc == lib.upper() + "_R_": | |
str = y[2][libsize+3:32] | |
str = lib.upper() + '_' + str +',' | |
print 'COUNTER_ID(SSLERR, {:<32}"SSL error {}{}")'.format(str,y[2][:4],y[2][6:]) | |
f.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
lib = 'ssl' | |
libsize = 3 | |
if len(sys.argv) > 1: | |
lib = sys.argv[1] | |
libsize = len(sys.argv[1]) | |
print '/*' | |
print ' * ssl_count_error_lib_{}:MP_SAFE'.format(lib) | |
print ' */' | |
print 'void ssl_count_error_lib_{}(int reason)'.format(lib) | |
print '{' | |
print ' switch (reason)' | |
print ' {' | |
filename = lib + "err.h" | |
f = open(filename, "r") | |
for x in f: | |
y = x.split() | |
if len(y) > 3: | |
rc = y[2][:libsize+3] | |
if rc == lib.upper() + "_R_": | |
str = y[2][libsize+3:32] | |
if lib != 'ssl': | |
str = lib.upper() + '_' + str | |
#str += ',' | |
print ' case {}:'.format(y[2]) | |
print ' inc_counter(CNT_SSLERR_{});'.format(str) | |
print ' return;' | |
#print 'COUNTER_ID(SSLERR, {:<32}"SSL error {}")'.format(str,y[2]) | |
print ' default:' | |
print ' inc_counter(CNT_SSLERR_LIB_{});'.format(lib.upper()) | |
print ' return;' | |
print ' }' | |
print '}' | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment