├── 1.0 ├── Makefile ├── README.md ├── api_server-1.0.5 │ ├── README.config.yaml │ ├── README.servers.yaml │ ├── api_server_package.tar.gz │ ├── config.yaml │ ├── config.yaml.rpmnew │ ├── controllers │ │ └── src │ │ │ ├── Makefile │ │ │ ├── __init__.py │ │ │ ├── alerts.py │ │ │ ├── api_server.py │ │ │ ├── application-notused.py │ │ │ ├── cache_query.py │ │ │ ├── command_handler.py │ │ │ ├── config.py │ │ │ ├── config_functions.py │ │ │ ├── edge_simulator.py │ │ │ ├── geo.py │ │ │ ├── ip.py │ │ │ ├── load_feedback.py │ │ │ ├── log.py │ │ │ ├── ping.py │ │ │ ├── routing.py │ │ │ ├── routing_algorithms.py │ │ │ ├── server_availability.py │ │ │ ├── snmp_servers.py │ │ │ ├── tcs_handler.py │ │ │ ├── token_auth.py │ │ │ ├── update_servers.py │ │ │ ├── util_functions.py │ │ │ ├── version.py │ │ │ ├── ws_config.py │ │ │ └── ws_servers.py │ ├── scripts │ │ └── etc │ │ │ ├── init.d │ │ │ └── supervisord │ │ │ ├── nginx.conf │ │ │ ├── supervisord-request_routers.conf │ │ │ ├── supervisord-single.conf │ │ │ └── supervisord.conf │ ├── servers.yaml │ ├── servers.yaml.rpmnew │ ├── supervisord.conf │ ├── supervisord.conf.rpmnew │ └── testing │ │ ├── __init__.py │ │ ├── loadtest.py │ │ └── results.csv ├── centos7-scripts │ └── SCRIPTS │ │ ├── gen_accts.sh │ │ ├── install_jenkins.sh │ │ ├── install_tcs_yums.sh │ │ ├── install_tcsdev_yums.sh │ │ └── open_ports.sh ├── documentation │ ├── Laguna 1.0 Developer Guide.pdf │ └── Laguna 1.0 User Guide.pdf ├── images │ └── tcs_control_plane.png ├── scripts │ ├── cachequery │ │ ├── cache_query.py │ │ ├── kill_cache_query.sh │ │ ├── nginx.conf │ │ └── strtnginx.sh │ ├── rpm │ │ └── transparent_caching_1.0.0 │ │ │ ├── etc │ │ │ ├── cron.daily │ │ │ │ ├── cleanupSimulationLogs.sh │ │ │ │ └── cleanupYamls.sh │ │ │ ├── init.d │ │ │ │ ├── gwdisc │ │ │ │ └── transc │ │ │ ├── sysconfig │ │ │ │ └── transparent_caching │ │ │ │ │ ├── README.config.yaml │ │ │ │ │ ├── config.yaml │ │ │ │ │ ├── dfltsys.yaml │ │ │ │ │ ├── mhue.conf.tcs │ │ │ │ │ └── trlog.conf │ │ │ └── systemd │ │ │ │ ├── gwdisc.service │ │ │ │ └── transc.service │ │ │ ├── transparent_caching.spec │ │ │ └── usr │ │ │ └── local │ │ │ └── bin │ │ │ └── transparent_caching │ │ │ └── gwdisc.py │ ├── serveraccesspolicy │ │ ├── clientaccesspolicy.xml │ │ └── crossdomain.xml │ └── siege │ │ ├── throughput.sh │ │ ├── transcperftest.sh │ │ └── urls.txt ├── src │ ├── Doxyfile │ ├── Makefile │ ├── misc │ │ ├── Makefile │ │ ├── evlog.c │ │ ├── evlog.h │ │ ├── helper.h │ │ ├── http_parser.c │ │ ├── http_parser.h │ │ ├── lkfq.c │ │ ├── lkfq.h │ │ ├── msem.c │ │ ├── msem.h │ │ ├── mthread.c │ │ ├── mthread.h │ │ ├── tcpfpcap.c │ │ ├── tcpktparse.c │ │ ├── tcpktparse.h │ │ ├── tcregex.c │ │ ├── tcregex.h │ │ ├── tcutil.c │ │ └── tcutil.h │ ├── tcache_agentx │ │ ├── Makefile │ │ ├── conf │ │ │ ├── local.conf │ │ │ ├── snmpd.conf │ │ │ └── tcache_agentx_rsyslog.conf │ │ ├── doc │ │ │ ├── README │ │ │ └── info.txt │ │ ├── main_source │ │ │ ├── Makefile │ │ │ ├── clientRedirectTable.cpp │ │ │ ├── clientRedirectTable.h │ │ │ ├── clientTable.cpp │ │ │ ├── clientTable.h │ │ │ ├── clientTopDeviceTable.cpp │ │ │ ├── clientTopDeviceTable.h │ │ │ ├── domainRedirectTable.cpp │ │ │ ├── domainRedirectTable.h │ │ │ ├── domainTable.cpp │ │ │ ├── domainTable.h │ │ │ ├── edgeProbeDuration.cpp │ │ │ ├── edgeProbeDuration.h │ │ │ ├── maxTableXmit.cpp │ │ │ ├── maxTableXmit.h │ │ │ ├── modeTable.cpp │ │ │ ├── modeTable.h │ │ │ ├── redirectCount.cpp │ │ │ ├── redirectCount.h │ │ │ ├── redirectedServiceTable.cpp │ │ │ ├── redirectedServiceTable.h │ │ │ ├── tablePurgeDuration.cpp │ │ │ ├── tablePurgeDuration.h │ │ │ ├── tcPlaneStartTime.cpp │ │ │ ├── tcPlaneStartTime.h │ │ │ ├── tcPlaneStatus.cpp │ │ │ ├── tcPlaneStatus.h │ │ │ ├── tcPlaneVersion.cpp │ │ │ ├── tcPlaneVersion.h │ │ │ ├── tcache_agentx.cpp │ │ │ ├── tcache_agentx.h │ │ │ ├── trafficCount.cpp │ │ │ ├── trafficCount.h │ │ │ ├── videoRedirectTable.cpp │ │ │ ├── videoRedirectTable.h │ │ │ ├── videoTable.cpp │ │ │ └── videoTable.h │ │ ├── mib │ │ │ └── TCACHE-MIB.txt │ │ ├── rc.d │ │ │ └── tcache_agentx │ │ ├── snmp-scripts │ │ │ ├── clientRedirectTable.sh │ │ │ ├── clientTable.sh │ │ │ ├── clientTopDevice.sh │ │ │ ├── domainRedirectTable.sh │ │ │ ├── domainTable.sh │ │ │ ├── get_edgeProbeDuration.sh │ │ │ ├── get_maxTableXmit.sh │ │ │ ├── get_tablePurgeDuration.sh │ │ │ ├── modeTable.sh │ │ │ ├── redirectCount.sh │ │ │ ├── redirectedServiceTable.sh │ │ │ ├── set_edgeProbeDuration.sh │ │ │ ├── set_maxTableXmit.sh │ │ │ ├── set_tablePurgeDuration.sh │ │ │ ├── tcs_mode.sh │ │ │ ├── tcs_starttime.sh │ │ │ ├── tcs_version.sh │ │ │ ├── trafficCount.sh │ │ │ ├── transcStatus.sh │ │ │ ├── videoRedirectTable.sh │ │ │ └── videoTable.sh │ │ ├── systemd │ │ │ └── tcache_agentx.service │ │ ├── tcplane_simulator │ │ │ ├── Makefile │ │ │ ├── dummy_code.c │ │ │ ├── dummy_code.h │ │ │ ├── edge_status.c │ │ │ ├── edge_status.h │ │ │ ├── tcbkgrnd.h │ │ │ ├── tcgendefn.h │ │ │ ├── tcplane_simulator.c │ │ │ ├── tcplane_snmp.cpp │ │ │ ├── tcplane_snmp.h │ │ │ ├── tcplane_snmp_ccur.cpp │ │ │ ├── tcplane_snmp_mutex.c │ │ │ └── tcplane_snmp_mutex.h │ │ └── util_source │ │ │ ├── Makefile │ │ │ ├── io_rtns.cpp │ │ │ ├── io_rtns.h │ │ │ ├── tcp_rtns.cpp │ │ │ └── tcp_rtns.h │ ├── tcmain │ │ ├── Makefile │ │ ├── transc.c │ │ └── trlog.conf │ └── transc │ │ ├── Makefile │ │ ├── bkgrnd │ │ ├── bkgrnd.h │ │ ├── tcbkgrnd.c │ │ └── tcbkgrnd.h │ │ ├── health │ │ ├── cdn_status.c │ │ ├── cdn_status.h │ │ ├── health.h │ │ ├── tchealth.c │ │ └── tchealth.h │ │ ├── httpprc │ │ ├── httpprc.h │ │ ├── tchttpinit.c │ │ ├── tchttpinit.h │ │ ├── tchttpparse.c │ │ ├── tchttpparse.h │ │ ├── tchttpproc.c │ │ ├── tchttpproc.h │ │ ├── tctcpstrm.c │ │ └── tctcpstrm.h │ │ ├── ipblacklist │ │ ├── Makefile.cpp │ │ ├── ipblacklist.cpp │ │ └── ipblacklist.h │ │ ├── mib │ │ ├── Makefile.cpp │ │ ├── mib.h │ │ ├── tcplane_snmp.cpp │ │ ├── tcplane_snmp.h │ │ ├── tcplanesnmp.c │ │ └── tcplanesnmp.h │ │ ├── pktgen │ │ ├── pktgen.h │ │ ├── tcoutintf.c │ │ ├── tcoutintf.h │ │ ├── tcpfrpsend.c │ │ ├── tcpfrpsend.h │ │ ├── tcpktgen.c │ │ ├── tcpktgen.h │ │ ├── tcpktgeninit.c │ │ ├── tcpktgeninit.h │ │ ├── tcpktinj.c │ │ ├── tcpktinj.h │ │ ├── tcpktiotx.c │ │ ├── tcpktiotx.h │ │ ├── tcplpsend.c │ │ └── tcplpsend.h │ │ ├── pktprc │ │ ├── pktprc.h │ │ ├── tcmonintf.c │ │ ├── tcmonintf.h │ │ ├── tcpfrpcap.c │ │ ├── tcpfrpcap.h │ │ ├── tcpktiorx.c │ │ ├── tcpktiorx.h │ │ ├── tcpktprc.c │ │ ├── tcpktprc.h │ │ ├── tcpktprcinit.c │ │ ├── tcpktprcinit.h │ │ ├── tcplpcap.c │ │ └── tcplpcap.h │ │ ├── simprc │ │ ├── simprc.h │ │ ├── tcsim.c │ │ ├── tcsim.h │ │ ├── tcsimsend.c │ │ ├── tcsimsend.h │ │ ├── tcsimutil.c │ │ └── tcsimutil.h │ │ ├── tcconfig.h │ │ ├── tcgendefn.h │ │ ├── tcinit.c │ │ ├── tcinit.h │ │ ├── tcintf.c │ │ ├── tcintf.h │ │ ├── tcldcfg.h │ │ ├── tcload.c │ │ ├── tcloadsys.c │ │ ├── tcmapintf.h │ │ ├── tcmtxmsg.h │ │ ├── tcqmsg.h │ │ ├── tcshared.c │ │ ├── tcshared.h │ │ ├── tctemp.h │ │ ├── tcutils.c │ │ └── tcutils.h ├── tccompiler.mk ├── tcgmake.mk ├── traffic_ops │ ├── LAGUNA.traffic_ops │ └── README └── trafficserver-5-3-2 │ ├── README.md │ ├── etc │ ├── README │ ├── cacheurl.config │ ├── clientaccesspolicy.xml │ ├── crossdomain.xml │ ├── dmotion.regex │ ├── ip_allow.config │ ├── plugin.config │ ├── records.config │ └── remap.config │ └── plugins-ccur │ ├── cache-hndl │ ├── Makefile │ ├── README │ ├── cache-hndl-v1.cc │ ├── cache-hndl-v2.cc │ └── cache-hndl-v3.cc │ ├── include │ └── ccur_remap.h │ └── remap-hndl │ ├── Makefile │ └── remap-hndl.cc ├── LICENSE ├── NOTICE └── README.md /1.0/api_server-1.0.5/README.config.yaml: -------------------------------------------------------------------------------- 1 | # Non-Server information is added or changed here. To add or change Server configurations then look at servers.yaml 2 | 3 | # IMPORTANT - DO NOT leave any string values empty (missing) or set to None. Make sure to put '' so that strings are processed correctly!! 4 | 5 | # KEEP geo: restrict: False! 6 | # debug_ip: ip - This ip should be a well known outside IP for debugging the GeoIP feature. This IP will only come into play if debug: True is set in the config.yaml file. 7 | 8 | debug: # Setting the debug config to True will print out any track back (trace) statements of the call stack to the browser. 9 | False 10 | 11 | port: # The default port should be 80 but can be set here to anything you want. 12 | 8088 13 | 14 | msg_code: # ZeroMQ code that the TCS SNMP AgentX daemon is looking for. This gets send when an update has been made to the config. When the TCS SNMP AgentX daemon receives a connection and then this command, it re-reads the config back in. 15 | - 10 16 | 17 | http_response_codes: # Follows standard http codes but can be modified if a player requires a specific value for existing logic, etc. 18 | found: 200 19 | redirect: 307 20 | forbidden: 403 21 | not_found: 404 22 | general_error: 500 23 | 24 | logging: # Set to false to not log anything except exceptions. 25 | True 26 | 27 | log_file: # Set cron up to rotate the logs... - If the path starts with '../' then it looks for the log directory in the app root. 28 | '../logs/request_router.log' 29 | 30 | errors_log_file: # Set cron up to rotate the logs... - If the path starts with '../' then it looks for the log directory in the app root. 31 | '../logs/request_router_errors.log' 32 | 33 | log_format: # Format for logs. 34 | '%(asctime)s %(name)-12s %(levelname)-8s %(message)s' 35 | 36 | log_date_format: # Format for date within logs. 37 | '%m-%d %H:%M' 38 | 39 | log_utc: # Default is False so it uses local time. 40 | False 41 | 42 | log_when: # Valid values are: 'S' - Seconds, 'M' - Minutes, 'H' - Hours, 'D' - Days, 'W0'-'W6 - Weekday (0=Monday...6=Sunday), 'midnight' - Roll over at midnight 43 | 'midnight' 44 | 45 | log_rotation: # Only applies for 'S', 'M', 'H', 'D' of log_when above. 46 | 24 47 | 48 | log_backups: # Number of file rotations before recycling. 49 | 7 50 | 51 | cookie_expires: # Stubbed out - Not currently used. 52 | hls: 1 53 | hds: 3600 54 | mss: 1 55 | 56 | alert_email: # from_email, to_email and smtp_server must be valid for alert thread to become active. 57 | interval: 10 # Seconds to check for issues. 58 | to_email: 'chris.jones@ccur.com' 59 | from_email: 'chris.jones@ccur.com' 60 | subject: 'API Server Issue' 61 | smtp_server: '' #'mail.ccur.com' # MUST be '' and NOT None or empty if there is no smtp_server value. 62 | 63 | keys: 64 | secret: 'could_be_any_secret_key_value' 65 | 66 | api_ip_allow_range: # IMPORTANT! - All is denied except these 67 | - 129.75.21.0/24 68 | - 129.75.25.0/24 69 | - 10.75.26.0/24 70 | - 10.76.112.0/24 71 | 72 | # IMPORTANT 73 | # PyCurl needs to be installed for the PURGE command to work. CentOS 6.4 version of 'pip install pycurl' looks for 74 | # the gcc compiler in a specific directory where it does not exist (on our dev version). So, the following fixes it: 75 | # 76 | # yum -y update 77 | # yum install -y libcurl-devel 78 | # 79 | # cd /opt 80 | # mkdir -p centos/devtoolset-1.1/root/usr/bin 81 | # cd centos/devtoolset-1.1/root/usr/bin/ 82 | # ln -s /usr/bin/gcc /opt/centos/devtoolset-1.1/root/usr/bin/gcc 83 | # pip install pycurl 84 | 85 | -------------------------------------------------------------------------------- /1.0/api_server-1.0.5/README.servers.yaml: -------------------------------------------------------------------------------- 1 | # Server information is added or changed here. To add or change non-server configurations then look at config.yaml 2 | # ALL routing options also check to see if the server is available (up or down). 3 | 4 | servers: # List of available Transparent Caching Servers 5 | - 10.76.101.10 6 | 7 | server_defaults: # Sets basic defaults for the ZeroMQ port 8 | port: 5555 9 | 10 | server_ports: # Ability to override a port for a specific Transparent Caching Server 11 | 10.76.101.10: 5555 12 | 13 | servers_interface_ip: # C&C (Command and Control) IP 14 | - 10.76.101.10 15 | 16 | server_config: # File name of the config and Path of the config - Config of the Transparent Caching Server 17 | file: 'config.yaml' 18 | path: '/etc/sysconfig/transparent_caching/' 19 | 20 | purge: 21 | verb: PURGE # HTTP verb method to use. 22 | url: /tcspurge/ccur/video/ # URL rewrite for Edge - .../video/ytb/* or .../video/* etc can be used. 23 | targets: # Targets to cycle through on purge. If url signature contains '/video/*' then all in this list are called on the Edge. 24 | - ytb 25 | - nfl 26 | edges: # List of ALL Edges that may receive the PURGE request. 27 | - 10.76.101.31 28 | #- 10.76.101.32 29 | -------------------------------------------------------------------------------- /1.0/api_server-1.0.5/api_server_package.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/concurrentlabs/laguna/d8036889885217881da686eb54bf8419e06d8ce4/1.0/api_server-1.0.5/api_server_package.tar.gz -------------------------------------------------------------------------------- /1.0/api_server-1.0.5/config.yaml: -------------------------------------------------------------------------------- 1 | # DO NOT MODIFY: Machine Generated YAML File! 2 | # ALL values MUST NOT BE EMPTY! If the value needs to be empty then use a 0 for a numeric value or '' for a string. 3 | 4 | debug: 5 | False 6 | 7 | port: 8 | 8088 9 | 10 | msg_code: 11 | - 10 12 | 13 | http_response_codes: 14 | redirect: 302 15 | found: 200 16 | forbidden: 403 17 | not_found: 404 18 | general_error: 500 19 | 20 | logging: 21 | True 22 | 23 | log_file: 24 | '../logs/api_server.log' 25 | 26 | errors_log_file: 27 | '../logs/api_server_errors.log' 28 | 29 | log_format: 30 | '%(asctime)s %(levelname)-8s %(message)s' 31 | 32 | log_date_format: 33 | '%m-%d %H:%M' 34 | 35 | log_utc: 36 | False 37 | 38 | log_when: 39 | 'midnight' 40 | 41 | log_rotation: # 24 42 | 0 43 | 44 | log_backups: 45 | 7 46 | 47 | cookie_expires: 48 | hls: 1 49 | hds: 3600 50 | mss: 1 51 | 52 | alert_email: 53 | from_email: '@ccur.com' 54 | to_email: '@ccur.com' 55 | interval: 10 56 | smtp_server: '' 57 | subject: 'API Server Issue' 58 | 59 | keys: 60 | secret: 'could_be_any_secret_key_value' 61 | 62 | api_ip_allow_range: 63 | - 10.76.101.0/24 64 | - 129.75.21.0/24 65 | - 129.75.25.0/24 66 | - 10.76.162.0/24 67 | 68 | -------------------------------------------------------------------------------- /1.0/api_server-1.0.5/config.yaml.rpmnew: -------------------------------------------------------------------------------- 1 | # DO NOT MODIFY: Machine Generated YAML File! 2 | # ALL values MUST NOT BE EMPTY! If the value needs to be empty then use a 0 for a numeric value or '' for a string. 3 | 4 | debug: 5 | False 6 | 7 | port: 8 | 8088 9 | 10 | msg_code: 11 | - 10 12 | 13 | http_response_codes: 14 | redirect: 302 15 | found: 200 16 | forbidden: 403 17 | not_found: 404 18 | general_error: 500 19 | 20 | logging: 21 | True 22 | 23 | log_file: 24 | '../logs/api_server.log' 25 | 26 | errors_log_file: 27 | '../logs/api_server_errors.log' 28 | 29 | log_format: 30 | '%(asctime)s %(levelname)-8s %(message)s' 31 | 32 | log_date_format: 33 | '%m-%d %H:%M' 34 | 35 | log_utc: 36 | False 37 | 38 | log_when: 39 | 'midnight' 40 | 41 | log_rotation: # 24 42 | 0 43 | 44 | log_backups: 45 | 7 46 | 47 | cookie_expires: 48 | hls: 1 49 | hds: 3600 50 | mss: 1 51 | 52 | alert_email: 53 | from_email: '@ccur.com' 54 | to_email: '@ccur.com' 55 | interval: 10 56 | smtp_server: '' 57 | subject: 'API Server Issue' 58 | 59 | keys: 60 | secret: 'could_be_any_secret_key_value' 61 | 62 | api_ip_allow_range: 63 | - 10.76.101.0/24 64 | - 129.75.21.0/24 65 | - 129.75.25.0/24 66 | - 10.76.162.0/24 67 | 68 | -------------------------------------------------------------------------------- /1.0/api_server-1.0.5/controllers/src/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################### 2 | ################################################################################### 3 | ECHO=echo 4 | 5 | .PHONEY: all clean 6 | 7 | all: 8 | $(ECHO) "building pycs" 9 | python -m compileall . 10 | mv *.pyc .. 11 | chmod 755 ../api_server.pyc 12 | 13 | clean: 14 | $(ECHO) "cleaning pycs" 15 | rm -f ../*.pyc 16 | 17 | run: 18 | $(ECHO) "running api_server" 19 | cd .. && python ./api_server.pyc 20 | -------------------------------------------------------------------------------- /1.0/api_server-1.0.5/controllers/src/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | 4 | 5 | -------------------------------------------------------------------------------- /1.0/api_server-1.0.5/controllers/src/alerts.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | 4 | import threading 5 | import time 6 | import smtplib 7 | from email.mime.multipart import MIMEMultipart 8 | from email.mime.text import MIMEText 9 | import config 10 | from log import log 11 | from update_servers import update_servers 12 | 13 | 14 | class AlertMonitoring(threading.Thread): 15 | """ 16 | Threaded Server Check. This thread checks availability (up or down) of all of the unique servers in the 17 | edge list. 18 | """ 19 | 20 | def __init__(self, interval): 21 | threading.Thread.__init__(self) 22 | self.interval = interval 23 | 24 | def run(self): 25 | while True: 26 | try: 27 | # NOTE: Add the servers to the list 28 | # Add other types of logic (i.e., for single server that is bad, etc) 29 | if len(config.servers_bad) >= config.servers_weighted_count: 30 | msg = MIMEText("All of the Request Router processing servers are not responding!") 31 | msg['From'] = config.alert_email["from_email"] 32 | msg['To'] = config.alert_email["to_email"] 33 | msg['Subject'] = config.alert_email["subject"] 34 | 35 | self.server = smtplib.SMTP(config.alert_email["smtp_server"]) 36 | # self.server.set_debuglevel(1) # Only set debuglevel to see full trace stack! 37 | self.server.sendmail(config.alert_email["from_email"], config.alert_email["to_email"], msg.as_string()) 38 | self.server.quit() 39 | log("Alert email sent to " + config.alert_email["to_email"] + ". ") 40 | except BaseException, e: # try/catch here for clean processing only 41 | log("Unable to email " + str(e)) 42 | 43 | time.sleep(self.interval) -------------------------------------------------------------------------------- /1.0/api_server-1.0.5/controllers/src/api_server.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | import sys 5 | 6 | import tornado.ioloop 7 | import tornado.web 8 | from tornado.options import define, options 9 | 10 | import config 11 | import log 12 | from alerts import AlertMonitoring 13 | from ws_config import WS_ConfigHandler 14 | from ws_servers import WS_ServersHandler 15 | from tcs_handler import TCSHandler 16 | from command_handler import CommandHandler 17 | 18 | # Called here so that the initial portion of the import is ran ONCE - MUST be called AFTER config 19 | from snmp_servers import snmp_servers 20 | 21 | #(r'^/(.*)$', RoutingHandler) 22 | 23 | define('port', default=config.port) 24 | 25 | app_static_path = os.path.join(os.path.dirname(__file__), '../static') 26 | 27 | application = tornado.web.Application([ 28 | (r"/v1/config/(.*)$", WS_ConfigHandler), 29 | (r"/v1/servers/(.*)$", WS_ServersHandler), 30 | (r"/v1/components/configurations/transparentcache/config/(.*)$", TCSHandler), 31 | (r"/v1/components/commands/transparentcache/(.*)$", CommandHandler), 32 | (r"/(crossdomain\.xml)", tornado.web.StaticFileHandler, {'path': app_static_path}), 33 | (r"/(clientaccesspolicy\.xml)", tornado.web.StaticFileHandler, {'path': app_static_path}), 34 | ], debug=config.debug, static_path=app_static_path) #, xsrf_cookies=True) 35 | 36 | if __name__ == '__main__': 37 | # Launch threads here... 38 | 39 | try: 40 | if len(config.alert_email["from_email"]) > 0 and len(config.alert_email["to_email"]) > 0 and len(config.alert_email["smtp_server"]) > 0: 41 | alert_thread = AlertMonitoring(config.alert_email["interval"]) # Interval is in seconds 42 | alert_thread.setDaemon(True) 43 | alert_thread.start() 44 | except BaseException, e: 45 | log.log("Alert thread not running. Some value maybe missing. %s" % e, level="WARNING", log_type="ERROR") 46 | 47 | # Look for --port on the command line and if not there then use config.port 48 | #port = config.port 49 | 50 | #if len(sys.argv) > 1: 51 | # for arg in sys.argv: 52 | # if str(arg).find("--port") >= 0: 53 | # port = int(str(arg).replace("--port=", "")) 54 | 55 | #application.listen(port) 56 | ## 57 | log.log("API Server started") 58 | log.log("API Server started", log_type="ERROR") 59 | ## 60 | try: 61 | tornado.options.parse_command_line() 62 | application.listen(options.port) 63 | tornado.ioloop.IOLoop.instance().start() 64 | except KeyboardInterrupt, e: 65 | log.log("API Server Exception (stopped) - {0}".format(e.message), level="CRITICAL", log_type="ERROR") 66 | 67 | # snmp thread does not need to join back to the main thread since the app is dieing 68 | 69 | ## 70 | log.log("API Server stopped") 71 | log.log("API Server stopped", log_type="ERROR") 72 | ## 73 | -------------------------------------------------------------------------------- /1.0/api_server-1.0.5/controllers/src/application-notused.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | ## -*- coding: utf-8 -*- 3 | import os 4 | from mako import exceptions 5 | from mako.lookup import TemplateLookup 6 | import tornado.ioloop 7 | import tornado.web 8 | from tornado import httpclient 9 | 10 | root = os.path.dirname(__file__) 11 | template_root = os.path.join(root, '../templates') 12 | blacklist_templates = ('layouts',) 13 | template_lookup = TemplateLookup(input_encoding='utf-8', 14 | output_encoding='utf-8', 15 | encoding_errors='replace', 16 | directories=[template_root]) 17 | 18 | def render_template(filename): 19 | if os.path.isdir(os.path.join(template_root, filename)): 20 | filename = os.path.join(filename, 'index_orig.html') 21 | else: 22 | filename = '%s.html' % filename 23 | if any(filename.lstrip('/').startswith(p) for p in blacklist_templates): 24 | raise httpclient.HTTPError(404) 25 | try: 26 | return template_lookup.get_template(filename).render() 27 | except exceptions.TopLevelLookupException: 28 | raise httpclient.HTTPError(404) 29 | 30 | class DefaultHandler(tornado.web.RequestHandler): 31 | def get_error_html(self, status_code, exception, **kwargs): 32 | if hasattr(exception, 'code'): 33 | self.set_status(exception.code) 34 | if exception.code == 500: 35 | return exceptions.html_error_template().render() 36 | return render_template(str(exception.code)) 37 | return exceptions.html_error_template().render() 38 | 39 | class MainHandler(DefaultHandler): 40 | def get(self, urlQuery): 41 | self.set_status(302) 42 | self.set_header("Location","http://localhost:8088/" + urlQuery) 43 | 44 | #self.write(render_template(filename)) 45 | 46 | application = tornado.web.Application([ 47 | (r'^/(.*)$', MainHandler), 48 | ], debug=True, static_path=os.path.join(root, '../static')) 49 | 50 | if __name__ == '__main__': 51 | application.listen(8080) 52 | tornado.ioloop.IOLoop.instance().start() 53 | 54 | -------------------------------------------------------------------------------- /1.0/api_server-1.0.5/controllers/src/cache_query.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import io 4 | import os 5 | import signal 6 | import sys 7 | from subprocess import call 8 | 9 | hit = miss = bypass = expired = 0 10 | 11 | ######################################################################################### 12 | ######################################################################################### 13 | def main(): 14 | try: 15 | s = '/var/log/nginx/cache.log' 16 | istream = io.open(s, 'r') 17 | except IOError: 18 | print 'ERROR: failed to open %s' % s 19 | exit(-1) 20 | 21 | try: 22 | open("/var/run/cache_query.pid","wb").write('%d' % os.getpid()) 23 | except IOError: 24 | print 'ERROR: failed to open %s' % s 25 | exit(-1) 26 | 27 | signal.signal(signal.SIGINT, reset_stats) 28 | 29 | global hit, miss, bypass, expired 30 | 31 | istream.seek(0, 2) 32 | banner() 33 | print_stat_line() 34 | while 1: 35 | for s in istream.readlines(): 36 | l = s.split(' ') 37 | if l[2] == 'HIT': 38 | hit += 1 39 | print_stat_line() 40 | elif l[2] == 'MISS': 41 | miss += 1 42 | print_stat_line() 43 | elif l[2] == 'BYPASS': 44 | bypass += 1 45 | print_stat_line() 46 | elif l[2] == 'EXPIRED': 47 | expired += 1 48 | print_stat_line() 49 | ### ??? ### 50 | # expired = 0 51 | 52 | stream = file('/usr/local/bin/api_server/static/data/cache.json', 'w') 53 | stream.write('{"hit": %d, "miss": %d}' % (hit, miss)) 54 | stream.close() 55 | 56 | exit(0) 57 | 58 | ######################################################################################### 59 | # reset stats 60 | ######################################################################################### 61 | def reset_stats(sig, stack): 62 | # print "reset_stats fired." 63 | global hit, miss, bypass, expired 64 | hit = miss = bypass = expired = 0 65 | banner() 66 | print_stat_line() 67 | return 68 | 69 | ######################################################################################### 70 | ######################################################################################### 71 | def banner(): 72 | call(["clear"]) 73 | print '\n Cache Statistics\n ================\n' 74 | return 75 | 76 | ######################################################################################### 77 | ######################################################################################### 78 | def print_stat_line(): 79 | global hit, miss, bypass, expired 80 | sys.stdout.write(' HIT: %5d MISS: %5d\n' % (hit, miss)) # BYPASS: %5d EXPIRED: %5d\n' 81 | # % (hit, miss, bypass, expired)) 82 | return 83 | 84 | ######################################################################################### 85 | ######################################################################################### 86 | if __name__ == "__main__": 87 | main() 88 | -------------------------------------------------------------------------------- /1.0/api_server-1.0.5/controllers/src/config.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | 4 | from threading import Lock 5 | import Queue 6 | 7 | """ 8 | Read config and server yaml files. 9 | """ 10 | 11 | update_lock = Lock() 12 | 13 | # Line below MUST come after update_lock... 14 | from config_functions import read 15 | 16 | # Config section... 17 | # IMPORTANT - config.yaml should be ../config.yaml and servers.yaml should be ../servers.yaml on Red Hat! 18 | debug = "" 19 | debug_ip = "" # NOTE: This flag should ONLY come into play if debug: False in the config.yaml file! It is only for GeoIP QA testing. 20 | port = "" 21 | http_response_codes = {} 22 | logging = "" 23 | log_file = "" 24 | errors_log_file = "" 25 | log_format = "" 26 | log_date_format = "" 27 | log_when = "" 28 | log_utc = "" 29 | log_rotation = "" 30 | log_backups = "" 31 | cookie_expires = {} 32 | alert_email = {} 33 | 34 | api_ip_allow_range = [] 35 | 36 | keys = {} 37 | 38 | #Server section... 39 | 40 | servers_with_weights = {} 41 | servers = [] 42 | servers_weighted = [] 43 | 44 | server_count = 0 45 | servers_weighted_count = 0 46 | 47 | server_defaults = {} 48 | server_default_port = ":80" 49 | 50 | server_ports = {} 51 | 52 | servers_interface_ip = [] 53 | 54 | servers_server_config = {} 55 | 56 | servers_purge = {} 57 | 58 | # Start the threading queues... 59 | server_queue = Queue.Queue() 60 | 61 | # End global variable section for config 62 | 63 | # Set the above variables via the read function from config_functions.py 64 | read() 65 | -------------------------------------------------------------------------------- /1.0/api_server-1.0.5/controllers/src/config_functions.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | 4 | import os 5 | import yaml 6 | 7 | # This import statment MUST come after the lock 8 | 9 | BASE_DIR = os.path.join(os.path.dirname(__file__), '..') 10 | 11 | 12 | def read(): 13 | import config 14 | 15 | config_stream = file('%s/config.yaml' % BASE_DIR, 'r') 16 | server_conf_stream = file('%s/servers.yaml' % BASE_DIR, 'r') 17 | try: 18 | # Config section... 19 | # IMPORTANT - config.yaml should be ../config.yaml and servers.yaml should be ../servers.yaml on Red Hat! 20 | configs = yaml.load(config_stream) 21 | config.debug = configs["debug"] 22 | config.port = configs["port"] 23 | config.http_response_codes = {} 24 | config.http_response_codes = configs["http_response_codes"] 25 | config.logging = configs["logging"] 26 | config.log_file = configs["log_file"] 27 | config.errors_log_file = configs["errors_log_file"] 28 | config.log_format = configs["log_format"] 29 | config.log_date_format = configs["log_date_format"] 30 | config.log_when = configs["log_when"] 31 | config.log_utc = configs["log_utc"] 32 | config.log_rotation = configs["log_rotation"] 33 | config.log_backups = configs["log_backups"] 34 | config.cookie_expires = {} 35 | config.cookie_expires = configs["cookie_expires"] 36 | config.alert_email = {} 37 | config.alert_email = configs["alert_email"] 38 | 39 | config.api_ip_allow_range = [] 40 | config.api_ip_allow_range = configs["api_ip_allow_range"] 41 | 42 | config.keys = {} 43 | config.keys = configs["keys"] 44 | 45 | config.msg_code = {} 46 | config.msg_code = configs["msg_code"] 47 | 48 | #Server section... 49 | server_conf = yaml.load(server_conf_stream) 50 | 51 | config.server_defaults = {} 52 | config.server_defaults = server_conf["server_defaults"] 53 | config.server_default_port = ":" + str(config.server_defaults["port"]) # Must be present in the servers.yaml file. 54 | if config.server_default_port == ":80" or config.server_default_port == ":": 55 | config.server_default_port = "" # Set it to empty since it's not needed for browsers/players. 56 | 57 | config.server_ports = {} 58 | config.server_ports = server_conf["server_ports"] # 0MQ port - default to 5555 59 | 60 | config.servers_ip = [] 61 | config.servers_ip = server_conf["servers"] 62 | 63 | config.servers_interface_ip = [] 64 | config.servers_interface_ip = server_conf["servers_interface_ip"] 65 | 66 | config.servers_server_config = {} 67 | config.servers_server_config = server_conf["server_config"] 68 | 69 | config.servers_purge = {} 70 | config.servers_purge = server_conf["purge"] 71 | 72 | except yaml.YAMLError, e: 73 | from log import log 74 | log("Config Error - %s" % e, "CRITICAL") 75 | finally: 76 | config_stream.close() 77 | server_conf_stream.close() 78 | 79 | -------------------------------------------------------------------------------- /1.0/api_server-1.0.5/controllers/src/edge_simulator.py: -------------------------------------------------------------------------------- 1 | import tornado.ioloop 2 | import tornado.web 3 | 4 | 5 | class MainHandler(tornado.web.RequestHandler): 6 | 7 | def initialize(self): 8 | self.SUPPORTED_METHODS = ("GET", "POST", "PURGE") 9 | 10 | 11 | def get(self): 12 | self.write("Hello, world") 13 | 14 | 15 | def post(self): 16 | print ("processing body: %s" % self.request.body) 17 | self.write("Hello, universe") 18 | 19 | 20 | def purge(self): 21 | print ("processing purge hdr: %s" % self.request.headers) 22 | print ("processing purge body: %s" % self.request.body) 23 | self.set_status(200) 24 | self.write("Hello, milky way") 25 | self.finish() 26 | 27 | 28 | application = tornado.web.Application([ 29 | (r"/", MainHandler), 30 | (r"/tcspurge/ccur/(.*)$", MainHandler), 31 | (r"/v1/components/commands/transparentcache/(.*)$", MainHandler) 32 | ]) 33 | 34 | 35 | if __name__ == "__main__": 36 | application.listen(80) 37 | tornado.ioloop.IOLoop.instance().start() 38 | -------------------------------------------------------------------------------- /1.0/api_server-1.0.5/controllers/src/geo.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | 4 | import config 5 | 6 | 7 | def geo_restrict(ip): 8 | passed = False 9 | 10 | if config.geoip is not None and config.geo_country_codes_count > 0: 11 | country = config.geoip.country_code_by_addr(ip) 12 | for code in config.geo_country_codes: 13 | if country == code: 14 | passed = True 15 | break 16 | else: 17 | passed = True # This forces the same as not having geo restriction 18 | 19 | return passed 20 | 21 | -------------------------------------------------------------------------------- /1.0/api_server-1.0.5/controllers/src/ip.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | 4 | from netaddr import IPNetwork, IPAddress 5 | import config 6 | 7 | 8 | def ip_restrict(ip, api=False): 9 | passed = False 10 | 11 | # TODO: Put into IPSet and do range search and denys 12 | 13 | if IPAddress(ip).is_loopback(): 14 | return True # Loopback means it's running locally so all is good. 15 | 16 | if api: 17 | for net in config.api_ip_allow_range: 18 | if str(net).find("-") >= 0: 19 | continue # TODO: Use another method of check but for now just continue... 20 | 21 | if IPAddress(ip) in IPNetwork(net): 22 | passed = True 23 | break 24 | 25 | return passed -------------------------------------------------------------------------------- /1.0/api_server-1.0.5/controllers/src/load_feedback.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | 4 | import threading 5 | import datetime 6 | import config 7 | import log 8 | import snmp_servers 9 | 10 | 11 | class LoadFeedback(threading.Thread): 12 | def run(self): 13 | 14 | while True: # May need to change to a variable later so that it can be controlled a little easier... 15 | now = datetime.datetime.now() 16 | 17 | if config.logging and config.debug: 18 | log.log("Thread - LoadFeedback\t" ) 19 | 20 | 21 | -------------------------------------------------------------------------------- /1.0/api_server-1.0.5/controllers/src/log.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | 4 | """ 5 | Logging is implemented here so that the logging api is encapsulated so that we can change the 6 | internal function later to ZeroMQ with a central logging server or cluster. Hadoop could also be used. 7 | 8 | The default LEVEL is INFO for the log(...) function. 9 | """ 10 | 11 | import logging 12 | import logging.handlers 13 | import os 14 | 15 | import config 16 | 17 | # One time initialization... 18 | logger = logging.getLogger('api_server') 19 | logger_error = logging.getLogger('api_server_errors') 20 | 21 | # If '../' begins then get the current directory 22 | if config is not None: 23 | if config.log_file.startswith("../"): 24 | location = os.path.dirname(__file__) + '/' 25 | location += config.log_file 26 | else: 27 | location = config.log_file 28 | 29 | if config.errors_log_file.startswith("../"): 30 | location_error = os.path.dirname(__file__) + '/' 31 | location_error += config.errors_log_file 32 | else: 33 | location_error = config.errors_log_file 34 | 35 | formatter = logging.Formatter(config.log_format) 36 | rotation = config.log_rotation 37 | backups = config.log_backups 38 | when = config.log_when 39 | utc = config.log_utc 40 | else: 41 | utc = False 42 | when = 'midnight' 43 | rotation = 24 44 | backups = 7 45 | formatter = '%(asctime)s %(name)-12s %(levelname)-8s %(message)s' 46 | location = os.path.dirname(__file__) + '/../logs/api_server.log' # This will force config errors to write to this log file at all times. 47 | location_error = os.path.dirname(__file__) + '/../logs/api_server_errors.log' # This will force config errors to write to this log file at all times. 48 | 49 | # NOTE: TimedRotatingFileHandler can be removed with FileHandler so that the cron can do log rotation. 50 | # Add the log message handler to the logger 51 | if rotation != 0: 52 | file_handler = logging.handlers.TimedRotatingFileHandler(location, when=when, interval=rotation, backupCount=backups, utc=utc) 53 | file_handler_error = logging.handlers.TimedRotatingFileHandler(location_error, when=when, interval=rotation, backupCount=backups, utc=utc) 54 | else: 55 | file_handler = logging.FileHandler(location) 56 | file_handler_error = logging.FileHandler(location) 57 | 58 | file_handler.setFormatter(formatter) 59 | logger.addHandler(file_handler) 60 | logger.setLevel(logging.INFO) 61 | 62 | file_handler_error.setFormatter(formatter) 63 | logger_error.addHandler(file_handler_error) 64 | logger_error.setLevel(logging.ERROR) 65 | 66 | 67 | def log(message, level="INFO", log_type="ACCESS"): 68 | lvl = level.upper() 69 | 70 | if lvl == "INFO": 71 | if log_type == "ACCESS": 72 | logger.info(message) 73 | else: 74 | logger_error.info(message) 75 | elif lvl == "WARNING": 76 | if log_type == "ACCESS": 77 | logger.warning(message) 78 | else: 79 | logger_error.warning(message) 80 | elif lvl == "CRITICAL": 81 | if log_type == "ACCESS": 82 | logger.critical(message) 83 | else: 84 | logger_error.critical(message) 85 | elif lvl == "DEBUG": 86 | if log_type == "ACCESS": 87 | logger.debug(message) 88 | else: 89 | logger_error.debug(message) 90 | elif lvl == "ERROR": 91 | if log_type == "ACCESS": 92 | logger.error(message) 93 | else: 94 | logger_error.error(message) 95 | -------------------------------------------------------------------------------- /1.0/api_server-1.0.5/controllers/src/routing_algorithms.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | 4 | import random 5 | from itertools import cycle, islice 6 | import tornado.web 7 | import config 8 | from update_servers import check_bad_servers 9 | 10 | """ 11 | Each algorithm cycles the processing loop based on the number weighted edges - 1 before throwing an error. 12 | """ 13 | 14 | def rand(max_count): 15 | if max_count < 1: 16 | raise tornado.web.HTTPError(404) 17 | else: 18 | retries = max_count - 1 19 | passed = False 20 | index = 0 21 | 22 | while retries >= 0: 23 | if max_count == 1: 24 | index = 0 25 | else: 26 | index = random.randrange(0, max_count) 27 | 28 | # Check to see if index is in the edge_bad list 29 | passed = check_bad_servers(index) 30 | 31 | retries -= 1 32 | 33 | if passed: 34 | return index 35 | else: 36 | raise tornado.web.HTTPError(404) 37 | 38 | 39 | def round_robin(): 40 | retries = config.servers_weighted_count - 1 41 | passed = False 42 | index = 0 43 | 44 | while retries >= 0: 45 | try: 46 | index = int(config.server_list.next()) 47 | except StopIteration: 48 | config.server_list = rnd_robin(config.server_index) 49 | index = int(config.server_list.next()) 50 | 51 | # Check to see if index is in the edge_bad list 52 | # NOTE: Commented out below for performance test... 53 | passed = check_bad_servers(index) 54 | 55 | if passed: 56 | return index 57 | 58 | retries -= 1 59 | 60 | if passed: # passed would have already returned before but left here from earlier version - final sanity check. 61 | return index 62 | else: 63 | raise tornado.web.HTTPError(404) 64 | 65 | 66 | def rnd_robin(*iterables): 67 | pending = len(iterables) 68 | nexts = cycle(iter(iterable).next for iterable in iterables) 69 | while pending: 70 | try: 71 | for next in nexts: 72 | yield next() 73 | except StopIteration: 74 | pending -= 1 75 | nexts = cycle(islice(nexts, pending)) 76 | 77 | 78 | """ 79 | from itertools import chain, izip_longest 80 | 81 | def roundrobin(*iterables): 82 | sentinel = object() 83 | return (x for x in chain(*izip_longest(fillvalue=sentinel, *iterables)) if x is not sentinel) 84 | 85 | """ -------------------------------------------------------------------------------- /1.0/api_server-1.0.5/controllers/src/server_availability.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | 4 | import threading 5 | import Queue 6 | import time 7 | from pysnmp.entity.rfc3413.oneliner import cmdgen 8 | from log import log 9 | from update_servers import update_servers 10 | import config 11 | 12 | 13 | class ServerAvailability(threading.Thread): 14 | """ 15 | Threaded Server Check. This thread checks availability (up or down) of all of the unique servers in the 16 | edge list. 17 | """ 18 | 19 | def __init__(self, timeout, retries, interval): 20 | threading.Thread.__init__(self) 21 | self.timeout = timeout 22 | self.retries = retries 23 | self.interval = interval 24 | self.queue = config.server_queue 25 | # Passing in the servers is passing in a reference which means that any changes are automatically reflected here. To solve this 26 | # we are creating a local copy of the servers that can be changed by receiving an update from the queue. 27 | self.servers = [] 28 | for server in config.servers_interface_ip: 29 | self.servers.append(server) 30 | 31 | # Call the below lines ONCE 32 | self.cmdGen = cmdgen.CommandGenerator() 33 | self.community = cmdgen.CommunityData('public', mpModel=0) 34 | 35 | self.server_count = len(self.servers) # Count of the weighted servers. Used to keep complexity down between weighted vs non-weighted. 36 | self.target = [] 37 | 38 | for server in self.servers: 39 | self.target.append(cmdgen.UdpTransportTarget((server, 161), timeout=self.timeout, retries=self.retries)) 40 | 41 | def run(self): 42 | while True: 43 | for index in range(self.server_count): 44 | errorIndication, errorStatus, errorIndex, varBinds = self.cmdGen.getCmd( 45 | self.community, 46 | self.target[index], 47 | cmdgen.MibVariable(".1.3.6.1.2.1.25.1.1.0") # System Uptime 48 | ) 49 | 50 | if errorIndication is not None: # Most likely the Request Timed Out (system down or unreachable) 51 | log("Server: {0} Error: {1}".format(self.servers[index], str(errorIndication)), level="CRITICAL", log_type="ERROR") 52 | update_servers(index) 53 | else: 54 | update_servers(index, False) # This will remove the server from the bad list 55 | 56 | # If errorStatus is valid then there is an issue with the PDU on the server AND errorIndex-1 will represent the varBinds index of the error. 57 | 58 | time.sleep(self.interval) 59 | 60 | try: 61 | queue_data = self.queue.get_nowait() 62 | if queue_data is not None and queue_data == "update": # This usually comes from the API section. 63 | self.servers[:] = [] 64 | self.target[:] = [] 65 | for server in config.servers_interface_ip: 66 | self.servers.append(server) 67 | self.target.append(cmdgen.UdpTransportTarget((server, 161), timeout=self.timeout, retries=self.retries)) 68 | except Queue.Empty, e: 69 | pass 70 | -------------------------------------------------------------------------------- /1.0/api_server-1.0.5/controllers/src/snmp_servers.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | 4 | """ 5 | SNMP_EDGES - Polls the edges listed in the servers.yaml file and pulls back the snmp information 6 | """ 7 | 8 | 9 | import config 10 | import log 11 | 12 | from pysnmp.entity.rfc3413.oneliner import cmdgen 13 | 14 | # Call the below lines ONCE 15 | cmdGen = cmdgen.CommandGenerator() 16 | community = cmdgen.CommunityData('public', mpModel=0) 17 | 18 | target = [] 19 | 20 | for server in config.servers: 21 | target.append(cmdgen.UdpTransportTarget((server, 161))) 22 | 23 | 24 | def snmp_servers(): # Pass in cmdGen from the thread creation instead of instantiating each time! 25 | index = 0 26 | 27 | # Determine the correct snmp oids to look for and the better one gets the prize! 28 | 29 | errorIndication, errorStatus, errorIndex, varBinds = cmdGen.getCmd( 30 | community, 31 | target[0], 32 | cmdgen.MibVariable(config.snmps[0]) 33 | ) 34 | 35 | # Check for errors and print out results 36 | if errorIndication: 37 | log.log(errorIndication, "ERROR") 38 | else: 39 | if errorStatus: 40 | log.log('%s at %s' % ( 41 | errorStatus.prettyPrint(), 42 | errorIndex and varBinds[int(errorIndex) - 1] or '?'), "ERROR") 43 | else: 44 | for name, val in varBinds: 45 | print('%s = %s' % (name.prettyPrint(), val.prettyPrint())) 46 | 47 | return index #Hardcode for now 48 | 49 | 50 | """ 51 | Network Interface Statistics 52 | 53 | List NIC names: .1.3.6.1.2.1.2.2.1.2 54 | Get Bytes IN: .1.3.6.1.2.1.2.2.1.10 55 | Get Bytes IN for NIC 4: .1.3.6.1.2.1.2.2.1.10.4 56 | Get Bytes OUT: .1.3.6.1.2.1.2.2.1.16 57 | Get Bytes OUT for NIC 4: .1.3.6.1.2.1.2.2.1.16.4 58 | 59 | CPU Statistics 60 | 61 | Load 62 | 1 minute Load: .1.3.6.1.4.1.2021.10.1.3.1 63 | 5 minute Load: .1.3.6.1.4.1.2021.10.1.3.2 64 | 15 minute Load: .1.3.6.1.4.1.2021.10.1.3.3 65 | 66 | CPU 67 | percentage of user CPU time: .1.3.6.1.4.1.2021.11.9.0 68 | raw user cpu time: .1.3.6.1.4.1.2021.11.50.0 69 | percentages of system CPU time: .1.3.6.1.4.1.2021.11.10.0 70 | raw system cpu time: .1.3.6.1.4.1.2021.11.52.0 71 | percentages of idle CPU time: .1.3.6.1.4.1.2021.11.11.0 72 | raw idle cpu time: .1.3.6.1.4.1.2021.11.53.0 73 | raw nice cpu time: .1.3.6.1.4.1.2021.11.51.0 74 | 75 | Memory Statistics 76 | 77 | Total Swap Size: .1.3.6.1.4.1.2021.4.3.0 78 | Available Swap Space: .1.3.6.1.4.1.2021.4.4.0 79 | Total RAM in machine: .1.3.6.1.4.1.2021.4.5.0 80 | Total RAM used: .1.3.6.1.4.1.2021.4.6.0 81 | Total RAM Free: .1.3.6.1.4.1.2021.4.11.0 82 | Total RAM Shared: .1.3.6.1.4.1.2021.4.13.0 83 | Total RAM Buffered: .1.3.6.1.4.1.2021.4.14.0 84 | Total Cached Memory: .1.3.6.1.4.1.2021.4.15.0 85 | 86 | Disk Statistics 87 | 88 | disk / 100000 (or) 89 | 90 | includeAllDisks 10% for all partitions and disks 91 | 92 | The OIDs are as follows 93 | 94 | Path where the disk is mounted: .1.3.6.1.4.1.2021.9.1.2.1 95 | Path of the device for the partition: .1.3.6.1.4.1.2021.9.1.3.1 96 | Total size of the disk/partion (kBytes): .1.3.6.1.4.1.2021.9.1.6.1 97 | Available space on the disk: .1.3.6.1.4.1.2021.9.1.7.1 98 | Used space on the disk: .1.3.6.1.4.1.2021.9.1.8.1 99 | Percentage of space used on disk: .1.3.6.1.4.1.2021.9.1.9.1 100 | Percentage of inodes used on disk: .1.3.6.1.4.1.2021.9.1.10.1 101 | 102 | System Uptime: .1.3.6.1.2.1.1.3.0 103 | """ -------------------------------------------------------------------------------- /1.0/api_server-1.0.5/controllers/src/token_auth.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | 4 | import datetime 5 | import calendar 6 | from hashlib import sha1 7 | from hashlib import md5 8 | from hmac import new as hmac 9 | import config 10 | from log import log 11 | 12 | 13 | def token_authenticated(path, arguments, ip): 14 | passed = False 15 | 16 | # Check to see what type of authentication is needed 17 | # Currently only supports SeaChange but qualifier added anyway. 18 | 19 | count = 0 20 | new_dict = {} 21 | for k, v in arguments.iteritems(): 22 | key = str(k).lower() 23 | if key == "i" or key == "k" or key == "e" or key == "a" or key == "h": 24 | count += 1 25 | new_dict[key] = v[0] # Since v is a list just pull the only one 26 | 27 | if count == 5 and len(arguments) == count: # Seachange ALWAYS has 5 parameters 28 | passed = token_seachange(path, new_dict, ip) 29 | 30 | return passed 31 | 32 | 33 | def token_seachange(path, argument, ip): 34 | passed = False 35 | uri = path # Just for warnings in the exception handler 36 | 37 | # Rebuild query string in correct order... 38 | # NOTE: Use more local variables for debugging purposes. 39 | 40 | try: 41 | # Check for address 42 | if config.seachange['ip_restrict'] and argument['a'] != ip: 43 | return False 44 | 45 | # Check for expired date - SeaChange uses UTC 46 | if config.seachange['expire_date_restrict']: 47 | if config.token_types['seachange'] == "SHA1": 48 | expire_date = calendar.timegm(argument['e']) 49 | else: 50 | end = str(argument['e']) 51 | year = end[:4] 52 | month = end[4:2] 53 | day = end[6:2] 54 | hour = end[8:2] 55 | minute = end[10:2] 56 | second = end[12:] 57 | expire_date = datetime.datetime(year, month, day, hour, minute, second) 58 | 59 | if datetime.datetime.utcnow() > expire_date: 60 | return False 61 | 62 | uri = str("%s?i=%s&k=%s&e=%s&a=%s" % (path, argument['i'], argument['k'], argument['e'], argument['a'])).lower() 63 | 64 | #byte_string = uri.encode('utf-8') 65 | #byte_string = bytearray(uri, 'utf-8') 66 | key = config.keys_seachange[argument['k']] 67 | 68 | if config.token_types['seachange'] == "MD5": 69 | token = hmac(key.decode('hex'), uri, md5) 70 | else: 71 | token = hmac(key.decode('hex'), uri, sha1) 72 | 73 | hex_value = token.hexdigest() 74 | 75 | if hex_value == argument['h']: 76 | passed = True 77 | 78 | if config.logging: 79 | if passed: 80 | return_code = config.http_response_codes["found"] 81 | msg = "%s = %s" % (hex_value, argument['h']) 82 | else: 83 | return_code = config.http_response_codes["forbidden"] 84 | msg = "%s != %s" % (hex_value, argument['h']) 85 | log("%s - - \"TOKEN(SC) %s\" %s %s \"%s\" \"%s\" \"-\"" % ( 86 | ip, uri, return_code, 0, msg, argument)) 87 | 88 | except BaseException, e: 89 | log("%s - - \"GET %s\" %s %s \"%s\" \"%s\" \"-\"" % ( 90 | ip, uri, config.http_response_codes["forbidden"], 0, e, argument), level="WARNING", log_type="ERROR") 91 | 92 | finally: 93 | return passed -------------------------------------------------------------------------------- /1.0/api_server-1.0.5/controllers/src/update_servers.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | 4 | import config 5 | from util_functions import synchronized 6 | 7 | 8 | @synchronized(config.update_lock) 9 | def update_servers(server_index, add=True): 10 | try: 11 | try: 12 | config.servers_bad.remove(server_index) # Removes any previous server to keep from collecting the same IP. 13 | except BaseException, e: 14 | pass 15 | 16 | if add: 17 | config.servers_bad.append(server_index) 18 | except BaseException, e: 19 | pass # Simply want a clean exception - no logging required at this time. 20 | 21 | 22 | @synchronized(config.update_lock) 23 | def check_bad_servers(index): # Put the checking for bad servers in a small function so that locking and unlocking is fast 24 | passed = False 25 | 26 | if len(config.servers_bad) > 0: 27 | bad_pass = True 28 | for server in config.servers_bad: 29 | if server == index: 30 | bad_pass = False 31 | break # Jump out of for loop 32 | 33 | if bad_pass: 34 | passed = True 35 | else: 36 | passed = True 37 | 38 | return passed -------------------------------------------------------------------------------- /1.0/api_server-1.0.5/controllers/src/version.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | 4 | # version is a human-readable version number. 5 | 6 | # version_info is a four-tuple for programmatic comparison. The first 7 | # three numbers are the components of the version number. The fourth 8 | # is zero for an official release, positive for a development branch, 9 | # or negative for a release candidate or beta (after the base version 10 | # number has been incremented) 11 | version = "1.0.3" 12 | version_info = (1, 0, 3) 13 | 14 | -------------------------------------------------------------------------------- /1.0/api_server-1.0.5/scripts/etc/init.d/supervisord: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # /etc/rc.d/init.d/supervisord 4 | # 5 | # Supervisor is a client/server system that 6 | # allows its users to monitor and control a 7 | # number of processes on UNIX-like operating 8 | # systems. 9 | # 10 | # chkconfig: - 64 36 11 | # description: Supervisor Server 12 | # processname: supervisord 13 | 14 | # Source init functions 15 | . /etc/rc.d/init.d/functions 16 | 17 | prog="supervisord" 18 | 19 | prefix="/usr/local" 20 | exec_prefix="${prefix}" 21 | prog_bin="${exec_prefix}/bin/supervisord -c /etc/supervisord.conf" 22 | PIDFILE="/var/run/$prog.pid" 23 | 24 | start() 25 | { 26 | echo -n $"Starting $prog: " 27 | daemon $prog_bin --pidfile $PIDFILE 28 | RETVAL=$? 29 | [ $RETVAL -eq 0 ] && (success; touch /var/lock/subsys/supervisord) || failure; 30 | echo 31 | } 32 | 33 | stop() 34 | { 35 | echo -n $"Shutting down $prog: " 36 | [ -f $PIDFILE ] && killproc $prog || success $"$prog shutdown" 37 | echo 38 | } 39 | 40 | case "$1" in 41 | 42 | start) 43 | start 44 | ;; 45 | 46 | stop) 47 | stop 48 | ;; 49 | 50 | status) 51 | status $prog 52 | ;; 53 | 54 | restart) 55 | stop 56 | start 57 | ;; 58 | 59 | *) 60 | echo "Usage: $0 {start|stop|restart|status}" 61 | ;; 62 | 63 | esac 64 | -------------------------------------------------------------------------------- /1.0/api_server-1.0.5/scripts/etc/nginx.conf: -------------------------------------------------------------------------------- 1 | user nginx; 2 | worker_processes 1; 3 | 4 | error_log /var/log/nginx/error.log; 5 | pid /var/run/nginx.pid; 6 | 7 | events { 8 | worker_connections 1024; 9 | use epoll; 10 | } 11 | 12 | 13 | http { 14 | # Enumerate all the Tornado servers here 15 | upstream request_router { 16 | server 127.0.0.1:8000; 17 | server 127.0.0.1:8001; 18 | server 127.0.0.1:8002; 19 | server 127.0.0.1:8004; 20 | server 127.0.0.1:8005; 21 | server 127.0.0.1:8006; 22 | server 127.0.0.1:8007; 23 | server 127.0.0.1:8008; 24 | server 127.0.0.1:8009; 25 | server 127.0.0.1:8010; 26 | server 127.0.0.1:8011; 27 | server 127.0.0.1:8012; 28 | server 127.0.0.1:8013; 29 | server 127.0.0.1:8014; 30 | server 127.0.0.1:8015; 31 | server 127.0.0.1:8016; 32 | server 127.0.0.1:8017; 33 | server 127.0.0.1:8018; 34 | server 127.0.0.1:8019; 35 | server 127.0.0.1:8020; 36 | server 127.0.0.1:8021; 37 | server 127.0.0.1:8022; 38 | server 127.0.0.1:8023; 39 | server 127.0.0.1:8024; 40 | server 127.0.0.1:8025; 41 | server 127.0.0.1:8026; 42 | server 127.0.0.1:8027; 43 | server 127.0.0.1:8028; 44 | server 127.0.0.1:8029; 45 | server 127.0.0.1:8030; 46 | server 127.0.0.1:8031; 47 | server 127.0.0.1:8032; 48 | server 127.0.0.1:8033; 49 | } 50 | 51 | #Some environments use different configs... 52 | #include /usr/local/nginx/conf/mime.types; 53 | include /etc/nginx/mime.types; 54 | 55 | default_type application/octet-stream; 56 | 57 | access_log /var/log/nginx/access.log; 58 | 59 | keepalive_timeout 65; 60 | proxy_read_timeout 200; 61 | sendfile on; 62 | tcp_nopush on; 63 | tcp_nodelay on; 64 | gzip on; 65 | gzip_min_length 1000; 66 | gzip_proxied any; 67 | gzip_types text/plain text/css text/xml 68 | application/x-javascript application/xml 69 | application/atom+xml text/javascript; 70 | 71 | # Only retry if there was a communication error, not a timeout 72 | # on the Tornado server (to avoid propagating "queries of death" 73 | # to all frontends) 74 | proxy_next_upstream error; 75 | server { 76 | listen 80; 77 | server_name localhost; 78 | # Allow file uploads 79 | client_max_body_size 50M; 80 | 81 | location static/ { 82 | root /usr/local/bin/request_router/static/; 83 | if ($query_string) { 84 | expires max; 85 | } 86 | } 87 | location = /crossdomains.xml { 88 | rewrite (.*) /static/crossdomains.xml; 89 | } 90 | location = /clientaccesspolicy.xml { 91 | rewrite (.*) /static/clientaccesspolicy.xml; 92 | } 93 | location = /favicon.ico { 94 | rewrite (.*) /static/favicon.ico; 95 | } 96 | location = /robots.txt { 97 | rewrite (.*) /static/robots.txt; 98 | } 99 | 100 | location / { 101 | proxy_pass_header Server; 102 | proxy_set_header Host $http_host; 103 | proxy_redirect off; 104 | proxy_set_header X-Real-IP $remote_addr; 105 | proxy_set_header X-Scheme $scheme; 106 | proxy_pass http://request_router; 107 | } 108 | } 109 | } -------------------------------------------------------------------------------- /1.0/api_server-1.0.5/servers.yaml: -------------------------------------------------------------------------------- 1 | # DO NOT MODIFY: Machine Generated YAML File! 2 | # ALL values MUST NOT BE EMPTY! If the value needs to be empty then use a 0 for a numeric value or '' for a string. 3 | 4 | servers: 5 | - 10.76.101.10 6 | 7 | server_defaults: 8 | port: 5555 9 | 10 | server_ports: 11 | 10.76.101.10: 5555 12 | 13 | servers_interface_ip: 14 | - 10.76.101.10 15 | 16 | server_config: 17 | file: 'config.yaml' 18 | path: '/etc/sysconfig/transparent_caching/' 19 | 20 | purge: 21 | verb: PURGE 22 | url: /tcspurge/ccur/video/ 23 | targets: 24 | - ytb 25 | - nfl 26 | edges: 27 | - 10.76.101.31 28 | 29 | -------------------------------------------------------------------------------- /1.0/api_server-1.0.5/servers.yaml.rpmnew: -------------------------------------------------------------------------------- 1 | # DO NOT MODIFY: Machine Generated YAML File! 2 | # ALL values MUST NOT BE EMPTY! If the value needs to be empty then use a 0 for a numeric value or '' for a string. 3 | 4 | servers: 5 | - 10.76.101.10 6 | 7 | server_defaults: 8 | port: 5555 9 | 10 | server_ports: 11 | 10.76.101.10: 5555 12 | 13 | servers_interface_ip: 14 | - 10.76.101.10 15 | 16 | server_config: 17 | file: 'config.yaml' 18 | path: '/etc/sysconfig/transparent_caching/' 19 | 20 | purge: 21 | verb: PURGE 22 | url: /tcspurge/ccur/video/ 23 | targets: 24 | - ytb 25 | - nfl 26 | edges: 27 | - 10.76.101.31 28 | 29 | -------------------------------------------------------------------------------- /1.0/api_server-1.0.5/testing/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /1.0/centos7-scripts/SCRIPTS/gen_accts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | useradd tcsbuild 4 | 5 | useradd -d /var/www -s /sbin/nologin apache 6 | useradd -d /var/lib/jenkins -s /sbin/nologin jenkins 7 | 8 | usermod -a -G wheel tcsbuild 9 | usermod -a -G wheel apache 10 | usermod -a -G wheel jenkins 11 | 12 | exit 0 13 | -------------------------------------------------------------------------------- /1.0/centos7-scripts/SCRIPTS/install_jenkins.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo 4 | rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key 5 | yum install --assumeyes jenkins 6 | 7 | yum install --assumeyes java-1.7.0-openjdk 8 | 9 | yum install --assumeyes httpd 10 | 11 | firewall-cmd --zone=public --add-port=8080/tcp --permanent 12 | firewall-cmd --zone=public --add-service=http --permanent 13 | firewall-cmd --reload 14 | 15 | chkconfig --level 2345 jenkins on 16 | systemctl restart jenkins.service 17 | 18 | exit 0 19 | -------------------------------------------------------------------------------- /1.0/centos7-scripts/SCRIPTS/install_tcs_yums.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | rpm -Uvh ../RPMS/x86_64/3rd_party/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm 4 | rpm -Uvh ../RPMS/x86_64/3rd_party/epel-release-7-5.noarch.rpm 5 | 6 | yum install --assumeyes update 7 | 8 | yum install --assumeyes wget.x86_64 9 | 10 | yum install --assumeyes net-snmp.x86_64 11 | yum install --assumeyes net-snmp-libs.x86_64 12 | yum install --assumeyes net-snmp-utils.x86_64 13 | 14 | yum install --assumeyes bzip2 15 | yum install --assumeyes numactl.x86_64 16 | yum install --assumeyes pkgconfig autoconf 17 | 18 | yum install --assumeyes libpcap.x86_64 19 | 20 | yum install --assumeyes libyaml.x86_64 21 | 22 | yum install --assumeyes apr-util 23 | 24 | yum install --assumeyes gtk2.x86_64 25 | 26 | # the following are required for python-2.7 27 | yum install --assumeyes python-setuptools 28 | yum install --assumeyes python-pip 29 | yum install --assumeyes supervisor 30 | yum install --assumeyes python-tornado.noarch 31 | yum install --assumeyes python-netaddr.noarch 32 | yum install --assumeyes pysnmp.noarch 33 | yum install --assumeyes python-zmq.x86_64 34 | yum install --assumeyes python-yaml 35 | 36 | yum install --assumeyes iptables-services.x86_64 37 | 38 | yum install --assumeyes net-tools 39 | 40 | yum install --assumeyes boost-regex.x86_64 41 | 42 | yum install --assumeyes ntp ntpdate ntp-doc 43 | ntpdate pool.ntp.org 44 | systemctl enable ntpd 45 | systemctl start ntpd 46 | 47 | exit 0 48 | -------------------------------------------------------------------------------- /1.0/centos7-scripts/SCRIPTS/install_tcsdev_yums.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | rpm -Uvh ../RPMS/x86_64/3rd_party/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm 4 | rpm -Uvh ../RPMS/x86_64/3rd_party/epel-release-7-5.noarch.rpm 5 | 6 | yum install --assumeyes update 7 | 8 | yum install --assumeyes wget.x86_64 9 | 10 | yum install "kernel-devel-uname-r == $(uname -r)" 11 | yum install --assumeyes kernel-headers.x86_64 12 | yum install --assumeyes kernel-tools.x86_64 13 | yum install --assumeyes kernel-tools-libs.x86_64 14 | yum install --assumeyes dkms.noarch 15 | 16 | yum install --assumeyes rpm-build 17 | yum install --assumeyes redhat-rpm-config 18 | 19 | yum install --assumeyes gcc.x86_64 20 | yum install --assumeyes gcc-c++.x86_64 21 | yum install --assumeyes gcc-gfortran.x86_64 22 | yum install --assumeyes libgcc.x86_64 23 | 24 | yum install --assumeyes net-snmp.x86_64 25 | yum install --assumeyes net-snmp-libs.x86_64 26 | yum install --assumeyes net-snmp-utils.x86_64 27 | yum install --assumeyes net-snmp-devel.x86_64 28 | 29 | yum install --assumeyes bzip2 30 | yum install --assumeyes numactl.x86_64 31 | yum install --assumeyes pkgconfig autoconf 32 | 33 | yum install --assumeyes ncurses-devel 34 | yum install --assumeyes sqlite-devel 35 | yum install --assumeyes readline-devel 36 | yum install --assumeyes tcl-devel tk-devel 37 | yum install --assumeyes openssl-devel 38 | yum install --assumeyes gmp-devel 39 | yum install --assumeyes gdbm-devel 40 | yum install --assumeyes bzip2-devel 41 | yum install --assumeyes expat-devel 42 | yum install --assumeyes tix-devel 43 | yum install --assumeyes libffi-devel 44 | yum install --assumeyes libGL-devel 45 | yum install --assumeyes libX11-devel 46 | yum install --assumeyes numactl-devel.x86_64 47 | 48 | yum install --assumeyes libpcap.x86_64 49 | yum install --assumeyes libpcap-devel.x86_64 50 | yum install --assumeyes pcre-devel.x86_64 51 | 52 | yum install --assumeyes libyaml.x86_64 53 | yum install --assumeyes libyaml-devel.x86_64 54 | 55 | yum install --assumeyes apr-devel 56 | yum install --assumeyes apr-util 57 | yum install --assumeyes apr-util-devel 58 | 59 | yum install --assumeyes gtk2.x86_64 60 | yum install --assumeyes gtk2-devel.x86_64 61 | 62 | yum install --assumeyes wxGTK-devel.x86_64 63 | 64 | yum install --assumeyes subversion-devel 65 | 66 | yum install --assumeyes boost-devel.x86_64 67 | yum install --assumeyes boost-regex.x86_64 68 | 69 | # the following are required for python-2.7 70 | yum install --assumeyes python-setuptools 71 | yum install --assumeyes python-pip 72 | yum install --assumeyes supervisor 73 | yum install --assumeyes python-tornado.noarch 74 | yum install --assumeyes python-netaddr.noarch 75 | yum install --assumeyes pysnmp.noarch 76 | yum install --assumeyes python-zmq.x86_64 77 | yum install --assumeyes python-yaml 78 | 79 | yum install --assumeyes libreport-plugin-mailx.x86_64 80 | yum install --assumeyes mailcap.noarch 81 | 82 | yum install --assumeyes iptables-services.x86_64 83 | 84 | yum install --assumeyes net-tools 85 | 86 | yum install --assumeyes ntp ntpdate ntp-doc 87 | ntpdate pool.ntp.org 88 | systemctl enable ntpd 89 | systemctl start ntpd 90 | 91 | exit 0 92 | -------------------------------------------------------------------------------- /1.0/centos7-scripts/SCRIPTS/open_ports.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | systemctl enable iptables 4 | 5 | iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT 6 | iptables -A INPUT -p tcp -m tcp --dport 161 -j ACCEPT 7 | iptables -A INPUT -p tcp -m tcp --dport 162 -j ACCEPT 8 | iptables -A INPUT -p tcp -m tcp --dport 705 -j ACCEPT 9 | iptables -A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT 10 | if [ -f /etc/sysconfig/iptables ] 11 | then 12 | d=`date +%m%d%y%H%m%s` 13 | mv /etc/sysconfig/iptables /etc/sysconfig/iptables.$d 14 | fi 15 | /sbin/service iptables save 16 | 17 | ip6tables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT 18 | ip6tables -A INPUT -p tcp -m tcp --dport 161 -j ACCEPT 19 | ip6tables -A INPUT -p tcp -m tcp --dport 162 -j ACCEPT 20 | ip6tables -A INPUT -p tcp -m tcp --dport 705 -j ACCEPT 21 | ip6tables -A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT 22 | if [ -f /etc/sysconfig/ip6tables ] 23 | then 24 | d=`date +%m%d%y%H%m%s` 25 | mv /etc/sysconfig/ip6tables /etc/sysconfig/ip6tables.$d 26 | fi 27 | /sbin/service ip6tables save 28 | 29 | exit 0 30 | -------------------------------------------------------------------------------- /1.0/documentation/Laguna 1.0 Developer Guide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/concurrentlabs/laguna/d8036889885217881da686eb54bf8419e06d8ce4/1.0/documentation/Laguna 1.0 Developer Guide.pdf -------------------------------------------------------------------------------- /1.0/documentation/Laguna 1.0 User Guide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/concurrentlabs/laguna/d8036889885217881da686eb54bf8419e06d8ce4/1.0/documentation/Laguna 1.0 User Guide.pdf -------------------------------------------------------------------------------- /1.0/images/tcs_control_plane.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/concurrentlabs/laguna/d8036889885217881da686eb54bf8419e06d8ce4/1.0/images/tcs_control_plane.png -------------------------------------------------------------------------------- /1.0/scripts/cachequery/cache_query.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import io 4 | import os 5 | import signal 6 | import sys 7 | from subprocess import call 8 | 9 | hit = miss = bypass = expired = 0 10 | 11 | ######################################################################################### 12 | ######################################################################################### 13 | def main(): 14 | try: 15 | s = '/var/log/nginx/cache.log' 16 | istream = io.open(s, 'r') 17 | except IOError: 18 | print 'ERROR: failed to open %s' % s 19 | exit(-1) 20 | 21 | try: 22 | open("/var/run/cache_query.pid","wb").write('%d' % os.getpid()) 23 | except IOError: 24 | print 'ERROR: failed to open %s' % s 25 | exit(-1) 26 | 27 | signal.signal(signal.SIGINT, reset_stats) 28 | 29 | global hit, miss, bypass, expired 30 | 31 | istream.seek(0, 2) 32 | banner() 33 | print_stat_line() 34 | while 1: 35 | for s in istream.readlines(): 36 | l = s.split(' ') 37 | if l[2] == 'HIT': 38 | hit += 1 39 | print_stat_line() 40 | elif l[2] == 'MISS': 41 | miss += 1 42 | print_stat_line() 43 | elif l[2] == 'BYPASS': 44 | bypass += 1 45 | print_stat_line() 46 | elif l[2] == 'EXPIRED': 47 | expired += 1 48 | print_stat_line() 49 | ### ??? ### 50 | # expired = 0 51 | exit(0) 52 | 53 | ######################################################################################### 54 | # reset stats 55 | ######################################################################################### 56 | def reset_stats(sig, stack): 57 | # print "reset_stats fired." 58 | global hit, miss, bypass, expired 59 | hit = miss = bypass = expired = 0 60 | banner() 61 | print_stat_line() 62 | return 63 | 64 | ######################################################################################### 65 | ######################################################################################### 66 | def banner(): 67 | call(["clear"]) 68 | print '\n Cache Statistics\n ================\n' 69 | return 70 | 71 | ######################################################################################### 72 | ######################################################################################### 73 | def print_stat_line(): 74 | global hit, miss, bypass, expired 75 | sys.stdout.write(' HIT: %5d MISS: %5d BYPASS: %5d EXPIRED: %5d\n' 76 | % (hit, miss, bypass, expired)) 77 | return 78 | 79 | ######################################################################################### 80 | ######################################################################################### 81 | if __name__ == "__main__": 82 | main() 83 | -------------------------------------------------------------------------------- /1.0/scripts/cachequery/kill_cache_query.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | pid=`cat /var/run/cache_query.pid` 4 | kill $pid 5 | exit 0 6 | -------------------------------------------------------------------------------- /1.0/scripts/cachequery/strtnginx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | CACHE_LOC=/var/cache/tomnginx 4 | 5 | /etc/init.d/./nginx stop 6 | echo "cleaning up nginx cache: $CACHE_LOC" 7 | rm -rf /var/cache/tomnginx/* 8 | /etc/init.d/./nginx start 9 | du -sh $CACHE_LOC 10 | -------------------------------------------------------------------------------- /1.0/scripts/rpm/transparent_caching_1.0.0/etc/cron.daily/cleanupSimulationLogs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | D1=`date` 4 | DATE=`date -d "$D1 - 2 days" +%Y%m%d` 5 | #DATE=`date +%Y%m%d` 6 | 7 | #group simulation log files together before taring 8 | FILEBASE=\/var\/log\/trsim-$DATE.*.log 9 | 10 | echo "Removing old simulation log files: "$FILEBASE 11 | 12 | #all the trsim log files for today 13 | `rm -rf $FILEBASE` 14 | 15 | exit 0 -------------------------------------------------------------------------------- /1.0/scripts/rpm/transparent_caching_1.0.0/etc/cron.daily/cleanupYamls.sh: -------------------------------------------------------------------------------- 1 | #################################################### 2 | # Script to cleanup old TCS config.yaml files that # 3 | # are saved when the config.yaml file is updated # 4 | # through the mgt sys or api_server api. # 5 | #################################################### 6 | 7 | #!/bin/sh 8 | 9 | FILES=/etc/sysconfig/transparent_caching/yamls/config.* 10 | FILECOUNT=$(ls $FILES | wc -l) 11 | KEEPFILECOUNT=20 12 | DELETECOUNT=`expr $FILECOUNT - $KEEPFILECOUNT` 13 | n=1 14 | 15 | 16 | if [ "$DELETECOUNT" -lt 1 ]; then 17 | echo "No backup config.yaml files to delete" 18 | exit 19 | else 20 | echo "Removing $DELETECOUNT backup config.yaml files" 21 | fi 22 | 23 | for f in `ls -rt $FILES`; do 24 | if [ "$n" -gt "$DELETECOUNT" ]; then 25 | exit 26 | fi 27 | rm -f $f 28 | # echo Deleted file: $f 29 | n=`expr $n + 1` 30 | done 31 | 32 | exit 0 33 | -------------------------------------------------------------------------------- /1.0/scripts/rpm/transparent_caching_1.0.0/etc/init.d/gwdisc: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # /etc/rc.d/init.d/gwdisc 4 | # 5 | # Supervisor is a client/server system that 6 | # allows its users to monitor and control a 7 | # number of processes on UNIX-like operating 8 | # systems. 9 | # 10 | # chkconfig: - 75 36 11 | # description: Transparent Caching Gateway discovery 12 | # processname: gwdisc 13 | 14 | # Source init functions 15 | . /etc/rc.d/init.d/functions 16 | 17 | prog=gwdisc 18 | prefix="/usr/local" 19 | exec_prefix="${prefix}" 20 | sysconf_dir="/etc/sysconfig/transparent_caching" 21 | prog_bin="${exec_prefix}/bin/transparent_caching/gwdisc.py -c $sysconf_dir/config.yaml -o $sysconf_dir/sys.yaml -t 60 -d" 22 | PIDFILE="/var/run/$prog.pid" 23 | 24 | start() 25 | { 26 | #remove transc.pid file if exists and no process running 27 | ps ax | grep -v grep | grep $prog.py > /dev/null 28 | if [ $? -eq 1 ] && [ -f $PIDFILE ]; then 29 | rm -f $PIDFILE 30 | echo "delete pid file $PIDFILE" 31 | fi 32 | echo -n $"Starting $prog: " 33 | #daemon --pidfile $PIDFILE $prog_bin 34 | python $prog_bin 35 | RETVAL=$? 36 | if [ $RETVAL -eq 0 ]; then 37 | [ -f $PIDFILE ] && success $"$prog startup" || failure $"$prog startup" 38 | echo 39 | else 40 | echo "failure to launch $prog please check /var/log/messages" 41 | fi 42 | } 43 | 44 | stop() 45 | { 46 | echo -n $"Shutting down $prog: " 47 | [ -f $PIDFILE ] && killproc $prog || success $"$prog shutdown" 48 | echo 49 | } 50 | 51 | case "$1" in 52 | 53 | start) 54 | start 55 | ;; 56 | 57 | stop) 58 | stop 59 | ;; 60 | 61 | status) 62 | status $prog 63 | ;; 64 | 65 | restart) 66 | stop 67 | start 68 | ;; 69 | 70 | *) 71 | echo "Usage: $0 {start|stop|restart|status}" 72 | ;; 73 | 74 | esac 75 | -------------------------------------------------------------------------------- /1.0/scripts/rpm/transparent_caching_1.0.0/etc/init.d/transc: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # /etc/rc.d/init.d/transc 4 | # 5 | # Supervisor is a client/server system that 6 | # allows its users to monitor and control a 7 | # number of processes on UNIX-like operating 8 | # systems. 9 | # 10 | # chkconfig: - 60 36 11 | # description: Transparent Caching 12 | # processname: transc 13 | 14 | # Source init functions 15 | . /etc/rc.d/init.d/functions 16 | 17 | prog="transc" 18 | prefix="/usr/local" 19 | exec_prefix="${prefix}" 20 | prog_bin="${exec_prefix}/bin/transparent_caching" 21 | sysconf_dir="/etc/sysconfig/transparent_caching" 22 | TRANSCX="$prog_bin/./$prog" 23 | TRANSCPIDFILE=/var/run/transc.pid 24 | 25 | # 26 | # Name: f_chkinput 27 | # Purpose: check input 28 | # TODO: move this function to /etc/rc.d/init.d/functions 29 | f_chkinput() 30 | { 31 | if [ -z $1 ]; then 32 | echo "error no input" 33 | exit 1 34 | fi 35 | } 36 | 37 | start() 38 | { 39 | ulimit -S -c unlimited >/dev/null 2>&1 40 | modprobe pf_ring 41 | lsmod | grep pf_ring > /dev/null 42 | RETVAL=$? 43 | if [ $RETVAL -eq 1 ]; then 44 | echo failure "pf_ring.ko kernel module is not currently loaded, please load the kernel module." 45 | exit 1 46 | fi 47 | #remove transc.pid file if exists and no process running 48 | pidof transc > /dev/null 49 | if [ $? -eq 1 ] && [ -f $TRANSCPIDFILE ]; then 50 | rm -f $TRANSCPIDFILE 51 | echo "delete pid file $TRANSCPIDFILE" 52 | fi 53 | 54 | rm -f $sysconf_dir/sys.yaml > /dev/null 55 | cp -f $sysconf_dir/dfltsys.yaml $sysconf_dir/sys.yaml > /dev/null 56 | #call gwdisc and find the gw and interface MAC address 57 | python $prog_bin/./gwdisc.py -c $sysconf_dir/config.yaml -o $sysconf_dir/sys.yaml 58 | echo -n $"Starting $prog: " 59 | $prog_bin/./$prog -d -c $sysconf_dir/config.yaml -lc $sysconf_dir/trlog.conf -sc $sysconf_dir/sys.yaml 60 | RETVAL=$? 61 | if [ $RETVAL -eq 0 ]; then 62 | [ -f $TRANSCX ] && success $"$prog startup" || failure $"$prog startup please check logfile" 63 | echo 64 | elif [ $RETVAL -eq 5 ]; then 65 | echo failure $"$prog startup please check logfile" 66 | elif [ $RETVAL -eq 4 ]; then 67 | echo "failure resource initializations" 68 | elif [ $RETVAL -eq 3 ]; then 69 | echo "failure another process already running." 70 | elif [ $RETVAL -eq 2 ]; then 71 | echo failure $"$prog startup please check logfile" 72 | else 73 | echo failure initialization $"$prog startup please check logfile" 74 | fi 75 | 76 | } 77 | 78 | stop() 79 | { 80 | echo -n $"Shutting down $prog: " 81 | [ -f $TRANSCX ] && killproc $prog || success $"$prog shutdown" 82 | echo 83 | } 84 | 85 | case "$1" in 86 | 87 | start) 88 | start 89 | ;; 90 | 91 | stop) 92 | stop 93 | ;; 94 | 95 | status) 96 | status $prog 97 | ;; 98 | 99 | restart) 100 | stop 101 | start 102 | ;; 103 | 104 | *) 105 | echo "Usage: $0 {start|stop|restart|status}" 106 | ;; 107 | 108 | esac 109 | 110 | -------------------------------------------------------------------------------- /1.0/scripts/rpm/transparent_caching_1.0.0/etc/sysconfig/transparent_caching/dfltsys.yaml: -------------------------------------------------------------------------------- 1 | MODEOFOPERATION: 'monitor' 2 | INTERFACE_TYPE: 'other' 3 | INTERFACE_MACADDR: '00:00:00:00:00:00' 4 | GATEWAY_MACADDR: '00:00:00:00:00:00' -------------------------------------------------------------------------------- /1.0/scripts/rpm/transparent_caching_1.0.0/etc/sysconfig/transparent_caching/trlog.conf: -------------------------------------------------------------------------------- 1 | [global] 2 | strict init = true 3 | reload conf period = 10M 4 | 5 | buffer min = 1024 6 | buffer max = 2MB 7 | 8 | #rotate lock file = /tmp/zlog.lock 9 | rotate lock file = self 10 | default format = "%d(%F %T.%l) %-6V (%c:%F:%L) - %m%n" 11 | 12 | file perms = 600 13 | fsync period = 1K 14 | 15 | [levels] 16 | TRACE = 10 17 | CRIT = 130, LOG_CRIT 18 | 19 | [formats] 20 | simulation = "%m%n" 21 | simple = "[%-5V] %m%n" 22 | normal = "[%-5V] %d(%F %T.%l) %m%n" 23 | detailed = "%d(%m-%d %T) [%-5V] [%p:%F:%L] %m%n". 24 | 25 | [rules] 26 | #for Management system, DO NOT change this configuration 27 | tr_svc_sim_.INFO "/var/log/trsim.log", 20MB*60 ~ "/var/log/trsim-%d(%Y%m%d).#3s.log"; simulation 28 | #- zlog levels: "DEBUG" < "INFO" < "NOTICE" < "WARN" < "ERROR" < "FATAL". 29 | #- mapping of logical log file name to physical log file name 30 | #- log rotation of 12 log files total, 10 MB each 31 | #logging option examples: 32 | #output everything (all logical components and services) into one physical log file 33 | #tr_.WARN "/var/log/troute.log",10MB*12; simple 34 | #output logical component, system only into one physical log file 35 | #tr_comp_sys.WARN "/var/log/trcompsys.log",10MB*12; simple 36 | #output logical component, pktprc only into one physical log file 37 | #tr_comp_pktprc.WARN "/var/log/trcomppp.log",10MB*12; simple 38 | #output logical component, httpprc only into one physical log file 39 | #tr_comp_httpprc.WARN "/var/log/trcomphp.log",10MB*12; simple 40 | #output logical component, pktgen only into one physical log file 41 | #tr_comp_pktgen.WARN "/var/log/trcomppg.log",10MB*12; simple 42 | #output logical component, tcplanesnmp(mib) only into one physical log file 43 | #tr_comp_mib.WARN "/var/log/trcompmib.log",10MB*12; simple 44 | #output logical component, sim (everything) only into one physical log file 45 | tr_comp_sim_.WARN "/var/log/trcompsim.log",10MB*12; normal 46 | #output logical component, all components only into one physical log file 47 | tr_comp_.WARN "/var/log/trcompsim.log",10MB*12; normal 48 | #output logical services in common w3c format into one physical log file 49 | tr_svc_pktprc_.INFO "/var/log/trservice.log",10MB*12; simple 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /1.0/scripts/rpm/transparent_caching_1.0.0/etc/systemd/gwdisc.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Laguna transc gateway discovery server daemon 3 | After=syslog.target 4 | After=network.target 5 | 6 | [Service] 7 | Type=forking 8 | ExecStart=/etc/init.d/gwdisc start 9 | 10 | # Give a reasonable amount of time for the server to start up/shut down 11 | TimeoutSec=300 12 | 13 | [Install] 14 | WantedBy=multi-user.target 15 | -------------------------------------------------------------------------------- /1.0/scripts/rpm/transparent_caching_1.0.0/etc/systemd/transc.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Laguna transc server daemon 3 | After=syslog.target 4 | After=network.target 5 | 6 | [Service] 7 | Type=forking 8 | ExecStart=/etc/init.d/transc start 9 | 10 | # Give a reasonable amount of time for the server to start up/shut down 11 | TimeoutSec=300 12 | 13 | [Install] 14 | WantedBy=multi-user.target 15 | -------------------------------------------------------------------------------- /1.0/scripts/serveraccesspolicy/clientaccesspolicy.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /1.0/scripts/serveraccesspolicy/crossdomain.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /1.0/scripts/siege/throughput.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | SAMPLE_FREQ=${1} 3 | POLLING_COUNT=${2} 4 | INTERFACE=${3} 5 | COUNTER=0 6 | 7 | echo Time \ \ \ Gbps 8 | SAMPLE1=`ifconfig ${INTERFACE}|grep "TX bytes"|cut -d':' -f 3|cut -d ' ' -f1 ` 9 | while [ $COUNTER -lt $POLLING_COUNT ] 10 | do 11 | sleep $SAMPLE_FREQ 12 | SAMPLE2=`ifconfig ${INTERFACE}|grep "TX bytes"|cut -d':' -f 3|cut -d ' ' -f1 ` 13 | echo `date +"%H:%M:%S"` $(echo "scale=5; ($SAMPLE2-$SAMPLE1)/${SAMPLE_FREQ}/125000000"| bc -l) 14 | SAMPLE1=$SAMPLE2 15 | let COUNTER=COUNTER+1 16 | done 17 | 18 | -------------------------------------------------------------------------------- /1.0/scripts/siege/transcperftest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | siege -f urls.txt -c50 -r500000 -b -i & 3 | sleep 3 4 | siege -f urls.txt -c50 -r500000 -b -i & 5 | sleep 5 6 | siege -f urls.txt -c50 -r500000 -b -i & 7 | sleep 3 8 | siege -f urls.txt -c50 -r500000 -b -i & 9 | sleep 5 10 | siege -f urls.txt -c50 -r500000 -b -i & 11 | sleep 3 12 | siege -f urls.txt -c50 -r500000 -b -i & 13 | -------------------------------------------------------------------------------- /1.0/src/misc/Makefile: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------- 2 | # Compiler settings 3 | #------------------------------------------------------------------------- 4 | -include $(TC_HOME)/tccompiler.mk 5 | 6 | #------------------------------------------------------------------------- 7 | # Target Macros 8 | #------------------------------------------------------------------------- 9 | TARGETNAME = libmisc 10 | TARGETDESC = "Laguna misc opensource helper library" 11 | TARGETSRC = http_parser.c msem.c mthread.c evlog.c\ 12 | tcpktparse.c lkfq.c tcutil.c tcregex.c 13 | TARGETDIR = $(TC_HOME)/lib 14 | TARGETTYPE = STATICLIB 15 | 16 | #------------------------------------------------------------------------- 17 | # Library Dependencies 18 | #------------------------------------------------------------------------- 19 | 20 | #------------------------------------------------------------------------- 21 | # Compiler Options 22 | #------------------------------------------------------------------------- 23 | CFLAGS_INC += -I/usr/local/include 24 | 25 | #------------------------------------------------------------------------- 26 | # Standard Makefile Inclusion 27 | #------------------------------------------------------------------------- 28 | -include $(TC_HOME)/tcgmake.mk 29 | -------------------------------------------------------------------------------- /1.0/src/misc/helper.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef HELPER_H 18 | #define HELPER_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | #define MISC_STDDEF_MAPPING 1 25 | #define TRANSC_MEMPOOL 1 26 | #if MISC_STDDEF_MAPPING 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #define TRANSC_LKFQ_LOCKCK FALSE 38 | typedef char CHAR; 39 | typedef unsigned char U8; 40 | typedef unsigned char BOOL; 41 | typedef unsigned short U16; 42 | typedef signed short S16; 43 | typedef unsigned long U32; 44 | typedef unsigned long long U64; 45 | typedef int I32; 46 | typedef signed long S32; 47 | typedef signed long tresult_t; 48 | typedef S32 hlpr_httpsite_hndl; 49 | #define ccur_memclear(x,z) memset(x,0,z) 50 | #define ccur_strlcpy g_strlcpy 51 | #define ccur_strlcat g_strlcat 52 | #define ccur_strnstr(a,b,c) g_strstr_len(a,c,b) 53 | #define ccur_regex_new g_regex_new 54 | #define ccur_regex_free g_regex_free 55 | #define ccur_strcasecmp g_ascii_strcasecmp 56 | #define ccur_strncasecmp g_ascii_strncasecmp 57 | #define tcOpenSysLog openlog 58 | #ifdef TRANSC_DEBUG 59 | #define CCURASSERT(x) assert(x) 60 | #define tcPrintSysLog(p,...) printf(__VA_ARGS__) 61 | #else 62 | #define CCURASSERT(x) (void)0 63 | #define tcPrintSysLog(p,...) syslog(p,"["TRANSC_PROCNAME"]:"__VA_ARGS__) 64 | #endif 65 | #define ESUCCESS 0 66 | #define EFAILURE -1 67 | #define EIGNORE 50 68 | #define ENOSUPPORT 51 69 | #define ENOVID 53 70 | #ifndef TRUE 71 | #define TRUE 1 72 | #endif /* TRUE */ 73 | #ifndef FALSE 74 | #define FALSE 0 75 | #endif /* FALSE */ 76 | #define CCUR_PRIVATE(_t) static _t 77 | #define CCUR_THREAD_ENTRY(_t) _t 78 | #define CCUR_PROTECTED(_t) _t 79 | #define CCUR_PUBLIC(_t) _t 80 | #endif /* MISC_STDDEF_MAPPING */ 81 | 82 | #define TRANSC_TIMEORIENT_UTC 0x1 83 | #define TRANSC_TIMEORIENT_LOCALTZ 0x2 84 | 85 | /* 86 | * Time storage definition. 87 | */ 88 | struct _tc_gd_time_s 89 | { 90 | U32 nSeconds; 91 | U32 nMicroseconds; 92 | U32 reserved; 93 | }; 94 | typedef struct _tc_gd_time_s 95 | tc_gd_time_t; 96 | 97 | #ifdef __cplusplus 98 | } 99 | #endif 100 | #endif /* HELPER_H */ 101 | -------------------------------------------------------------------------------- /1.0/src/misc/lkfq.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef LKFQ_H 18 | #define LKFQ_H 19 | 20 | #include "helper.h" 21 | /***** external includes *****/ 22 | #include 23 | #include 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | typedef void* lkfq_data_p; 30 | struct _lkfq_lfds_s 31 | { 32 | pthread_mutex_t tLock; 33 | struct lfds611_queue_state* pRbQs; 34 | BOOL bInit; 35 | U32 errCnt; 36 | }; 37 | typedef struct _lkfq_lfds_s lkfq_lfds_t; 38 | 39 | struct _lkfq_tc_s 40 | { 41 | lkfq_lfds_t tQAlloc; 42 | lkfq_lfds_t tQFree; 43 | cp_mempool * pMp; 44 | BOOL bLock; 45 | }; 46 | typedef struct _lkfq_tc_s 47 | lkfq_tc_t; 48 | 49 | CCUR_PUBLIC(tresult_t) 50 | lkfqCrQueue( 51 | lkfq_tc_t* pQ, 52 | U16 nBlockSize, 53 | U32 nQueue, 54 | U16 nChunkBlock, 55 | U16 nPages, 56 | BOOL bLock); 57 | 58 | CCUR_PUBLIC(void) 59 | lkfqSyncQ( 60 | lkfq_tc_t* pQ); 61 | 62 | CCUR_PUBLIC(void) 63 | lkfqDestQueue( 64 | lkfq_tc_t* pQ); 65 | 66 | CCUR_PUBLIC(lkfq_data_p) 67 | lkfqMalloc( 68 | lkfq_tc_t* pQ); 69 | 70 | CCUR_PUBLIC(void) 71 | lkfqFree( 72 | lkfq_tc_t* pQ, 73 | lkfq_data_p pD); 74 | 75 | CCUR_PUBLIC(void) 76 | lkfqFlushAllocList( 77 | lkfq_tc_t* pQ); 78 | 79 | CCUR_PUBLIC(void) 80 | lkfqFlushFreeList( 81 | lkfq_tc_t* pQ); 82 | 83 | CCUR_PUBLIC(void) 84 | lkfqWrite( 85 | lkfq_tc_t* pQ, 86 | lkfq_data_p pD); 87 | 88 | CCUR_PUBLIC(lkfq_data_p*) 89 | lkfqRead( 90 | lkfq_tc_t* pQ); 91 | 92 | CCUR_PUBLIC(void) 93 | lkfqReadRelease( 94 | lkfq_tc_t* pQ, 95 | lkfq_data_p pData); 96 | 97 | #ifdef __cplusplus 98 | } 99 | #endif 100 | #endif /* LKFQ_H */ 101 | -------------------------------------------------------------------------------- /1.0/src/misc/msem.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef MSEM_H 18 | #define MSEM_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | struct _msemattr_s 25 | { 26 | S32 nCurValue; 27 | S32 nMaxValue; 28 | }; 29 | 30 | typedef struct _msemattr_s msemattr_t; 31 | 32 | struct _msem_s 33 | { 34 | msemattr_t tAttributes; 35 | pthread_mutex_t hMutex; 36 | pthread_cond_t tConditional; 37 | U32 nWaitingCount; 38 | }; 39 | typedef struct _msem_s msem_t; 40 | 41 | 42 | CCUR_PUBLIC(tresult_t) 43 | mSemCondVarSemCreate( 44 | msem_t* pSem, 45 | CHAR* strErrBuff, 46 | U32 nErrBuff); 47 | 48 | CCUR_PUBLIC(tresult_t) 49 | mSemCondVarSemWaitTimed( 50 | msem_t* pSem, 51 | U32 nTimeoutMs); 52 | 53 | CCUR_PROTECTED(tresult_t) 54 | mSemCondVarSemDestroy( 55 | msem_t* pSem); 56 | 57 | CCUR_PUBLIC(tresult_t) 58 | mSemCondVarSemPost( 59 | msem_t* pSem, 60 | U32* pnPostValue); 61 | 62 | #ifdef __cplusplus 63 | extern "C" { 64 | #endif 65 | #endif /* MSEM_H */ 66 | -------------------------------------------------------------------------------- /1.0/src/misc/mthread.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef MTHREAD_H 18 | #define MTHREAD_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | #define MTHREAD_DEFAULT_PRIORITY (0xFFFF) 25 | #define MTHREAD_DEFAULT_STACK_SIZE (-1) 26 | 27 | typedef int mthread_result_t; 28 | 29 | typedef mthread_result_t \ 30 | (*mthreadentry_t) (void *); 31 | 32 | /* for SCHED_RR and SCHED_FIFO */ 33 | typedef enum 34 | { 35 | mThreadRtPriBackGrnd = 0, 36 | mThreadRtPriLowest = 20, 37 | mThreadRtPriBelowNormal = 40, 38 | mThreadRtPriNormal = 50, 39 | mThreadRtPriAboveNormal = 60, 40 | mThreadRtPriHigh = 80, 41 | mThreadRtPriSuperDuperHigh = 100 42 | } mthreadpri_t; 43 | 44 | struct _mthreadcreateattr_s 45 | { 46 | S32 nStackSize; 47 | S32 nPriority; 48 | I32 nPolicy; 49 | U64 nCPUMask; 50 | }; 51 | 52 | typedef struct _mthreadcreateattr_s 53 | mthreadcreateattr_t; 54 | 55 | struct _mthread_s 56 | { 57 | pthread_t hThread; 58 | pthread_t hParentThread; 59 | mthread_result_t result; 60 | }; 61 | 62 | typedef struct _mthread_s mthread_t; 63 | 64 | struct _mthreadargs_s 65 | { 66 | mthread_t* pThread; 67 | mthreadentry_t pfActualEntry; 68 | mthread_result_t* pResult; 69 | S32 nPriority; 70 | I32 nPolicy; 71 | void* pActualArgs; 72 | }; 73 | 74 | typedef struct _mthreadargs_s mthreadargs_t; 75 | 76 | CCUR_PUBLIC(tresult_t) 77 | mthreadSetPriority( 78 | mthread_t* pThread, 79 | S32 nSchedPrio, 80 | I32 nPolicy); 81 | 82 | CCUR_PUBLIC(tresult_t) 83 | mthreadGetPriority( 84 | mthread_t* pThread, 85 | S32* pnPriority); 86 | 87 | CCUR_PUBLIC(tresult_t) 88 | mthreadWaitExit( 89 | mthread_t* pThread, 90 | mthread_result_t* pExitCode); 91 | 92 | CCUR_PUBLIC(tresult_t) 93 | mthreadCreateHelper( 94 | mthread_t* pThread, 95 | mthreadentry_t pfEntryRoutine, 96 | void* pThreadArgs, 97 | mthreadcreateattr_t* pThreadAttribs); 98 | 99 | CCUR_PUBLIC(tresult_t) 100 | mthreadCreate( 101 | mthread_t* phThread, 102 | mthreadentry_t pfEntryRoutine, 103 | I32 nStackSize, 104 | S32 nSchedPrio, 105 | I32 nSchedPolicy, 106 | void* pThreadArgs); 107 | 108 | #ifdef __cplusplus 109 | extern "C" { 110 | #endif 111 | #endif /* MTHREAD_H */ 112 | -------------------------------------------------------------------------------- /1.0/src/misc/tcregex.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include "helper.h" 18 | #include "evlog.h" 19 | #include "tcregex.h" 20 | 21 | tresult_t tcRegexInit(void) 22 | {return ESUCCESS;} 23 | 24 | CCUR_PROTECTED(tresult_t) 25 | tcRegexCompile( 26 | tc_regex_compile_t* rc) 27 | { 28 | tresult_t _result; 29 | const CHAR* _strPerr; 30 | I32 _nStrPerr; 31 | 32 | do 33 | { 34 | if('\0' == rc->strPattern[0]) 35 | { 36 | _result = ESUCCESS; 37 | /* Set default all to zero */ 38 | rc->pRegex->options = 0; 39 | rc->pRegex->nstartloc = 0; 40 | rc->pRegex->code = NULL; 41 | rc->pRegex->extra = NULL; 42 | break; 43 | } 44 | _result = EFAILURE; 45 | /* Set default all to zero */ 46 | rc->pRegex->options = 0; 47 | rc->pRegex->nstartloc = 0; 48 | /* Compile regex */ 49 | rc->pRegex->code = 50 | pcre_compile( 51 | rc->strPattern,rc->compileOptions, 52 | &_strPerr,&_nStrPerr,rc->pTableptr); 53 | 54 | if(NULL == 55 | rc->pRegex->code) 56 | { 57 | #if 0 58 | evLogTraceSys( 59 | evLogLvlError, 60 | "ERROR: Could not compile '%s': %s\n", 61 | rc->strPattern, 62 | _strPerr); 63 | #endif 64 | break; 65 | } 66 | _strPerr = NULL; 67 | /* Optimize the regex. 68 | * Returns NULL for both errors and 69 | * when it can not optimize regex. */ 70 | rc->pRegex->extra = 71 | pcre_study(rc->pRegex->code, 72 | rc->stdyOptions, 73 | &_strPerr); 74 | if(_strPerr) 75 | { 76 | #if 0 77 | evLogTraceSys( 78 | evLogLvlError, 79 | "ERROR: Could not study '%s': %s\n", 80 | rc->strPattern, 81 | _strPerr); 82 | #endif 83 | break; 84 | } 85 | _result = ESUCCESS; 86 | }while(FALSE); 87 | 88 | return _result; 89 | } 90 | -------------------------------------------------------------------------------- /1.0/src/misc/tcregex.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef TCREGEX_H_ 18 | #define TCREGEX_H_ 19 | 20 | struct _tc_regex_s 21 | { 22 | pcre* code; 23 | pcre_extra* extra; 24 | I32 options; 25 | I32 nstartloc; 26 | }; 27 | typedef struct _tc_regex_s 28 | tc_regex_t; 29 | 30 | struct _tc_regex_compile_s 31 | { 32 | CHAR* strPattern; 33 | I32 compileOptions; 34 | I32 stdyOptions; 35 | tc_regex_t* pRegex; 36 | U8* pTableptr; 37 | }; 38 | typedef struct _tc_regex_compile_s 39 | tc_regex_compile_t; 40 | 41 | CCUR_PROTECTED(tresult_t) 42 | tcRegexInit(void); 43 | 44 | CCUR_PROTECTED(tresult_t) 45 | tcRegexCompile( 46 | tc_regex_compile_t* rc); 47 | 48 | #define tcRegexCopySubstring \ 49 | pcre_copy_substring 50 | 51 | #define tcRegexExec(re,sdata,sndata, ovector, ovectorsize) \ 52 | pcre_exec(re->code, re->extra, \ 53 | sdata, sndata, \ 54 | re->nstartloc, re->options, \ 55 | ovector, ovectorsize) 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/Makefile: -------------------------------------------------------------------------------- 1 | ################################################################################### 2 | ################################################################################### 3 | ECHO=echo 4 | SNMP_CONF_PATH=/etc/snmp 5 | INIT_PATH=/etc/init.d 6 | MIB_PATH=/usr/share/snmp/mibs 7 | SBIN_PATH=/usr/local/sbin 8 | 9 | .PHONEY: all clean 10 | 11 | all: 12 | $(ECHO) "building util_source" 13 | cd util_source; make 14 | $(ECHO) "building main_source" 15 | cd main_source; make 16 | 17 | clean: 18 | $(ECHO) "cleaning util_source" 19 | cd util_source; make clean 20 | $(ECHO) "building main_source" 21 | cd main_source; make clean 22 | cd bin; rm -f tcache_agentx 23 | 24 | install: 25 | cp -b conf/snmpd.conf $(SNMP_CONF_PATH) 26 | cp -b rc.d/tcache_agentx $(INIT_PATH) 27 | cp -b mib/TCACHE-MIB.txt $(MIB_PATH) 28 | cp bin/tcache_agentx $(SBIN_PATH) 29 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/conf/local.conf: -------------------------------------------------------------------------------- 1 | /usr/local/lib 2 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/doc/README: -------------------------------------------------------------------------------- 1 | Required libraries == libsnmp-base, libsnmp-dev, libsnmp-perl, libsnmp15, libsnmp15-dbg, snmp, snmpd, 2 | zeromq, czmq. 3 | 4 | Required yum packages 5 | 6 | net-snmp.x86_64 7 | net-snmp-devel.x86_64 8 | net-snmp-libs.x86_64 9 | net-snmp-utils.x86_64 10 | kernel-devel.x86_64 11 | numactl.x86_64 12 | 13 | Need devtoolset-1.1-libstdc++-devel-4.7.2-5.el6.x86_64 installed. 14 | 15 | Need to register service for snmpd and tcache_agentx: 16 | chkconfig --level 2345 snmpd on 17 | chkconfig --level 2345 tcache_agentx on 18 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/doc/info.txt: -------------------------------------------------------------------------------- 1 | For SNMP, I think we’d like to see the following: 2 | 3 | 4 | 5 | Status of the control plane (i.e. is it running, does it have some sort of error condition) 6 | 7 | 8 | 9 | Amount of traffic monitored in last 24 hours, hour, minute 10 | 11 | 12 | 13 | Number of interceptions (i.e. redirects) performed in last 24 hours, hour, minute 14 | 15 | ----------------------------------------------------------------------------------------------- 16 | 17 | Tally of top domains (e.g. Youtube, Netflix, Apple) seen in last 24 hours, hour, minute 18 | 19 | 20 | 21 | Tally of top domains intercepted in last 24 hours, hour, minute 22 | 23 | 24 | 25 | Tally of top video formats seen in last 24 hours, hour, minute 26 | 27 | 28 | 29 | Tally of top video formats intercepted in last 24 hours, hour, minute 30 | 31 | 32 | 33 | Tally of top client devices seen in last 24 hours, hour, minute 34 | 35 | 36 | 37 | Tally of top client devices intercepted in last 24 hours, hour, minute 38 | 39 | 40 | 41 | Tally of top client device types, similar to the tally of top domains 42 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/main_source/Makefile: -------------------------------------------------------------------------------- 1 | #CXX=/opt/centos/devtoolset-1.1/root/usr/bin/c++ 2 | CXX=g++ 3 | 4 | NETSNMPCONFIG=net-snmp-config 5 | 6 | NETSNMPCFLAGS := $(shell $(NETSNMPCONFIG) --base-cflags) 7 | NETSNMPLIBS := $(shell $(NETSNMPCONFIG) --agent-libs) 8 | LDFLAGS=-lzmq -lczmq -lpthread 9 | 10 | STRICT_FLAGS = -Wall 11 | CFLAGS=-I. $(NETSNMPCFLAGS) $(STRICT_FLAGS) -std=gnu++11 12 | 13 | all: ../bin/tcache_agentx 14 | 15 | .PHONEY: all clean 16 | 17 | OBJS = tcache_agentx.o clientTable.o clientRedirectTable.o \ 18 | clientTopDeviceTable.o videoTable.o videoRedirectTable.o \ 19 | domainTable.o domainRedirectTable.o redirectedServiceTable.o \ 20 | tcPlaneStatus.o trafficCount.o redirectCount.o maxTableXmit.o \ 21 | edgeProbeDuration.o tablePurgeDuration.o tcPlaneStartTime.o \ 22 | tcPlaneVersion.o modeTable.o 23 | 24 | tcPlaneStatus.o: tcache_agentx.h ../util_source/io_rtns.o 25 | 26 | trafficCount.o: tcache_agentx.h ../util_source/io_rtns.o 27 | 28 | redirectCount.o: tcache_agentx.h ../util_source/io_rtns.o 29 | 30 | clientTable.o: clientTable.h tcache_agentx.h ../util_source/io_rtns.o 31 | 32 | clientRedirectTable.o: clientRedirectTable.h tcache_agentx.h ../util_source/io_rtns.o 33 | 34 | clientTopDeviceTable.o: clientTopDeviceTable.h tcache_agentx.h ../util_source/io_rtns.o 35 | 36 | videoTable.o: videoTable.h tcache_agentx.h 37 | 38 | videoRedirectTable.o: videoRedirectTable.h tcache_agentx.h 39 | 40 | domainTable.o: domainTable.h tcache_agentx.h 41 | 42 | domainRedirectTable.o: domainRedirectTable.h tcache_agentx.h 43 | 44 | redirectedServiceTable.o: redirectedServiceTable.h tcache_agentx.h 45 | 46 | maxTableXmit.o: maxTableXmit.h tcache_agentx.h 47 | 48 | edgeProbeDuration.o: edgeProbeDuration.h tcache_agentx.h 49 | 50 | tablePurgeDuration.o: tablePurgeDuration.h tcache_agentx.h 51 | 52 | tcPlaneStartTime.o: tcPlaneStartTime.h tcache_agentx.h 53 | 54 | tcPlaneVersion.o: tcPlaneVersion.h tcache_agentx.h 55 | 56 | modeTable.o: modeTable.h tcache_agentx.h 57 | 58 | tcache_agentx.o: clientTable.h clientRedirectTable.h clientTopDeviceTable.h \ 59 | videoTable.h videoRedirectTable.h domainTable.h domainRedirectTable.h redirectedServiceTable.h\ 60 | tcPlaneStatus.h trafficCount.h redirectCount.h tcache_agentx.h ../util_source/tcp_rtns.h \ 61 | maxTableXmit.h edgeProbeDuration.h tablePurgeDuration.h tcPlaneStartTime.h tcPlaneVersion.h modeTable.h 62 | 63 | %.o: %.cpp 64 | $(CXX) -c $(CFLAGS) -o $@ $< 65 | 66 | ../bin/tcache_agentx: $(OBJS) 67 | $(CXX) $(NETSNMPLIBS) $(LDFLAGS) $(OBJS) ../util_source/io_rtns.o ../util_source//tcp_rtns.o -o $@ 68 | 69 | clean: 70 | rm -f *.o 71 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/main_source/clientRedirectTable.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef CLIENT_REDIRECT_TABLE_H 18 | #define CLIENT_REDIRECT_TABLE_H 19 | 20 | bool init_clientRedirectTable(void); 21 | 22 | #define COLUMN_CLIENT_REDIRECT_IDX 1 23 | #define COLUMN_CLIENT_REDIRECT 2 24 | #define COLUMN_CLIENT_REDIRECT_COUNT 3 25 | 26 | //*********************************************************************** 27 | // TCACHE-MIB::clientRedirectTable of transCacheControlPlane. 28 | // Its status is Current. 29 | // OID: .1.3.6.1.4.1.1457.4.1.1.10, length: 11 30 | //*********************************************************************** 31 | struct clientRedirectTable_data_s 32 | { 33 | long clientRedirectIdx; 34 | char clientRedirect[64]; 35 | unsigned long clientRedirectCount; 36 | }; 37 | 38 | typedef struct clientRedirectTable_data_s clientRedirectTable_t; 39 | 40 | #endif // CLIENT_REDIRECT_TABLE_H 41 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/main_source/clientTable.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef CLIENT_TABLE_H 18 | #define CLIENT_TABLE_H 19 | 20 | bool init_clientTable(void); 21 | 22 | #define COLUMN_CLIENT_IDX 1 23 | #define COLUMN_CLIENT 2 24 | #define COLUMN_CLIENT_COUNT 3 25 | 26 | //***************************************************************** 27 | // TCACHE-MIB::clientTable of transCacheControlPlane. 28 | // Its status is Current. 29 | // OID: .1.3.6.1.4.1.1457.4.1.1.9, length: 11 30 | //***************************************************************** 31 | struct clientTable_data_s 32 | { 33 | long clientIdx; 34 | char client[64]; 35 | unsigned long clientCount; 36 | }; 37 | 38 | typedef struct clientTable_data_s clientTable_t; 39 | 40 | #endif // CLIENT_TABLE_H 41 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/main_source/clientTopDeviceTable.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef CLIENT_TOPDEVICE_TABLE_H 18 | #define CLIENT_TOPDEVICE_TABLE_H 19 | 20 | bool init_clientTopDeviceTable(void); 21 | 22 | #define COLUMN_CLIENT_TOPDEVICE_IDX 1 23 | #define COLUMN_CLIENT_TOPDEVICE 2 24 | #define COLUMN_CLIENT_TOPDEVICE_COUNT 3 25 | 26 | //*********************************************************************** 27 | // TCACHE-MIB::clientTopDeviceTable of transCacheControlPlane. 28 | // Its status is Current. 29 | // OID: .1.3.6.1.4.1.1457.4.1.1.11, length: 11 30 | //*********************************************************************** 31 | struct clientTopDeviceTable_data_s 32 | { 33 | long clientTopDeviceIdx; 34 | char clientTopDevice[64]; 35 | unsigned long clientTopDeviceCount; 36 | }; 37 | 38 | typedef struct clientTopDeviceTable_data_s clientTopDeviceTable_t; 39 | 40 | #endif // CLIENT_TOPDEVICE_TABLE_H 41 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/main_source/domainRedirectTable.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DOMAIN_REDIRECT_TABLE_H 18 | #define DOMAIN_REDIRECT_TABLE_H 19 | 20 | bool init_domainRedirectTable(void); 21 | 22 | #define COLUMN_DOMAIN_REDIRECT_IDX 1 23 | #define COLUMN_DOMAIN_REDIRECT 2 24 | #define COLUMN_DOMAIN_REDIRECT_COUNT 3 25 | 26 | //*********************************************************************** 27 | // TCACHE-MIB::domainRedirectTable of transCacheControlPlane. 28 | // Its status is Current. 29 | // OID: .1.3.6.1.4.1.1457.4.1.1.6, length: 11 30 | //*********************************************************************** 31 | struct domainRedirectTable_data_s 32 | { 33 | long domainRedirectIdx; 34 | char domainRedirect[64]; 35 | unsigned long domainRedirectCount; 36 | }; 37 | 38 | typedef struct domainRedirectTable_data_s domainRedirectTable_t; 39 | 40 | #endif // DOMAIN_REDIRECT_TABLE_H 41 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/main_source/domainTable.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DOMAIN_TABLE_H 18 | #define DOMAIN_TABLE_H 19 | 20 | bool init_domainTable(void); 21 | 22 | #define COLUMN_DOMAIN_IDX 1 23 | #define COLUMN_DOMAIN 2 24 | #define COLUMN_DOMAIN_COUNT 3 25 | 26 | //*********************************************************************** 27 | // TCACHE-MIB::domainTable of transCacheControlPlane. 28 | // Its status is Current. 29 | // OID: .1.3.6.1.4.1.1457.4.1.1.5, length: 11 30 | //*********************************************************************** 31 | struct domainTable_data_s 32 | { 33 | long domainIdx; 34 | char domain[64]; 35 | unsigned long domainCount; 36 | }; 37 | 38 | typedef struct domainTable_data_s domainTable_t; 39 | 40 | #endif // DOMAIN_TABLE_H 41 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/main_source/edgeProbeDuration.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef EDGE_PROBE_DURATION_H 18 | #define EDGE_PROBE_DURATION_H 19 | 20 | bool init_edgeProbeDuration(void); 21 | 22 | #endif // EDGE_PROBE_DURATION_H 23 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/main_source/maxTableXmit.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef MAX_TABLE_XMIT_H 18 | #define MAX_TABLE_XMIT_H 19 | 20 | bool init_maxTableXmit(void); 21 | 22 | #endif // MAX_TABLE_XMIT_H 23 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/main_source/modeTable.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef MODE_TABLE_H 18 | #define MODE_TABLE_H 19 | 20 | bool init_modeTable(void); 21 | 22 | #define COLUMN_MODE_IDX 1 23 | #define COLUMN_MODE 2 24 | #define COLUMN_MODE_COUNT 3 25 | 26 | //***************************************************************** 27 | // TCACHE-MIB::modeTable of transCacheControlPlane. 28 | // Its status is Current. 29 | // OID: .1.3.6.1.4.1.1457.4.1.1.18, length: 11 30 | //***************************************************************** 31 | struct modeTable_data_s 32 | { 33 | long modeIdx; 34 | char mode[64]; 35 | }; 36 | 37 | typedef struct modeTable_data_s modeTable_t; 38 | 39 | #endif // MODE_TABLE_H 40 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/main_source/redirectCount.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef REDIRECT_COUNT_H 18 | #define REDIRECT_COUNT_H 19 | 20 | bool init_redirectCount(void); 21 | 22 | #endif // REDIRECT_COUNT_H 23 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/main_source/redirectedServiceTable.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef REDIRECTED_SERVICE_TABLE_H 18 | #define REDIRECT_SERVICE_TABLE_H 19 | 20 | bool init_redirectedServiceTable(void); 21 | 22 | #define COLUMN_REDIRECTED_SERVICE_IDX 1 23 | #define COLUMN_REDIRECTED_SERVICE 2 24 | #define COLUMN_REDIRECTED_SERVICE_COUNT 3 25 | 26 | //************************************************************************* 27 | // TCACHE-MIB::redirectedServiceTable of transCacheControlPlane. 28 | // Its status is Current. 29 | // OID: .1.3.6.1.4.1.1457.4.1.1.12, length: 11 30 | //************************************************************************* 31 | struct redirectedServiceTable_data_s 32 | { 33 | long redirectedServiceIdx; 34 | char redirectedService[256]; 35 | unsigned long redirectedServiceCount; 36 | }; 37 | 38 | typedef struct redirectedServiceTable_data_s redirectedServiceTable_t; 39 | 40 | #endif // REDIRECTED_SERVICE_TABLE_H 41 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/main_source/tablePurgeDuration.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef TABLE_PURGE_DURATION_H 18 | #define TABLE_PURGE_DURATION_H 19 | 20 | bool init_tablePurgeDuration(void); 21 | 22 | #endif // TABLE_PURGE_DURATION_H 23 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/main_source/tcPlaneStartTime.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef TCPLANE_START_TIME_H 18 | #define TCPLANE_START_TIME_H 19 | 20 | bool init_tcPlaneStartTime(void); 21 | 22 | #endif // TCPLANE_START_TIME_H 23 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/main_source/tcPlaneStatus.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef TCPLANE_STATUS_H 18 | #define TCPLANE_STATUS_H 19 | 20 | bool init_tcPlaneStatus(void); 21 | 22 | #endif // TCPLANE_STATUS_H 23 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/main_source/tcPlaneVersion.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef TCPLANE_VERSION_H 18 | #define TCPLANE_VERSION_H 19 | 20 | bool init_tcPlaneVersion(void); 21 | 22 | #endif // TCPLANE_VERSION_H 23 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/main_source/tcache_agentx.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef TCACHE_AGENTX_H 18 | #define TCACHE_AGENTX_H 1 19 | 20 | enum { READ_TIMEOUT = 500, HTTP_SERVICE = 80, MGT_SERVICE = 5554, TCPLANE_SERVICE }; 21 | 22 | enum { status, trafficCount, redirectCount, domainTable, domainRedirectTable, 23 | videoTable, videoRedirectTable, clientTable, clientRedirectTable, 24 | clientTopDeviceTable, rereadCplaneConfig, redirectedServiceTable, 25 | getMaxTableXmit, setMaxTableXmit, getEdgeProbeDuration, setEdgeProbeDuration, 26 | getTablePurgeDuration, setTablePurgeDuration, startTime, version, modeTable }; 27 | 28 | #endif // TCACHE_AGENT_X 29 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/main_source/trafficCount.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef TRAFFIC_COUNT_H 18 | #define TRAFFIC_COUNT_H 19 | 20 | bool init_trafficCount(void); 21 | 22 | #endif // TRAFFIC_COUNT_H 23 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/main_source/videoRedirectTable.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef VIDEO_REDIRECT_TABLE_H 18 | #define VIDEO_REDIRECT_TABLE_H 19 | 20 | bool init_videoRedirectTable(void); 21 | 22 | #define COLUMN_VIDEO_REDIRECT_IDX 1 23 | #define COLUMN_VIDEO_REDIRECT 2 24 | #define COLUMN_VIDEO_REDIRECT_COUNT 3 25 | 26 | //*********************************************************************** 27 | // TCACHE-MIB::videoRedirectTable of transCacheControlPlane. 28 | // Its status is Current. 29 | // OID: .1.3.6.1.4.1.1457.4.1.1.8, length: 11 30 | //*********************************************************************** 31 | struct videoRedirectTable_data_s 32 | { 33 | long videoRedirectIdx; 34 | char videoRedirect[64]; 35 | unsigned long videoRedirectCount; 36 | }; 37 | 38 | typedef struct videoRedirectTable_data_s videoRedirectTable_t; 39 | 40 | #endif // VIDEO_REDIRECT_TABLE_H 41 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/main_source/videoTable.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef VIDEO_TABLE_H 18 | #define VIDEO_TABLE_H 19 | 20 | bool init_videoTable(void); 21 | 22 | #define COLUMN_VIDEO_IDX 1 23 | #define COLUMN_VIDEO 2 24 | #define COLUMN_VIDEO_COUNT 3 25 | 26 | //*********************************************************************** 27 | // TCACHE-MIB::videoTable of transCacheControlPlane. 28 | // Its status is Current. 29 | // OID: .1.3.6.1.4.1.1457.4.1.1.7, length: 11 30 | //*********************************************************************** 31 | struct videoTable_data_s 32 | { 33 | long videoIdx; 34 | char video[64]; 35 | unsigned long videoCount; 36 | }; 37 | 38 | typedef struct videoTable_data_s videoTable_t; 39 | 40 | #endif // VIDEO_TABLE_H 41 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/rc.d/tcache_agentx: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # /etc/rc.d/init.d/tcache_agentx 4 | # 5 | # Starts the tcache_agentx 6 | # 7 | # chkconfig: - 95 5 8 | # description: starts Conncurrent Transparent Caching agentx daemon. 9 | # processname: tcache_agentx 10 | 11 | # Source function library. 12 | . /etc/init.d/functions 13 | 14 | # set -x 15 | 16 | BINPATH="/usr/local/sbin" 17 | 18 | test -x $BINPATH/tcache_agentx || exit 0 19 | 20 | RETVAL=0 21 | 22 | prog="tcache_agentx" 23 | 24 | start() { 25 | ulimit -S -c unlimited >/dev/null 2>&1 26 | # Check if tcache_agentx is already running 27 | if [ ! -f /var/lock/subsys/tcache_agentx ]; then 28 | echo -n $"Starting $prog: " 29 | # daemon $BINPATH/tcache_agentx -l7; # level 7 -debug mode 30 | daemon $BINPATH/tcache_agentx 31 | RETVAL=$? 32 | [ $RETVAL -eq 0 ] && (success; touch /var/lock/subsys/tcache_agentx) || failure; 33 | echo 34 | fi 35 | return $RETVAL 36 | } 37 | 38 | stop() { 39 | echo -n $"Stopping $prog: " 40 | killproc /usr/local/bin/tcache_agentx 41 | RETVAL=$? 42 | [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/tcache_agentx 43 | echo 44 | return $RETVAL 45 | } 46 | 47 | restart() { 48 | stop 49 | start 50 | } 51 | 52 | reload() { 53 | restart 54 | } 55 | 56 | status_at() { 57 | status $BINPATH/tcache_agentx 58 | } 59 | 60 | case "$1" in 61 | start) 62 | start 63 | ;; 64 | stop) 65 | stop 66 | ;; 67 | reload|restart) 68 | restart 69 | ;; 70 | condrestart) 71 | if [ -f /var/lock/subsys/tcache_agentx ]; then 72 | restart 73 | fi 74 | ;; 75 | status) 76 | status_at 77 | ;; 78 | *) 79 | echo $"Usage: $0 {start|stop|restart|condrestart|status}" 80 | exit 1 81 | esac 82 | 83 | exit $RETVAL 84 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/snmp-scripts/clientRedirectTable.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | snmpwalk -Os -c private -v1 localhost 1.3.6.1.4.1.1457.4.1.1.10 4 | exit 0 5 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/snmp-scripts/clientTable.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | snmpwalk -Os -c private -v1 localhost 1.3.6.1.4.1.1457.4.1.1.9 4 | exit 0 5 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/snmp-scripts/clientTopDevice.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | snmpwalk -Os -c private -v1 localhost 1.3.6.1.4.1.1457.4.1.1.11 4 | exit 0 5 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/snmp-scripts/domainRedirectTable.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | snmpwalk -Os -c private -v1 localhost 1.3.6.1.4.1.1457.4.1.1.6 4 | exit 0 5 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/snmp-scripts/domainTable.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | snmpwalk -Os -c private -v1 localhost 1.3.6.1.4.1.1457.4.1.1.5 4 | exit 0 5 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/snmp-scripts/get_edgeProbeDuration.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | snmpget -Os -c private -v2c localhost 1.3.6.1.4.1.1457.4.1.1.14.0 4 | exit 0 5 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/snmp-scripts/get_maxTableXmit.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | snmpget -Os -c private -v2c localhost 1.3.6.1.4.1.1457.4.1.1.13.0 4 | exit 0 5 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/snmp-scripts/get_tablePurgeDuration.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | snmpget -Os -c private -v2c localhost 1.3.6.1.4.1.1457.4.1.1.15.0 4 | exit 0 5 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/snmp-scripts/modeTable.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | snmpwalk -Os -c private -v1 localhost 1.3.6.1.4.1.1457.4.1.1.18 4 | exit 0 5 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/snmp-scripts/redirectCount.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | snmpget -Os -c private -v2c localhost 1.3.6.1.4.1.1457.4.1.1.4.0 4 | exit 0 5 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/snmp-scripts/redirectedServiceTable.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | snmpwalk -Os -c private -v1 localhost 1.3.6.1.4.1.1457.4.1.1.12 4 | exit 0 5 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/snmp-scripts/set_edgeProbeDuration.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | snmpset -Os -c private -v2c localhost TCACHE-MIB::edgeProbeDuration.0 u 20 4 | exit 0 5 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/snmp-scripts/set_maxTableXmit.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | snmpset -Os -c private -v2c localhost TCACHE-MIB::maxTableXmit.0 u 20 4 | exit 0 5 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/snmp-scripts/set_tablePurgeDuration.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | snmpset -Os -c private -v2c localhost TCACHE-MIB::tablePurgeDuration.0 u 900 4 | exit 0 5 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/snmp-scripts/tcs_mode.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | snmpget -Os -c private -v2c localhost 1.3.6.1.4.1.1457.4.1.1.18.0 4 | exit 0 5 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/snmp-scripts/tcs_starttime.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | snmpget -Os -c private -v2c localhost 1.3.6.1.4.1.1457.4.1.1.16.0 4 | exit 0 5 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/snmp-scripts/tcs_version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | snmpget -Os -c private -v2c localhost 1.3.6.1.4.1.1457.4.1.1.17.0 4 | exit 0 5 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/snmp-scripts/trafficCount.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | snmpget -Os -c private -v2c localhost 1.3.6.1.4.1.1457.4.1.1.3.0 4 | exit 0 5 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/snmp-scripts/transcStatus.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | snmpget -Os -c private -v2c localhost 1.3.6.1.4.1.1457.4.1.1.2.0 4 | exit 0 5 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/snmp-scripts/videoRedirectTable.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | snmpwalk -Os -c private -v1 localhost 1.3.6.1.4.1.1457.4.1.1.8 4 | exit 0 5 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/snmp-scripts/videoTable.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | snmpwalk -Os -c private -v1 localhost 1.3.6.1.4.1.1457.4.1.1.7 4 | exit 0 5 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/systemd/tcache_agentx.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=TransparentCaching snmp agentx daemon 3 | After=syslog.target 4 | After=network.target 5 | 6 | [Service] 7 | Type=forking 8 | # -l7 == debug logging - only use one of the Exec Start 9 | # ExecStart=/usr/local/sbin/tcache_agentx -l7 10 | ExecStart=/usr/local/sbin/tcache_agentx 11 | 12 | # Give a reasonable amount of time for the server to start up/shut down 13 | TimeoutSec=300 14 | 15 | [Install] 16 | WantedBy=multi-user.target 17 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/tcplane_simulator/Makefile: -------------------------------------------------------------------------------- 1 | CC=/opt/centos/devtoolset-1.1/root/usr/bin/gcc 2 | CC=gcc 3 | # CXX=/opt/centos/devtoolset-1.1/root/usr/bin/g++ 4 | CXX=g++ 5 | 6 | STRICT_FLAGS = -Wall 7 | CXXFLAGS=$(STRICT_FLAGS) -std=gnu++11 8 | # LDFLAGS=-lpthread -ljansson -lzmq -lczmq -lcurl -lstdc++ -lm 9 | LDFLAGS=-lpthread -ljansson -lzmq -lczmq -lcurl 10 | 11 | .PHONEY: all clean 12 | 13 | all: tcplane_simulator 14 | 15 | # dummy_code.o: dummy_code.c dummy_code.h 16 | # $(CC) -c $(CFLAGS) -o $@ $< 17 | 18 | edge_status.o: edge_status.c edge_status.h 19 | $(CXX) -c $(CFLAGS) -o $@ $< 20 | 21 | tcplane_snmp.o: tcplane_snmp.cpp tcplane_snmp.h 22 | $(CXX) -c $(CXXFLAGS) -o $@ $< 23 | 24 | tcplane_simulator.o: tcplane_simulator.c 25 | $(CXX) -c $(CXXFLAGS) -o $@ $< 26 | 27 | tcplane_simulator: tcplane_snmp.o edge_status.o dummy_code.o tcplane_simulator.o 28 | $(CXX) $(LDFLAGS) -o $@ $^ 29 | 30 | clean: 31 | rm -f *.o tcplane_simulator 32 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/tcplane_simulator/dummy_code.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | #include "dummy_code.h" 21 | 22 | //********************************************************************** 23 | //********************************************************************** 24 | char * tcBkgrndGetRedirAddr(tc_gd_thread_ctxt_t * pCntx, char * ip, 25 | size_t size) 26 | { 27 | strcpy(ip, "127.0.0.1"); 28 | return ip; 29 | } 30 | 31 | //********************************************************************** 32 | //********************************************************************** 33 | int tcBkgrndReLoadCfg(tc_gd_thread_ctxt_t * pCntx) 34 | { 35 | return 1; 36 | } 37 | 38 | //********************************************************************** 39 | //********************************************************************** 40 | int tcBkgrndGetTrSts(tc_gd_thread_ctxt_t * pCntx) 41 | { 42 | return 1; 43 | } 44 | 45 | //********************************************************************** 46 | //********************************************************************** 47 | void evLogTraceSys(int level, const char * fmt, const char * msg) 48 | { 49 | char buffer[96]; 50 | sprintf(buffer, fmt, msg); 51 | printf(buffer); printf("\n"); 52 | return; 53 | } 54 | 55 | //********************************************************************** 56 | //********************************************************************** 57 | void tcBkgrndSetRedirNode(tc_gd_thread_ctxt_t * _pCntx, int state) 58 | { 59 | return; 60 | } 61 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/tcplane_simulator/dummy_code.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef DUMMY_CODE_H 18 | #define DUMMY_CODE_H 1 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | #define evLogLvlDebug 1 25 | 26 | #define ESUCCESS 1 27 | 28 | typedef void * tc_gd_thread_ctxt_t; 29 | 30 | int tcBkgrndReLoadCfg(tc_gd_thread_ctxt_t * pCntx); 31 | 32 | int tcBkgrndGetTrSts(tc_gd_thread_ctxt_t * pCntx); 33 | 34 | char * tcBkgrndGetRedirAddr(tc_gd_thread_ctxt_t * pCntx, char * ip, size_t size); 35 | 36 | void evLogTraceSys(int level, const char * fmt, const char * msg); 37 | 38 | void tcBkgrndSetRedirNode(tc_gd_thread_ctxt_t * _pCntx, int state); 39 | 40 | #ifdef __cplusplus 41 | } // closing brace for extern "C" 42 | #endif 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/tcplane_simulator/edge_status.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef EDGE_STATUS_H 18 | #define EDGE_STATUS_H 1 19 | 20 | #include "tcgendefn.h" 21 | #include "tcbkgrnd.h" 22 | 23 | #include "dummy_code.h" 24 | 25 | int16_t edge_status(tc_gd_thread_ctxt_t * _pCntx); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/tcplane_simulator/tcbkgrnd.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/concurrentlabs/laguna/d8036889885217881da686eb54bf8419e06d8ce4/1.0/src/tcache_agentx/tcplane_simulator/tcbkgrnd.h -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/tcplane_simulator/tcgendefn.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/concurrentlabs/laguna/d8036889885217881da686eb54bf8419e06d8ce4/1.0/src/tcache_agentx/tcplane_simulator/tcgendefn.h -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/tcplane_simulator/tcplane_simulator.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | extern "C" void * tcplane_snmp(void * context); 20 | 21 | //**************************************************************************** 22 | //**************************************************************************** 23 | int main(int argc, char ** argv) 24 | { 25 | pthread_t tid1; 26 | 27 | pthread_create(&tid1, NULL, tcplane_snmp, NULL); 28 | pthread_join(tid1, NULL); 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/tcplane_simulator/tcplane_snmp.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef TCPLANE_SNMP_H 18 | #define TCPLANE_SNMP_H 1 19 | 20 | #include 21 | #include 22 | 23 | enum { STATUS, TRAFFIC_COUNT, REDIRECT_COUNT, DOMAIN_TABLE, DOMAIN_REDIRECT_TABLE, 24 | VIDEO_TABLE, VIDEO_REDIRECT_TABLE, CLIENT_TABLE, CLIENT_REDIRECT_TABLE, 25 | CLIENT_TOP_DEVICE_TABLE, READ_CPLANE_CONFIG, REDIRECTED_SERVICE_TABLE, 26 | GET_MAX_TABLE_XMIT, SET_MAX_TABLE_XMIT, GET_EDGE_PROBE_DURATION, SET_EDGE_PROBE_DURATION, 27 | GET_TABLE_PURGE_DURATION, SET_TABLE_PURGE_DURATION, START_TIME, VERSION, MODE, 28 | AGENTX_SERVICE = 5555 }; 29 | 30 | enum { MONITOR = 0, ACTIVE }; 31 | 32 | typedef std::pair value_t; 33 | 34 | typedef std::unordered_map table_t; 35 | 36 | //***************************************************************************************** 37 | //***************************************************************************************** 38 | class snmp_processor 39 | { 40 | public: 41 | snmp_processor() : m_traffic_count(0), m_redirect_count(0), m_max_table_xmit(50), 42 | m_edge_probe_duration(30), m_table_purge_duration(1800), m_start_time(time(NULL)), 43 | m_version("INVALID") { } 44 | 45 | void read_queue(void); 46 | void handl_agentx_event(tc_gd_thread_ctxt_t* pCntx, char * raw_request, void * sock); 47 | void transmit_table(table_t & table, void *sock); 48 | void insert_or_update_table(table_t & table, std::string & key); 49 | void purge_tables(void); 50 | void purge_table(table_t & table); 51 | void print_table(table_t & table); 52 | 53 | void set_maxTableXmit(uint32_t count) 54 | { m_max_table_xmit = count; return; } 55 | 56 | void set_edgeProbeDuration(double duration) 57 | { m_edge_probe_duration = duration; return; } 58 | 59 | void set_tablePurgeDuration(double duration) 60 | { m_table_purge_duration = duration; return; } 61 | 62 | void set_mode(void * context, const unsigned short m); 63 | 64 | double edge_probe_duration(void) { return m_edge_probe_duration; } 65 | double table_purge_duration(void) { return m_table_purge_duration; } 66 | 67 | private: 68 | table_t domain_table; 69 | table_t domain_redirect_table; 70 | table_t client_table; 71 | table_t client_redirect_table; 72 | table_t redirected_service_table; 73 | #ifdef __UNSUPPORTED_TABLES__ 74 | table_t client_top_device_table; 75 | table_t video_table; 76 | table_t video_redirect_table; 77 | #endif 78 | 79 | uint32_t m_traffic_count; 80 | uint32_t m_redirect_count; 81 | uint32_t m_max_table_xmit; 82 | 83 | double m_edge_probe_duration; 84 | double m_table_purge_duration; 85 | 86 | time_t m_start_time; 87 | std::string m_version; 88 | }; 89 | 90 | #endif // TCPLANE_SNMP_H 91 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/tcplane_simulator/tcplane_snmp_mutex.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef TCPLANE_SNMP_H 18 | #define TCPLANE_SNMP_H 1 19 | 20 | #define STATUS 0 21 | #define TRAFFIC_COUNT 1 22 | #define REDIRECT_COUNT 2 23 | #define DOMAIN_TABLE 3 24 | #define DOMAIN_REDIRECT_TABLE 4 25 | #define VIDEO_TABLE 5 26 | #define VIDEO_REDIRECT_TABLE 6 27 | #define CLIENT_TABLE 7 28 | #define CLIENT_REDIRECT_TABLE 8 29 | #define CLIENT_TOP_DEVICE_TABLE 9 30 | #define READ_CPLANE_CONFIG 10 31 | #define REDIRECTED_SERVICE_TABLE 11 32 | 33 | #define AGENTX_SERVICE 5555 34 | 35 | void * tcplane_snmp(void * context); 36 | 37 | void increment_traffic_count(void); 38 | void increment_redirect_count(void); 39 | 40 | void update_traffic_count(unsigned long value); 41 | void update_redirect_count(unsigned long value); 42 | 43 | void increment_domainTable(char * key); 44 | void increment_domainRedirectTable(char * key); 45 | void increment_videoTable(char * key); 46 | void increment_videoRedirectTable(char * key); 47 | void increment_clientTable(char * key); 48 | void increment_clientRedirectTable(char * key); 49 | void increment_clientTopDeviceTable(char * key); 50 | void increment_clientdomainTable(char* keyclient, char * keydomain); 51 | 52 | void update_domainTable(char * key, unsigned long value); 53 | void update_domainRedirectTable(char * key, unsigned long value); 54 | void update_videoTable(char * key, unsigned long value); 55 | void update_videoRedirectTable(char * key, unsigned long value); 56 | void update_clientTable(char * key, unsigned long value); 57 | void update_clientRedirectTable(char * key, unsigned long value); 58 | void update_clientTopDeviceTable(char * key, unsigned long value); 59 | 60 | void destroy_snmp_tables(void); 61 | 62 | int svcredirect_init_table(void); 63 | void svcredirect_set_svc(char * strSvcName); 64 | void increment_redirectedTable(char* srcAddr,char* strHostName,char * strSvcName); 65 | void increment_redirectedServiceTable(char * strSvcName); 66 | 67 | #endif // TCPLANE_SNMP_H 68 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/util_source/Makefile: -------------------------------------------------------------------------------- 1 | #CXX=/opt/centos/devtoolset-1.1/root/usr/bin/c++ 2 | CXX = g++ 3 | LIB = ..//lib 4 | OBJS = io_rtns.o tcp_rtns.o 5 | 6 | CFLAGS=-O3 -m64 -Wall -Werror -D_REENTRANT -std=gnu++11 7 | 8 | # all: $(LIB)/libtcutils.a 9 | all: $(OBJS) 10 | 11 | .PHONEY: all clean 12 | 13 | $(LIB)/libtcutils.a: $(IO_OBJS) 14 | ar -r $@ $(IO_OBJS) 15 | ranlib $@ 16 | 17 | %.o: %.cpp 18 | $(CXX) -c $(CFLAGS) -o $@ $< 19 | 20 | clean: 21 | rm -rf *.o 22 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/util_source/io_rtns.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | #include 21 | 22 | //******************************************************************************** 23 | // Function: timed_read 24 | // 25 | // Description: Peform socket read with possible timeout in msec. 26 | // Return # bytes reead or 0 on timeout or error. 27 | //******************************************************************************** 28 | size_t timed_read(void * socket, char * buffer, size_t size, int num_msec) 29 | { 30 | zmq_pollitem_t items [] = { { socket, 0, ZMQ_POLLIN, 0 } }; 31 | 32 | zmq_poll(items, 1, num_msec * ZMQ_POLL_MSEC); 33 | if(!(items[0].revents & ZMQ_POLLIN)) 34 | return 0; 35 | int count = zmq_recv(socket, buffer, size, ZMQ_DONTWAIT); 36 | if(count == -1) 37 | return 0; 38 | buffer[count] = (char)0; 39 | return count; 40 | } 41 | 42 | //******************************************************************************** 43 | // Function: timed_recv 44 | // 45 | // Description: Peform socket read with possible timeout in msec. 46 | // Return # bytes reead or 0 on timeout or error. 47 | //******************************************************************************** 48 | size_t timed_recv(int fd, char * buffer, size_t size, int num_msec) 49 | { 50 | fd_set rdset; 51 | static struct timeval t; 52 | 53 | FD_ZERO(&rdset); FD_SET(fd, &rdset); 54 | t.tv_sec = 5; t.tv_usec = num_msec * 1000; 55 | int i = select(fd + 1, &rdset, 0, 0, &t); 56 | if(i <= 0) 57 | return 0; 58 | return recv(fd, buffer, size, MSG_DONTWAIT); 59 | } 60 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/util_source/io_rtns.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef IO_RTNS_H 18 | #define IO_RTNS_H 1 19 | 20 | #include 21 | 22 | size_t timed_read(void * socket, char * buffer, size_t size, int num_msec); 23 | size_t timed_recv(int fd, char * buffer, size_t size, int num_msec); 24 | 25 | #endif // IO_RTNS_H 26 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/util_source/tcp_rtns.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | //******************************************************************* 29 | // Function: socket_setup 30 | // 31 | // Description: Sets up tcp socket. 32 | //******************************************************************* 33 | int32_t socket_setup(uint16_t port) 34 | { 35 | struct sockaddr_in serv_addr;; 36 | int32_t s; 37 | 38 | if((s = socket(PF_INET, SOCK_STREAM, 0)) == -1) 39 | return -1; 40 | 41 | int32_t one = 1; 42 | setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)); 43 | bzero(&serv_addr, sizeof(struct sockaddr_in)); 44 | serv_addr.sin_family = AF_INET; 45 | serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); 46 | serv_addr.sin_port = htons(port); 47 | 48 | if(bind(s, (struct sockaddr *) &serv_addr, sizeof(struct sockaddr_in)) == -1) 49 | return -1; 50 | 51 | if(listen(s, 1024) == -1) 52 | return -1; 53 | return s; 54 | } 55 | 56 | // **************************************************************************** 57 | // Function: tcp_accept 58 | // 59 | // Description: Accept connection on tcp socket. 60 | // **************************************************************************** 61 | int32_t tcp_accept(int32_t listen_fd) 62 | { 63 | struct sockaddr_in cli_addr; 64 | 65 | socklen_t len = sizeof(cli_addr); 66 | return accept(listen_fd, (struct sockaddr *) &cli_addr, &len); 67 | } 68 | 69 | // **************************************************************************** 70 | // Function: tcp_connect 71 | // 72 | // Description: Connect to tcp server using port #. 73 | // **************************************************************************** 74 | int32_t tcp_connect(const char * host, uint16_t port) 75 | { 76 | int32_t fd; 77 | struct sockaddr_in serv_addr; 78 | struct hostent *hp; 79 | 80 | if(!(hp = gethostbyname(host))) 81 | return -1; 82 | 83 | bzero(&serv_addr, sizeof(serv_addr)); 84 | serv_addr.sin_family = AF_INET; 85 | serv_addr.sin_port = htons(port); 86 | memcpy(&serv_addr.sin_addr, hp->h_addr, hp->h_length); 87 | 88 | if((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) 89 | return -1; 90 | 91 | if(connect(fd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) 92 | { 93 | close(fd); 94 | return -1; 95 | } 96 | return fd; 97 | } 98 | -------------------------------------------------------------------------------- /1.0/src/tcache_agentx/util_source/tcp_rtns.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef TCP_RTNS_H 18 | #define TCP_RTNS_H 1 19 | 20 | #include 21 | 22 | int32_t socket_setup(uint16_t port); 23 | int32_t tcp_accept(int32_t listen_fd); 24 | int32_t tcp_connect(const char * host, uint16_t port); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /1.0/src/tcmain/Makefile: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------- 2 | # Compiler settings 3 | #------------------------------------------------------------------------- 4 | -include $(TC_HOME)/tccompiler.mk 5 | 6 | #------------------------------------------------------------------------- 7 | # Target Macros 8 | #------------------------------------------------------------------------- 9 | TARGETNAME = transc 10 | TARGETDESC = "Laguna Transparent caching Application" 11 | TARGETSRC = transc.c 12 | TARGETLOGCONF = trlog.conf 13 | TARGETMAINCONF = config.yaml 14 | TARGETDIR = $(TC_HOME)/bin 15 | TARGETTYPE = APPLICATION 16 | 17 | #------------------------------------------------------------------------- 18 | # Directories 19 | #------------------------------------------------------------------------- 20 | TRANSC_CONFDIR = etc/sysconfig/transparent_caching 21 | TRANSC_MAINDIR = $(TC_HOME)/src/tcmain 22 | TRANSC_SRCDIR = $(TC_HOME)/src/transc 23 | ZLOG_SRCDIR = $(TC_HOME)/src/zlog/src 24 | YAML_SRCDIR = $(TC_HOME)/src/yaml 25 | MISC_SRCDIR = $(TC_HOME)/src/misc 26 | LIBLFDS_SRCDIR = $(TC_HOME)/src/liblfds/liblfds611 27 | 28 | #------------------------------------------------------------------------- 29 | # Library Dependencies 30 | #------------------------------------------------------------------------- 31 | LDLIBLINK += $(TC_HOME)/lib/tcplane_snmp.o $(TC_HOME)/lib/blacklist.o 32 | LDLIBLINK += $(TC_HOME)/lib/libtransc.a 33 | LDLIBLINK += $(TC_HOME)/lib/libmisc.a 34 | LDLIBLINK += /usr/local/lib/libzlog.a 35 | LDLIBLINK += /usr/local/lib/libyaml.a 36 | LDLIBLINK += /usr/local/lib/liblfds611.a 37 | LDLIBLINK += /usr/local/lib/libcprops.a 38 | 39 | #------------------------------------------------------------------------- 40 | # Compiler Options 41 | #------------------------------------------------------------------------- 42 | CFLAGS_INC += -I$(TRANSC_SRCDIR) -I$(MISC_SRCDIR) \ 43 | -I$(ZLOG_SRCDIR) -I$(LIBLFDS_SRCDIR)/inc \ 44 | -I$(YAML_SRCDIR)/include 45 | 46 | 47 | ifeq ($(TRANSC_BUILDCFG_LIBPFRING),0) 48 | CFLAGS_DEFS += -DTRANSC_BUILDCFG_LIBPCAP 49 | endif 50 | 51 | #------------------------------------------------------------------------- 52 | # Standard Makefile Inclusion 53 | #------------------------------------------------------------------------- 54 | -include $(TC_HOME)/tcgmake.mk 55 | -------------------------------------------------------------------------------- /1.0/src/tcmain/trlog.conf: -------------------------------------------------------------------------------- 1 | [global] 2 | strict init = true 3 | reload conf period = 10M 4 | 5 | buffer min = 1024 6 | buffer max = 2MB 7 | 8 | #rotate lock file = /tmp/zlog.lock 9 | rotate lock file = self 10 | default format = "%d(%F %T.%l) %-6V (%c:%F:%L) - %m%n" 11 | 12 | file perms = 600 13 | fsync period = 1K 14 | 15 | [levels] 16 | TRACE = 10 17 | CRIT = 130, LOG_CRIT 18 | 19 | [formats] 20 | simple = "%m%n" 21 | normal = "%d(%F %T.%l) %m%n" 22 | detailed = "%d(%m-%d %T) %-5V [%p:%F:%L] %m%n". 23 | 24 | [rules] 25 | #zlog levels: "DEBUG" < "INFO" < "NOTICE" < "WARN" < "ERROR" < "FATAL". 26 | #xxx.DEBUG means all logs of level greater than or equal to DEBUG will be output 27 | #tr_site_youtube.DEBUG >stdout; simple 28 | tr_thd_main.ERROR "/var/log/trmain.log"; detailed 29 | tr_site.ERROR "/var/log/trsite.log"; detailed 30 | 31 | 32 | -------------------------------------------------------------------------------- /1.0/src/transc/bkgrnd/bkgrnd.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef BKGRND_H 18 | #define BKGRND_H 19 | 20 | #include "tcgendefn.h" 21 | #include "tcldcfg.h" 22 | #include "tcbkgrnd.h" 23 | #include "tcshared.h" 24 | #include "tcutils.h" 25 | 26 | #endif /* BKGRND_H */ 27 | -------------------------------------------------------------------------------- /1.0/src/transc/bkgrnd/tcbkgrnd.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef TCBKGRND_H_ 18 | #define TCBKGRND_H_ 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | enum _tc_bkgrnd_comptype_e 25 | { 26 | tcBkgrndCompTypePktPrc, 27 | tcBkgrndCompTypeHealth, 28 | tcBkgrndCompTypeHttpPrc, 29 | tcBkgrndCompTypePktGen, 30 | tcBkgrndCompTypeSimMgr, 31 | tcBkgrndCompTypeMib, 32 | tcBkgrndCompTypeMax 33 | }; 34 | typedef enum _tc_bkgrnd_comptype_e 35 | tc_bkgrnd_comptype_e; 36 | 37 | #define TRANSC_BKGRNDLOG_QUEUE_MAX tcBkgrndCompTypeMax+TRANSC_SIM_THD_MAX 38 | 39 | /***********************Bkgrnd thd****************************************/ 40 | 41 | struct _tc_bkgrnd_evlogtbl_s 42 | { 43 | U32 nZLogCat; 44 | evlog_cat_t tZLogCat[TRANSC_BKGRNDLOG_QUEUE_MAX]; 45 | }; 46 | typedef struct _tc_bkgrnd_evlogtbl_s 47 | tc_bkgrnd_evlogtbl_t; 48 | 49 | struct _tc_bkgrnd_thread_ctxt_s 50 | { 51 | /****** Thread Init ****************/ 52 | U32 tid; 53 | BOOL bExit; 54 | /****** Periodic time ****************/ 55 | U32 nCfgLdTimeSec; 56 | /****** QUEUES Management ****************/ 57 | U32 nQEvLogTbl; 58 | evlog_t* pQEvLogTbl[TRANSC_BKGRNDLOG_QUEUE_MAX]; 59 | tc_bkgrnd_evlogtbl_t tZLogCatComp; 60 | tc_bkgrnd_evlogtbl_t tZLogCatSvc; 61 | evlog_desc_t tLogDesc; 62 | /****** temporary variables Management */ 63 | evlog_strblk_t tStrBlkBuff; 64 | }; 65 | typedef struct _tc_bkgrnd_thread_ctxt_s 66 | tc_bkgrnd_thread_ctxt_t; 67 | 68 | /***********************main resources****************************************/ 69 | 70 | CCUR_PROTECTED(tresult_t) 71 | tcBkgrndInitEventLog( 72 | tc_bkgrnd_thread_ctxt_t* pCntx, 73 | CHAR* strCmdArgLogConfLoc); 74 | 75 | CCUR_PROTECTED(tresult_t) 76 | tcBkgrndEvLogReadFromPktProcQ( 77 | tc_bkgrnd_thread_ctxt_t* pBkGnThd); 78 | 79 | CCUR_PROTECTED(void) 80 | tcBkgrndThreadEntry( 81 | tc_bkgrnd_thread_ctxt_t* pCntx); 82 | 83 | #ifdef __cplusplus 84 | } 85 | #endif 86 | #endif 87 | -------------------------------------------------------------------------------- /1.0/src/transc/health/cdn_status.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef CDN_STATUS_H 18 | #define CDN_STATUS_H 1 19 | 20 | void cdn_status(tc_health_thread_ctxt_t * pCntx); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /1.0/src/transc/health/health.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef HEALTH_H 18 | #define HEALTH_H 19 | 20 | #include "tcgendefn.h" 21 | #include "tcldcfg.h" 22 | #include "tcshared.h" 23 | #include "tchealth.h" 24 | #include "cdn_status.h" 25 | #include "tcutils.h" 26 | 27 | #endif /* HEALTH_H */ 28 | -------------------------------------------------------------------------------- /1.0/src/transc/health/tchealth.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef TCHEALTH_H 18 | #define TCHEALTH_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | #define TRANSC_HEALTH_WAITTIMEOUT_MS 100 25 | #define TRANSC_HEALTH_MOOMSG_LEN 128 26 | #define TRANSC_HEALTH_PING_INTERVAL 30 27 | 28 | struct _tc_health_thread_ctxt_s 29 | { 30 | /****** Thread Init ****************/ 31 | U32 tid; 32 | BOOL bExit; 33 | msem_t tCondVarSem; 34 | BOOL bCondVarSet; 35 | mthread_t tThd; 36 | struct tm* tGMUptime; 37 | tc_gd_time_t tUptime; 38 | tc_gd_time_t tDowntime; 39 | /****** config and init Flags ****************/ 40 | tc_ldcfg_t tConfig; 41 | int32_t healthCheck; 42 | BOOL bMonIntfUpdate; 43 | BOOL bOutIntfUpdate; 44 | /****** Health internal dstruct ****************/ 45 | tc_health_monactv_t tMonActvTbl[TRANSC_INTERFACE_MAX]; 46 | U16 nMonActvTbl; 47 | tc_tr_sts_e eTrStatusTbl[tcTRCompTypeMax]; 48 | /****** QUEUES Management ****************/ 49 | /* PP -> Bkgrnd thread */ 50 | evlog_desc_t tLogDescSys; 51 | evlog_t* pQHealthToBkgrnd; 52 | /****** temporary variables Management */ 53 | tc_mtxtbl_ipptohlth_t tMtxPPToHealthMonIntfMsg; 54 | tc_mtxtbl_stspgentohlth_t tMtxPktGenToHealthStsMsg; 55 | tc_mtxtbl_epgentohlth_t tMtxPktGenToHealthOutIntfMsg; 56 | tc_mtxtbl_mpgentohlth_t tMtxPktGenToHealthMapIntfMsg; 57 | tc_mtxtbl_mhlthtopktgen_t tMtxHealthToPktGenActvMsg; 58 | tc_mtxtbl_mhlthtomib_t tMtxHealthToMibMsg; 59 | 60 | }; 61 | typedef struct _tc_health_thread_ctxt_s 62 | tc_health_thread_ctxt_t; 63 | 64 | CCUR_PROTECTED(mthread_result_t) 65 | tcHealthThreadEntry(void* pthdArg); 66 | 67 | #ifdef __cplusplus 68 | } 69 | #endif 70 | #endif /* TCHEALTH_H */ 71 | -------------------------------------------------------------------------------- /1.0/src/transc/httpprc/httpprc.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef HTTPPRC_H 18 | #define HTTPPRC_H 19 | 20 | #include "tcgendefn.h" 21 | 22 | /* Sites max limits */ 23 | #define TRANSC_HTTPPRC_SITE_MAXHTTPHDRMATCH_LST 8 24 | #define TRANSC_HTTPPRC_SITE_MAXHOSTYPE_LST 8 25 | #define TRANSC_HTTPPRC_SITE_MAXREFTYPE_LST 4 26 | #define TRANSC_HTTPPRC_SITE_STRHOSTSIGLEN 128 27 | #define TRANSC_HTTPPRC_SITE_STRTYPELEN 64 28 | #define TRANSC_HTTPPRC_URL_STRCKEYSIGLEN 512 29 | #define TRANSC_HTTPPRC_DUMPSTATS_TIME_SEC 10 30 | #define TRANSC_HTTPPRC_HUNGER_CNT 500 31 | /* PKT proc start wait timout */ 32 | #define TRANSC_HTTPPRC_WAITTIMEOUT_MS 100 33 | /* URL max limits */ 34 | #define TRANSC_HTTPPRC_URL_CKEYARGS_LST 8 35 | /* Regex stack args and bufsize */ 36 | #define TRANSC_HTTPPRC_REGEXSUBEX_NUM 36 37 | #define TRANSC_HTTPPRC_REGEXSUBEX_BUFFSZ 1024 38 | /* TCP Video Stream Sess configurations*/ 39 | #define TRANSC_HTTPPRC_TCPSTRM_DLFT_CNT 5000 40 | #define TRANSC_HTTPPRC_TCPSTRM_GROW_CNT 4 41 | #define TRANSC_HTTPPRC_TCPSTRM_UNCORRINACTIVETIME_SEC 10 42 | #define TRANSC_HTTPPRC_TCPSTRM_CORRINACTIVETIME_SEC 30 43 | #define TRANSC_HTTPPRC_TCPSTRM_TTLTIME_SEC 10 44 | #define TRANSC_HTTPPRC_TCPSTRM_CTLSRCENTRIES_NUM 500 45 | #define TRANSC_HTTPPRC_TCPSTRM_DFLTBIN_CNT 5000 46 | /* Mib Overflow pkt counter */ 47 | #define TRANSC_HTTPPRC_RDROVFLW_CNT 5000 48 | 49 | #include "tcldcfg.h" 50 | #include "tchttpproc.h" 51 | #include "tchttpinit.h" 52 | #include "tchttpparse.h" 53 | #include "tctcpstrm.h" 54 | #include "tcshared.h" 55 | #include "tcutils.h" 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /1.0/src/transc/httpprc/tchttpinit.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef TCHTTPINIT_H 18 | #define TCHTTPINIT_H 19 | 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | CCUR_PROTECTED(tresult_t) 26 | tcHttpInitLoadableRes( 27 | tc_httpprc_thread_ctxt_t* pCntx, 28 | tc_ldcfg_conf_t* pLdCfg); 29 | 30 | CCUR_PROTECTED(tc_httpprc_stats_t*) 31 | tcHttpInitSiteGetRes( 32 | tc_httpprc_thread_ctxt_t * pCntx, 33 | hlpr_httpsite_hndl eSiteHost); 34 | 35 | CCUR_PROTECTED(void) 36 | tcHttpInitSiteCleanupRes( 37 | tc_httpprc_thread_ctxt_t * pCntx); 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | #endif /* TCHTTPPROC_H */ 43 | -------------------------------------------------------------------------------- /1.0/src/transc/httpprc/tctcpstrm.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef TCTCPSTRM_H 18 | #define TCTCPSTRM_H 19 | 20 | CCUR_PROTECTED(tresult_t) 21 | tcTCPStreamSessGetSessCacheKeyRel( 22 | tc_httpprc_thread_ctxt_t* pCntx, 23 | tc_httpparse_calldef_t* pHttpMsg, 24 | tc_g_svcdesc_t* pSvcType); 25 | 26 | CCUR_PROTECTED(tresult_t) 27 | tcTCPStreamSessGetSessCacheKeySess( 28 | tc_httpprc_thread_ctxt_t* pCntx, 29 | tc_httpparse_calldef_t* pHttpMsg, 30 | tc_g_svcdesc_t* pSvcType); 31 | 32 | CCUR_PROTECTED(void) 33 | tcTCPStreamSessHtableTimeoutCheck( 34 | tc_httpprc_thread_ctxt_t* pCntx, 35 | tc_gd_time_t* pTimeNow); 36 | 37 | CCUR_PROTECTED(tresult_t) 38 | tcTCPStreamSessEntryMpoolCreate( 39 | tc_httpprc_thread_ctxt_t* pCntx); 40 | 41 | CCUR_PROTECTED(void) 42 | tcTCPStreamSessEntryMpoolDestroy( 43 | tc_httpprc_thread_ctxt_t* pCntx); 44 | 45 | CCUR_PROTECTED(void) 46 | tcTCPStreamSessEntryMpoolGetStats( 47 | tc_httpprc_thread_ctxt_t* pCntx); 48 | 49 | #endif /* TCPSTRM_H */ 50 | -------------------------------------------------------------------------------- /1.0/src/transc/ipblacklist/Makefile.cpp: -------------------------------------------------------------------------------- 1 | TC_HOME=../../.. 2 | TARGETDIR=$(TC_HOME)/lib 3 | #------------------------------------------------------------------------- 4 | # Compiler settings 5 | #------------------------------------------------------------------------- 6 | -include $(TC_HOME)/tccompiler.mk 7 | 8 | TRANSC_SRCDIR = $(TC_HOME)/src/transc 9 | ZLOG_SRCDIR = $(TC_HOME)/src/zlog/src 10 | YAML_SRCDIR = $(TC_HOME)/src/yaml 11 | MISC_SRCDIR = $(TC_HOME)/src/misc 12 | LIBLFDS_SRCDIR = $(TC_HOME)/src/liblfds/liblfds611 13 | 14 | CFLAGS_INC += -I$(TRANSC_SRCDIR) -I$(MISC_SRCDIR) \ 15 | -I$(ZLOG_SRCDIR) -I$(LIBLFDS_SRCDIR)/inc \ 16 | -I$(YAML_SRCDIR)/include -I/usr/local/include 17 | 18 | .PHONEY: all clean 19 | 20 | all: $(TARGETDIR)/blacklist.o 21 | 22 | $(TARGETDIR)/blacklist.o: ipblacklist.cpp ipblacklist.h 23 | $(CXX) -c $(CFLAGS) $(CXXFLAGS) -o $@ $< 24 | 25 | clean: 26 | rm -f *.o 27 | 28 | #------------------------------------------------------------------------- 29 | # Standard Makefile Inclusion 30 | #------------------------------------------------------------------------- 31 | -include $(TC_HOME)/tcgmake.mk 32 | -------------------------------------------------------------------------------- /1.0/src/transc/ipblacklist/ipblacklist.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef IPBLACKLIST_H 18 | #define IPBLACKLIST_H 1 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | 29 | enum { IP_STR_LOWER, IP_UINT_LOWER, IP_STR_UPPER, IP_UINT_UPPER }; 30 | 31 | typedef std::tuple blacklist_tuple_t; 32 | 33 | //***************************************************************************************** 34 | //***************************************************************************************** 35 | class ipblacklist 36 | { 37 | public: 38 | ipblacklist() { }; 39 | 40 | bool blacklisted(const uint32_t ip); 41 | 42 | uint32_t IPtoUInt(const std::string & ip); 43 | 44 | void populate(const char * s); 45 | void clear(void); 46 | void print(void); 47 | 48 | private: 49 | std::list m_blacklist; 50 | }; 51 | 52 | #endif //*** IPBLACKLIST_H *** 53 | -------------------------------------------------------------------------------- /1.0/src/transc/mib/Makefile.cpp: -------------------------------------------------------------------------------- 1 | TC_HOME=../../.. 2 | TARGETDIR=$(TC_HOME)/lib 3 | #------------------------------------------------------------------------- 4 | # Compiler settings 5 | #------------------------------------------------------------------------- 6 | -include $(TC_HOME)/tccompiler.mk 7 | 8 | TRANSC_SRCDIR = $(TC_HOME)/src/transc 9 | ZLOG_SRCDIR = $(TC_HOME)/src/zlog/src 10 | YAML_SRCDIR = $(TC_HOME)/src/yaml 11 | MISC_SRCDIR = $(TC_HOME)/src/misc 12 | LIBLFDS_SRCDIR = $(TC_HOME)/src/liblfds/liblfds611 13 | 14 | CFLAGS_INC += -I$(TRANSC_SRCDIR) -I$(MISC_SRCDIR) \ 15 | -I$(ZLOG_SRCDIR) -I$(LIBLFDS_SRCDIR)/inc \ 16 | -I$(YAML_SRCDIR)/include -I/usr/local/include 17 | 18 | .PHONEY: all clean 19 | 20 | all: $(TARGETDIR)/tcplane_snmp.o 21 | 22 | $(TARGETDIR)/tcplane_snmp.o: tcplane_snmp.cpp tcplane_snmp.h 23 | $(CXX) -c $(CFLAGS) $(CXXFLAGS) -o $@ $< 24 | 25 | clean: 26 | rm -f *.o 27 | 28 | #------------------------------------------------------------------------- 29 | # Standard Makefile Inclusion 30 | #------------------------------------------------------------------------- 31 | -include $(TC_HOME)/tcgmake.mk 32 | -------------------------------------------------------------------------------- /1.0/src/transc/mib/mib.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef MIB_H 18 | #define MIB_H 19 | 20 | #include "tcgendefn.h" 21 | #include "tcldcfg.h" 22 | #include "tcshared.h" 23 | #include "tcplanesnmp.h" 24 | #include "tcutils.h" 25 | 26 | #endif /* MIB_H */ 27 | -------------------------------------------------------------------------------- /1.0/src/transc/pktgen/pktgen.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef PKTGEN_H 18 | #define PKTGEN_H 19 | 20 | #include "tcgendefn.h" 21 | 22 | #ifdef TRANSC_BUILDCFG_LIBPCAP 23 | #define TRANSC_PKTGEN_NETSOCKOPTSIZE 4096 24 | #else 25 | #define TRANSC_PKTGEN_NETSOCKOPTSIZE 2048 26 | #endif /* TRANSC_BUILDCFG_LIBPCAP */ 27 | #define TRANSC_PKTGEN_DUMPSTATS_TIME_SEC 30 28 | #define TRANSC_PKTGEN_SHVALUPD_TIME_SEC 10 29 | #define PKTGEN_OUTPUT_FRAMESIZE 1536 30 | #define TRANSC_PKTGEN_OUTPUT_PYLDSIZE 2048 31 | #define TRANSC_PKTGEN_OUTPUT_L1L4 2048 32 | #define TRANSC_PKTGEN_MACADDRHDR_SZ 14 33 | #define TRANSC_PKTGEN_IPV4HDR_SZ 20 34 | #define TRANSC_PKTGEN_IPV6HDR_SZ 40 35 | #define TRANSC_PKTGEN_TCPHDR_SZ 20 36 | #define TRANSC_PKTGEN_TCPPROTO_BYTE (0x06) 37 | 38 | #include "tcldcfg.h" 39 | #include "tcshared.h" 40 | #include "tcintf.h" 41 | #include "tcoutintf.h" 42 | #include "tcpktgen.h" 43 | #include "tcpktgeninit.h" 44 | #include "tcpktinj.h" 45 | #ifdef TRANSC_BUILDCFG_LIBPCAP 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include "tcplpsend.h" 55 | #else 56 | #include "tcpfrpsend.h" 57 | #endif /* TRANSC_BUILDCFG_LIBPCAP */ 58 | #include "tcpktiotx.h" 59 | #include "tcutils.h" 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /1.0/src/transc/pktgen/tcpfrpsend.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef TCPFRPSEND_H 18 | #define TCPFRPSEND_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | CCUR_PROTECTED(BOOL) 25 | tcPfrPsendInitIsTxIntfLinkUp( 26 | tc_pktgen_thread_ctxt_t * pCntx); 27 | 28 | CCUR_PROTECTED(tresult_t) 29 | tcPfrPsendInitLibPfringTx(tc_pktgen_thread_ctxt_t* pCntx, 30 | U16 nIntfIdx); 31 | 32 | CCUR_PROTECTED(tresult_t) 33 | tcPfrPsendShutdownLibPfringTx( 34 | tc_outintf_out_t* pOutIntf); 35 | 36 | CCUR_PROTECTED(I32) 37 | tcPfrPsendLibPfringTx( 38 | tc_pktgen_thread_ctxt_t* pCntx, 39 | tc_outintf_out_t* pOutIntf, 40 | tc_pktgen_pktinj_t* pkt); 41 | 42 | CCUR_PROTECTED(CHAR*) 43 | tcPfrPsendGetStatPfringTx( 44 | tc_pktgen_thread_ctxt_t* pCntx, 45 | CHAR* strBuff, 46 | U32 nstrBuff); 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | #endif /* TCPFRPSEND_H */ 52 | -------------------------------------------------------------------------------- /1.0/src/transc/pktgen/tcpktgeninit.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef TCPKTGENINIT_H 18 | #define TCPKTGENINIT_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | CCUR_PROTECTED(tresult_t) 25 | tcPktGenInitIntf( 26 | tc_pktgen_thread_ctxt_t* pCntx, 27 | BOOL bTxLoad); 28 | 29 | CCUR_PROTECTED(tresult_t) 30 | tcPktGenConfigInitLoadableRes( 31 | tc_pktgen_thread_ctxt_t* pCntx, 32 | tc_ldcfg_conf_t* pLdCfg); 33 | 34 | CCUR_PROTECTED(void) 35 | tcPktGenInitLogOutCfgLoadStatus( 36 | tc_pktgen_thread_ctxt_t* pCntx); 37 | 38 | CCUR_PROTECTED(void) 39 | tcPktGenLogDownStatusAndRetry( 40 | tc_pktgen_thread_ctxt_t* pCntx); 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | #endif /* TCPKTGENINIT_H */ 46 | -------------------------------------------------------------------------------- /1.0/src/transc/pktgen/tcpktinj.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef TCPKTINJ_H 18 | #define TCPKTINJ_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | 25 | CCUR_PROTECTED(tresult_t) 26 | tcPktInjInjectReq302Pkt( 27 | tc_pktgen_thread_ctxt_t* pCntx, 28 | tc_g_qmsghptopg_t* pHttpMsg, 29 | tc_pktdesc_t* pPktDesc, 30 | hlpr_httpsite_hndl eSite, 31 | tc_outintf_out_t* pOutIntf, 32 | tc_outintf_mon_t* pMonIntf); 33 | 34 | CCUR_PROTECTED(tresult_t) 35 | tcPktInjInjectReqFinPkt( 36 | tc_pktgen_thread_ctxt_t* pCntx, 37 | tc_pktdesc_t* pPktDesc, 38 | hlpr_httpsite_hndl eSite, 39 | tc_pktgen_tcpflgproto_e eFlagProto, 40 | tc_outintf_out_t* pOutIntf); 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | #endif 46 | -------------------------------------------------------------------------------- /1.0/src/transc/pktgen/tcpktiotx.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef TCPKTIOTX_H 18 | #define TCPKTIOTX_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | CCUR_PROTECTED(tresult_t) 25 | tcPktIOTxOutIntfOpen( 26 | tc_pktgen_thread_ctxt_t* pCntx ); 27 | 28 | CCUR_PROTECTED(void) 29 | tcPktIOTxOutIntfClose( 30 | tc_pktgen_thread_ctxt_t* pCntx ); 31 | 32 | CCUR_PROTECTED(CHAR*) 33 | tcPktIOTxOutIntfGetStat( 34 | tc_pktgen_thread_ctxt_t* pCntx, 35 | CHAR* strBuff, 36 | U32 nstrBuff); 37 | 38 | CCUR_PROTECTED(BOOL) 39 | tcPktIOTxOutIntfIsLinkUp( 40 | tc_pktgen_thread_ctxt_t* pCntx ); 41 | 42 | CCUR_PROTECTED(I32) 43 | tcPktIOTxOutIntfToWire( 44 | tc_pktgen_thread_ctxt_t* pCntx, 45 | tc_outintf_out_t* pOutIntf, 46 | tc_pktgen_pktinj_t* pkt); 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | #endif 52 | -------------------------------------------------------------------------------- /1.0/src/transc/pktgen/tcplpsend.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef _TCPLPSEND_ 18 | #define _TCPLPSEND_ 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | #ifdef TRANSC_BUILDCFG_LIBPCAP 25 | 26 | CCUR_PROTECTED(tresult_t) 27 | tcPlPsendInitLibPcapTx( 28 | tc_pktgen_thread_ctxt_t * pCntx); 29 | 30 | CCUR_PROTECTED(tresult_t) 31 | tcPlPsendShutdownLibPcapTx( 32 | tc_pktgen_thread_ctxt_t * pCntx); 33 | 34 | CCUR_PROTECTED(BOOL) 35 | tcPlPsendInitIsTxIntfLinkUp( 36 | tc_pktgen_thread_ctxt_t * pCntx); 37 | 38 | CCUR_PROTECTED(I32) 39 | tcPlPsendLibPcapTx( 40 | tc_pktgen_thread_ctxt_t* pCntx, 41 | tc_pktgen_t* pPktGen, 42 | tc_pktgen_pktinj_t* pkt); 43 | 44 | 45 | CCUR_PROTECTED(CHAR*) 46 | tcPlPsendGetStatLibPcapTx( 47 | tc_pktgen_thread_ctxt_t* pCntx, 48 | CHAR* strBuff, 49 | U32 nstrBuff); 50 | #endif 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | #endif 56 | -------------------------------------------------------------------------------- /1.0/src/transc/pktprc/pktprc.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef PKTPRC_H 18 | #define PKTPRC_H 19 | 20 | #include "tcgendefn.h" 21 | 22 | #define TRANSC_PKTPRC_HTTP_MINPYLD_SZ 75 23 | #define TRANSC_PKTPRC_BUFFCAPLEN 8192 24 | #define TRANSC_PKTPRC_MINHTTPPYLD_SZ sizeof("GET / HTTP/1.0\r\n\r\n") 25 | #define TRANSC_PKTPRC_MAXHTTPPYLD_SZ 1536 26 | #define TRANSC_PKTPRC_LOAD_REGEXSUBEX_NUM 36 27 | #define TRANSC_PKTPRC_DUMPSTATS_TIME_SEC 10 28 | #define TRANSC_PKTPRC_QUEUEFLUSH_TIME_SEC 5 29 | #define TRANSC_PKTPRC_HUNGER_CNT 1000 30 | #define TRANSC_PKTPRC_TCPSTRM_TTL_CNT 8000 31 | #define TRANSC_PKTPRC_URL_STRRULESETLEN 128 32 | #ifdef TRANSC_BUILDCFG_LIBPCAP 33 | /* Pcap config */ 34 | #define TRANSC_PKTPRC_BUFFWTRMRK 1 35 | #define TRANSC_PKTPRC_FDNUM 1 36 | #define TRANSC_PKTPRC_SNAPLEN 2048 37 | #define TRANSC_PKTPRC_POLLDURATION_MS 500 38 | #define TRANSC_PCAP_READTIMEOUT_MS 200 39 | #else 40 | /* Pcap config */ 41 | #define TRANSC_PKTPRC_BUFFWTRMRK 1 42 | #define TRANSC_PKTPRC_FDNUM 1 43 | #define TRANSC_PKTPRC_SNAPLEN 2048 44 | #define TRANSC_PKTPRC_POLLDURATION_MS 1 45 | #endif /* TRANSC_BUILDCFG_LIBPCAP */ 46 | /* PKT proc start wait timout */ 47 | #define TRANSC_PKTPRC_WAITTIMEOUT_MS 100 48 | #define TRANSC_PKTPRC_URL_STRCKEYSIGLEN 512 49 | /* Mib Overflow pkt counter */ 50 | #define TRANSC_PKTPRC_RDROVFLW_CNT 8000 51 | 52 | #include "tcldcfg.h" 53 | #include "tcshared.h" 54 | #include "tcintf.h" 55 | #include "tcmonintf.h" 56 | #include "tcpktprc.h" 57 | #include "tcpktprcinit.h" 58 | #ifdef TRANSC_BUILDCFG_LIBPCAP 59 | #include 60 | #include 61 | #include 62 | #include 63 | #include "tcplpcap.h" 64 | #else 65 | #include "tcpfrpcap.h" 66 | #endif /* TRANSC_BUILDCFG_LIBPCAP */ 67 | #include "tcpktiorx.h" 68 | #include "tcutils.h" 69 | 70 | #endif /* PKTPRC_H */ 71 | -------------------------------------------------------------------------------- /1.0/src/transc/pktprc/tcpfrpcap.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef TCPFRPCAP_H 18 | #define TCPFRPCAP_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | #ifndef TRANSC_BUILDCFG_LIBPCAP 25 | 26 | typedef struct pfring_pkthdr pfring_hdr_t; 27 | #endif /* TRANSC_BUILDCFG_LIBPCAP */ 28 | 29 | CCUR_PROTECTED(tresult_t) 30 | tcPfrPcapInitLibPfringRx( 31 | tc_pktprc_thread_ctxt_t * pCntx, 32 | U16 nIntfIdx, 33 | U16 nFilterIdx); 34 | 35 | CCUR_PROTECTED(BOOL) 36 | tcPfrPcapInitIsRxIntfLinkUp( 37 | tc_pktprc_thread_ctxt_t * pCntx); 38 | 39 | CCUR_PROTECTED(tresult_t) 40 | tcPfrPcapShutdownLibPfringRx( 41 | tc_pktprc_thread_ctxt_t* pCntx, 42 | tc_monintf_fltr_t* pMonIntffltr); 43 | 44 | CCUR_PROTECTED(CHAR*) 45 | tcPfrPcapGetStatPfringRx( 46 | tc_pktprc_thread_ctxt_t* pCntx, 47 | CHAR* strBuff, 48 | U32 nstrBuff); 49 | 50 | CCUR_PROTECTED(tresult_t) 51 | tcPfrPcapProcessLibPfring( 52 | tc_pktprc_thread_ctxt_t* pCntx ); 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif /* TCPFRPCAP_H */ 59 | -------------------------------------------------------------------------------- /1.0/src/transc/pktprc/tcpktiorx.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef TCPKTIORX_H 18 | #define TCPKTIORX_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | CCUR_PROTECTED(tresult_t) 25 | tcPktIORxMonIntfOpen( 26 | tc_pktprc_thread_ctxt_t* pCntx); 27 | 28 | CCUR_PROTECTED(void) 29 | tcPktIORxMonIntfClose( 30 | tc_pktprc_thread_ctxt_t* pCntx); 31 | 32 | CCUR_PROTECTED(CHAR*) 33 | tcPktIORxMonIntfGetStat( 34 | tc_pktprc_thread_ctxt_t* pCntx, 35 | CHAR* strBuff, 36 | U32 nstrBuff); 37 | 38 | CCUR_PROTECTED(tresult_t) 39 | tcPktIORxMonIntfFromWire( 40 | tc_pktprc_thread_ctxt_t* pCntx); 41 | 42 | CCUR_PROTECTED(BOOL) 43 | tcPktIORxMonIntfIsLinkUp( 44 | tc_pktprc_thread_ctxt_t * pCntx); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | #endif 50 | -------------------------------------------------------------------------------- /1.0/src/transc/pktprc/tcpktprcinit.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef TCPKTPRCINIT_H 18 | #define TCPKTPRCINIT_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | CCUR_PROTECTED(void) 25 | tcPktPrcInitSiteCleanupRes( 26 | tc_pktprc_thread_ctxt_t * pCntx); 27 | 28 | CCUR_PROTECTED(tresult_t) 29 | tcPktProcConfigInitLoadableRes( 30 | tc_pktprc_thread_ctxt_t* pCntx, 31 | tc_ldcfg_conf_t* pLdCfg); 32 | 33 | CCUR_PROTECTED(BOOL) 34 | tcPktPrcInitCkIntf( 35 | tc_pktprc_thread_ctxt_t* pCntx, 36 | tc_ldcfg_conf_t* pLdCfg); 37 | 38 | CCUR_PROTECTED(tresult_t) 39 | tcPktPrcInitIntf( 40 | tc_pktprc_thread_ctxt_t* pCntx, 41 | BOOL bRxLoad); 42 | 43 | CCUR_PROTECTED(tresult_t) 44 | tcPktPrcCkIpBlacklist( 45 | tc_pktprc_thread_ctxt_t* pCntx, 46 | tc_pktdesc_t* pPktDesc); 47 | 48 | CCUR_PROTECTED(void) 49 | tcPktProcInitLogDownStatusAndRetry( 50 | tc_pktprc_thread_ctxt_t* pCntx); 51 | 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif /* TCPKTPRCINIT_H */ 58 | -------------------------------------------------------------------------------- /1.0/src/transc/pktprc/tcplpcap.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef TCPLCAP_H 18 | #define TCPLCAP_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | #ifdef TRANSC_BUILDCFG_LIBPCAP 25 | 26 | CCUR_PROTECTED(tresult_t) 27 | tcPlpcapInitLibPcapRx( 28 | tc_pktprc_thread_ctxt_t* pCntx); 29 | 30 | CCUR_PROTECTED(BOOL) 31 | tcPlpcapInitIsRxIntfLinkUp( 32 | tc_pktprc_thread_ctxt_t * pCntx); 33 | 34 | CCUR_PROTECTED(tresult_t) 35 | tcPlpcapShutdownLibPcapRx( 36 | tc_pktprc_thread_ctxt_t* pCntx); 37 | 38 | CCUR_PROTECTED(CHAR*) 39 | tcPlpcapGetStatLibPcapRx( 40 | tc_pktprc_thread_ctxt_t* pCntx, 41 | CHAR* strBuff, 42 | U32 nstrBuff); 43 | 44 | CCUR_PROTECTED(tresult_t) 45 | tcPlpcapProcessLibPcap( 46 | tc_pktprc_thread_ctxt_t* pCntx); 47 | #endif /* TRANSC_BUILDCFG_LIBPCAP */ 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | #endif 53 | -------------------------------------------------------------------------------- /1.0/src/transc/simprc/simprc.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef SIMPRC_H 18 | #define SIMPRC_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | #include "tcgendefn.h" 25 | 26 | #define TRANSC_SIM_CURLTIMEOUT_MS 2000 27 | #define TRANSC_SIM_WKRDUMPSTATS_CNTR 15000 28 | #define TRANSC_SIM_WKRDUMPSTATS_TIME_SEC 60 29 | #define TRANSC_SIM_DUMPSTATS_CNTR 15000 30 | #define TRANSC_SIM_DUMPSTATS_TIME_SEC 60 31 | /* SIM proc start wait timout */ 32 | #define TRANSC_SIM_WAITTIMEOUT_MS 100 33 | /* Q error counters */ 34 | #define TRANSC_SIMPRC_RDROVFLW_CNT 2000 35 | #define TRANSC_SIMSNDPRC_RDROVFLW_CNT 2000 36 | /* Mempool */ 37 | #define TRANSC_SIMCKEY_DLFT_CNT 2500 38 | #define TRANSC_SIMCKEY_GROW_CNT 5 39 | /* Hash Table Size */ 40 | #define TRANSC_SIMCKEY_DFLTBIN_CNT 8000 41 | #define TRANSC_SIMCKEY_UNCORRINACTIVETIME_SEC 20 42 | #define TRANSC_SIMCKEY_TTL_CNT 4000 43 | #define TRANSC_SIMCKEY_CTLSRCENTRIES_NUM 400 44 | /* buffer length */ 45 | #define TRANSC_SIMCKEY_URL_MAX_SIZE 2048 46 | #define TRANSC_SIMCKEY_HTTPBUFF_MAX_SIZE 2048 47 | #define TRANSC_SIMCKEY_HTTPCONTENTLEN_BUFF_SIZE 102400 48 | 49 | #include "tcldcfg.h" 50 | #include "tcsimutil.h" 51 | #include "tcsimsend.h" 52 | #include "tcsim.h" 53 | #include "tcshared.h" 54 | #include "tcutils.h" 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | #endif /* SIMPRC_H */ 60 | -------------------------------------------------------------------------------- /1.0/src/transc/simprc/tcsimsend.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef TCSIMSEND_H 18 | #define TCSIMSEND_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | #define TRANSC_SIMSND_CONTLENBUFF TRANSC_SIM_CONTLENBUFF 25 | 26 | struct _tc_simsnd_thread_ctxt_s 27 | { 28 | /****** Thread Init ****************/ 29 | U32 tid; 30 | U32 cfgId; 31 | BOOL bExit; 32 | msem_t tCondVarSem; 33 | BOOL bCondVarSet; 34 | mthread_t tThd; 35 | /****** Periodic time ****************/ 36 | struct tm* tGMUptime; 37 | tc_gd_time_t tUptime; 38 | tc_gd_time_t tDowntime; 39 | /****** config and init Flags ****************/ 40 | CHAR strSimBwOutIntf[TRANSC_LDCFG_BWSIM_OUTINTFLEN]; 41 | BOOL bBwSimMode; 42 | BOOL bLdCfgYaml; 43 | /****** Statistics counters ****************/ 44 | U32 nMsgOflw; 45 | U32 nErrNoQMemSimSndToSim; 46 | tc_simutil_curlerr_t tCurlErr; 47 | U32 nErrCount; 48 | U32 nCurlReqErr; 49 | U32 nBadRespErr; 50 | U32 nIgnCount; 51 | U32 nHttpReq; 52 | U32 nHttpSuccessHEADreq; 53 | U32 nHttpSuccessGETreq; 54 | /****** QUEUES Management ****************/ 55 | /*Sim -> Bkgrnd */ 56 | evlog_desc_t tLogDescSys; 57 | evlog_desc_t tLogDescSvc; 58 | evlog_t* pQSimSendWToBkgrnd; 59 | /* Sim To Sim/Send */ 60 | lkfq_tc_t* pQSimToSimSendW; 61 | /* Sim/Send To Sim */ 62 | lkfq_tc_t* pQSimSendWToSim; 63 | /****** temporary variables Management */ 64 | U8 strBodyPyload[TRANSC_LDCFG_BWSIM_BODYPYLDLEN]; 65 | }; 66 | typedef struct _tc_simsnd_thread_ctxt_s 67 | tc_simsnd_thread_ctxt_t; 68 | 69 | CCUR_PROTECTED(mthread_result_t) 70 | tcSimSendProcThreadEntry(void* pthdArg); 71 | 72 | CCUR_PROTECTED(tresult_t) 73 | tcSimSendProcInitLoadableRes( 74 | tc_simsnd_thread_ctxt_t* pCntx, 75 | tc_ldcfg_conf_t* pLdCfg); 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | #endif /* tcsimsnd_H */ 81 | -------------------------------------------------------------------------------- /1.0/src/transc/tcgendefn.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef TCGENDEFN_H 18 | #define TCGENDEFN_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | #ifdef TRANSC_BUILDCFG_LIBPCAP 25 | #include 26 | #include 27 | #include 28 | #include 29 | #else 30 | #include 31 | #include 32 | #endif /* TRANSC_BUILDCFG_LIBPCAP */ 33 | #include "tcconfig.h" 34 | #include "http_parser.h" 35 | #include "yaml.h" 36 | #include "helper.h" 37 | #include "msem.h" 38 | #include "mthread.h" 39 | #include "evlog.h" 40 | #include "tcpktparse.h" 41 | #include "tcregex.h" 42 | #include "tcutil.h" 43 | #include "tcqmsg.h" 44 | #ifdef TRANSC_DEBUG 45 | #define tcPrintSysLog(p,...) printf(__VA_ARGS__) 46 | #else 47 | #define tcPrintSysLog(p,...) syslog(p,"["TRANSC_PROCNAME"]:"__VA_ARGS__) 48 | #endif /* TRANSC_DEBUG */ 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | #endif /* GENDEFN_H_ */ 54 | -------------------------------------------------------------------------------- /1.0/src/transc/tcintf.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef TCINTF_H 18 | #define TCINTF_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | enum _tc_intf_ptype_e 25 | { 26 | tcIntfPTypeNone=0, 27 | tcIntfPTypeRedirAddr 28 | }; 29 | typedef enum _tc_intf_ptype_e 30 | tc_intf_ptype_e; 31 | 32 | struct _tc_intf_intf_s 33 | { 34 | CHAR strIntfName[32]; 35 | CHAR strIntfVal[32]; 36 | U16 nIntfIdx; 37 | BOOL bIntfIdxSet; 38 | BOOL bIntfRdy; 39 | }; 40 | typedef struct _tc_intf_intf_s 41 | tc_intf_intf_t; 42 | 43 | struct _tc_intf_linkintf_s 44 | { 45 | CHAR strIntfName[32]; 46 | U16 nRefCnt; 47 | }; 48 | typedef struct _tc_intf_linkintf_s 49 | tc_intf_linkintf_t; 50 | 51 | struct _tc_intf_config_s 52 | { 53 | BOOL bActiveMode; 54 | CHAR strPktPrcArgRuleset[1024]; /* orig */ 55 | CHAR strPktPrcArgMonIntf[512]; /* orig */ 56 | CHAR strPktPrcArgOutIntf[64]; /* orig */ 57 | CHAR strPktPrcArgMapIntf[256]; /* orig */ 58 | CHAR strPktPrcArgRedirTarget[512]; 59 | evlog_t* pEvLog; 60 | evlog_desc_t* pLogDescSysX; 61 | }; 62 | typedef struct _tc_intf_config_s 63 | tc_intf_config_t; 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif 68 | #endif 69 | -------------------------------------------------------------------------------- /1.0/src/transc/tcmapintf.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef TCMAPINTF_H 18 | #define TCMAPINTF_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | #include "tcldcfg.h" 25 | #include "tcintf.h" 26 | #include "pktprc/tcmonintf.h" 27 | #include "pktgen/tcoutintf.h" 28 | 29 | CCUR_PROTECTED(U32) 30 | tcIntfInitIntfKeyTable( 31 | tc_monintf_intfd_t* pIngressIntf, 32 | tc_outintf_intfd_t* pEgressIntf, 33 | tc_utils_keyvalue_t* pIntfKeyValTbl, 34 | U16 nIntfKeyValTbl); 35 | 36 | CCUR_PROTECTED(U32) 37 | tcIntfInitIntfTable( 38 | tc_monintf_intfd_t* pIngressIntf, 39 | tc_outintf_intfd_t* pEgressIntf, 40 | tc_utils_keyvalue_t* pIntfKeyValTbl, 41 | U16 nIntfKeyValTbl); 42 | 43 | 44 | CCUR_PROTECTED(void) 45 | tcIntfCkIntf( 46 | tc_intf_config_t* pIntfCfg, 47 | tc_ldcfg_conf_t* pLdCfg, 48 | BOOL* bRxLoad, 49 | BOOL* bTxLoad, 50 | BOOL* bMapLoad, 51 | BOOL* bRedirLoad); 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | #endif 57 | -------------------------------------------------------------------------------- /1.0/src/transc/tctemp.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef TCTEMP_H 18 | #define TCTEMP_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | #include "pktprc/pktprc.h" 25 | #include "pktgen/pktgen.h" 26 | 27 | /* TODO: Split this into each contexts of http proc and pktgen and 28 | * delete this file. */ 29 | struct _tc_temp_thread_ctxt_s 30 | { 31 | /* Http proc thread */ 32 | tc_httpprc_thread_ctxt_t* pHttpPrcThd; 33 | /* Pkt Gen */ 34 | tc_pktgen_thread_ctxt_t* pPktGenThd; 35 | }; 36 | typedef struct _tc_temp_thread_ctxt_s 37 | tc_temp_thread_ctxt_t; 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | #endif 43 | -------------------------------------------------------------------------------- /1.0/src/transc/tcutils.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | #ifndef TCUTILS_H 18 | #define TCUTILS_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | 25 | struct _tc_utils_keyvalue_s 26 | { 27 | CHAR strKey[128]; 28 | CHAR strValue[256]; 29 | }; 30 | typedef struct _tc_utils_keyvalue_s 31 | tc_utils_keyvalue_t; 32 | 33 | CCUR_PROTECTED(CHAR*) 34 | tcUtilsGetPfringVer( 35 | CHAR* strBuff,I32 version); 36 | 37 | CCUR_PROTECTED(tresult_t) 38 | tcUtilsDaemonize(); 39 | 40 | CCUR_PROTECTED(void) 41 | tcUtilsSignalHandlerSetup(void); 42 | 43 | CCUR_PROTECTED(void) 44 | tcUtilsSignalHandler( 45 | I32 nSignalId); 46 | 47 | CCUR_PROTECTED(void) 48 | tcUtilsPopulateKeyValuePair( 49 | tc_utils_keyvalue_t* pKeyValTbl, 50 | U16* nKeyValTblActive, 51 | U16 nKeyValTblMax, 52 | CHAR* strCmdArgMonIntf); 53 | 54 | CCUR_PROTECTED(BOOL) 55 | tcUtilsValidConfigVersion(CHAR* strVer); 56 | 57 | CCUR_PROTECTED(void) 58 | tcUtilsLogW3cFormat( 59 | U32 tid, 60 | evlog_loglvl_e lvl, 61 | tc_g_qmsghptopg_t* pInjMsg, 62 | tc_pktdesc_t* pPktDesc, 63 | evlog_t* pEvLog, 64 | evlog_desc_t* pLogDescSys); 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | #endif /* TCUTILS_H */ 70 | -------------------------------------------------------------------------------- /1.0/traffic_ops/README: -------------------------------------------------------------------------------- 1 | The LAGUNA.traffic_ops profile adds the default configuration data for 2 | a Laguna server to pull from the traffic-control-cdn project. 3 | 4 | Steps to upload: 5 | 1. Login to Traffic Ops 6 | 2. Navigate to the misc/profiles page 7 | 3. Click the 'Import Profile' button 8 | 4. Select the LAGUNA.traffic_ops file 9 | 5. Click 'Submit' 10 | 11 | Traffic Ops will churn for a bit as the profile is ingested 12 | 13 | After the upload is complete you will see the Laguna profile in the 14 | list of profiles. 15 | 16 | Parameters names in the Laguna profile include indexes to facilitate 17 | ease when conversion/creation of the Laguna configuration files, which are 18 | YAML or JSON formatted. If modifying, pay CLOSE attention to the 19 | indexes so that they are unique and consistent. Gaps in numbering 20 | will be taken care of by the configuration retrieval mechanism. 21 | 22 | Unlike the rest of Traffic Ops, Laguna uses Posix regular expression 23 | formats, not PCRE. 24 | 25 | 26 | -------------------------------------------------------------------------------- /1.0/trafficserver-5-3-2/README.md: -------------------------------------------------------------------------------- 1 | Using Traffic Control [patch](https://github.com/Comcast/traffic_control/blob/master/traffic_server/patches/trafficserver-5.3.2-089d585.diff) for ATS version 5.3.2 build and install Traffic Server. 2 | 3 | 1. wget https://github.com/Comcast/traffic_control/raw/master/traffic_server/patches/trafficserver-5.3.2-089d585.diff 4 | 2. wget http://archive.apache.org/dist/trafficserver/trafficserver-5.3.2.tar.bz2 5 | 3. tar -jxvf ./trafficserver-5.3.2.tar.bz2 6 | 4. cd trafficserver-5.3.2 7 | 5. patch -p1 < ../trafficserver-5.3.2-089d585.diff 8 | 6. autoreconf -vfi 9 | 7. ./configure --prefix=/opt/trafficserver --with-user=ats --with-group=ats --with-build-number=1.10112015 --enable-experimental-plugins --with-max-api-stats=4096 10 | 8. make 11 | 9. make install 12 | 13 | -------------------------------------------------------------------------------- /1.0/trafficserver-5-3-2/etc/README: -------------------------------------------------------------------------------- 1 | Apache Traffic Server configuration files to interface with Laguna. 2 | -------------------------------------------------------------------------------- /1.0/trafficserver-5-3-2/etc/cacheurl.config: -------------------------------------------------------------------------------- 1 | ### 2 | http://.*/sec(.*)/frag(.*)/video/(\d+)/(\d+)/(.*).flv video-dmotion-sec$1-frag$2-$3-$4-$5.flv 3 | http://.*/sec(.*)/frag(.*)/video/(\d+)/(\d+)/(.*).ts video-dmotion-sec$1-frag$2-$3-$4-$5.ts 4 | http://.*/sec(.*)/video/(.*)/(.*)/(.*).mnft video-dmotion-sec$1-$2-$3-$4.mnft 5 | ### 6 | http://.*/ccur/video/ntflx/tcshost/(.*)/tcskey/(.*)/(.*)/.*/.*/.*/.*//range/(\d+)-(\d+).* http://$1/$2/video/ntflx/$3/range/$4-$5 7 | -------------------------------------------------------------------------------- /1.0/trafficserver-5-3-2/etc/clientaccesspolicy.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /1.0/trafficserver-5-3-2/etc/crossdomain.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /1.0/trafficserver-5-3-2/etc/dmotion.regex: -------------------------------------------------------------------------------- 1 | .*/tcshost/(.*)/tcskey/.*//(.*)ts$ http://$1/$2ts 2 | .*/tcshost/(.*)/tcskey/.*//(.*)flv$ http://$1/$2flv 3 | .*/tcshost/(.*)/tcskey/.*//(.*)mnft$ http://$1/$2mnft 4 | -------------------------------------------------------------------------------- /1.0/trafficserver-5-3-2/etc/ip_allow.config: -------------------------------------------------------------------------------- 1 | # ip_allow.config 2 | # 3 | # Rules: 4 | # src_ip= action= [method=] 5 | # 6 | # Actions: ip_allow, ip_deny 7 | # 8 | # Multiple method keywords can be specified (method=GET method=HEAD), or 9 | # multiple methods can be separated by an '|' (method=GET|HEAD). The method 10 | # keyword is optional and it is defaulted to ALL. 11 | # Available methods: ALL, GET, CONNECT, DELETE, HEAD, ICP_QUERY, OPTIONS, 12 | # POST, PURGE, PUT, TRACE, PUSH 13 | # 14 | # Rules are applied in the order listed starting from the top. 15 | # That means you generally want to append your rules after the ones listed here. 16 | # 17 | # Allow anything on localhost (this is the default configuration based on the 18 | # depricated CONFIG proxy.config.http.quick_filter.mask INT 0x482) 19 | src_ip=127.0.0.1 action=ip_allow method=ALL 20 | src_ip=::1 action=ip_allow method=ALL 21 | src_ip=0.0.0.0-255.255.255.255 action=ip_allow method=ALL 22 | # Deny PURGE, DELETE, and PUSH for all (this implies allow other methods for all) 23 | # src_ip=0.0.0.0-255.255.255.255 action=ip_deny method=PUSH|PURGE|DELETE 24 | # src_ip=::-ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff action=ip_deny method=PUSH|PURGE|DELETE 25 | -------------------------------------------------------------------------------- /1.0/trafficserver-5-3-2/etc/plugin.config: -------------------------------------------------------------------------------- 1 | # Comments start with a '#' and continue to the end of the line 2 | # Blank lines are ignored 3 | # 4 | # test-plugin.so arg1 arg2 arg3 5 | # 6 | # Example: 7 | #inktomi/iwx/iwx.so 8 | #inktomi/abuse/abuse.so etc/trafficserver/abuse.config 9 | #inktomi/icx/icx.so etc/trafficserver/icx.config 10 | 11 | ### added by lcs #### 12 | cache-hndl-v1.so cacheurl.config 13 | -------------------------------------------------------------------------------- /1.0/trafficserver-5-3-2/plugins-ccur/cache-hndl/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all clean 2 | 3 | all: cache-hndl-v1.so cache-hndl-v2.so cache-hndl-v3.so 4 | 5 | CXX=g++ 6 | # CXX=/opt/centos/devtoolset-1.1/root/usr/bin/c++ 7 | # CCFLAGS=-I../../lib -I../../proxy/api/ts -I../include -D__STDC_FORMAT_MACROS -std=gnu++11 8 | CCFLAGS=-I/usr/local/include/ts -I../include -D__STDC_FORMAT_MACROS -std=gnu++11 9 | 10 | cache-hndl-v1.o: cache-hndl-v1.cc ../include/ccur_remap.h 11 | $(CXX) $(CCFLAGS) -o$@ -Wall -Werror -fPIC -c $< 12 | # $(CXX) $(CCFLAGS) -o$@ -Werror -fPIC -c $< 13 | 14 | cache-hndl-v2.o: cache-hndl-v2.cc ../include/ccur_remap.h 15 | $(CXX) $(CCFLAGS) -o$@ -Wall -Werror -fPIC -c $< 16 | # $(CXX) $(CCFLAGS) -o$@ -Werror -fPIC -c $< 17 | 18 | cache-hndl-v3.o: cache-hndl-v3.cc ../include/ccur_remap.h 19 | $(CXX) $(CCFLAGS) -o$@ -Wall -Werror -fPIC -c $< 20 | # $(CXX) $(CCFLAGS) -o$@ -Werror -fPIC -c $< 21 | 22 | cache-hndl-v1.so: cache-hndl-v1.o 23 | $(CXX) -lboost_regex -shared -o $@ $< 24 | 25 | cache-hndl-v2.so: cache-hndl-v2.o 26 | $(CXX) -lboost_regex -shared -o $@ $< 27 | 28 | cache-hndl-v3.so: cache-hndl-v3.o 29 | $(CXX) -lboost_regex -shared -o $@ $< 30 | 31 | install-v1: cache-hndl-v1.so 32 | cp cache-hndl-v1.so /usr/local/libexec/trafficserver 33 | 34 | install-v2: cache-hndl-v2.so 35 | cp cache-hndl-v2.so /usr/local/libexec/trafficserver 36 | 37 | install-v3: cache-hndl-v3.so 38 | cp cache-hndl-v3.so /usr/local/libexec/trafficserver 39 | 40 | install: cache-hndl-v1.so cache-hndl-v2.so cache-hndl-v3.so 41 | cp cache-hndl-v1.so /usr/local/libexec/trafficserver 42 | cp cache-hndl-v2.so /usr/local/libexec/trafficserver 43 | cp cache-hndl-v3.so /usr/local/libexec/trafficserver 44 | 45 | clean: 46 | rm -rf *.o *.so *.lo 47 | -------------------------------------------------------------------------------- /1.0/trafficserver-5-3-2/plugins-ccur/cache-hndl/README: -------------------------------------------------------------------------------- 1 | These plugins Provide access to th trafficserver cache from a web browser. 2 | 3 | cache-hndl-v1.so is activated by modifing the plugin.config as: 4 | 5 | # activate cache-hndl-v1.so plugin ... 6 | cache-hndl-v1.so cacheurl.config 7 | 8 | cache-hndl-v2.so and cache-hndl-v3.so are activated from the remap.config as: 9 | 10 | # activate cache-hndl-v3.so plugin ... 11 | map http://127.0.0.1:9090/cache-handler/ http://127.0.0.1:9090/cache-handler/ \ 12 | @plugin=cache-hndl-v3.so @pparam=cacheurl.config 13 | 14 | map http://10.75.25.179:9090/cache-handler/ http://10.75.25.179:9090/cache-handler/ \ 15 | @plugin=cache-hndl-v3.so @pparam=cacheurl.config 16 | 17 | Only activate one of the plugin at a time!!! 18 | -------------------------------------------------------------------------------- /1.0/trafficserver-5-3-2/plugins-ccur/remap-hndl/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all clean 2 | 3 | all: remap-hndl.so 4 | 5 | CXX=g++ 6 | # CXX=/opt/centos/devtoolset-1.1/root/usr/bin/c++ 7 | 8 | CCFLAGS=-I/usr/local/include/ts -I../include \ 9 | -D__STDC_FORMAT_MACROS -std=gnu++11 10 | 11 | remap-hndl.o: remap-hndl.cc ../include/ccur_remap.h 12 | $(CXX) $(CCFLAGS) -o$@ -Wall -Werror -fPIC -c $< 13 | # $(CXX) $(CCFLAGS) -o$@ -Werror -fPIC -c $< 14 | 15 | remap-hndl.so: remap-hndl.o 16 | $(CXX) -lboost_regex -shared -o $@ $< 17 | 18 | install: remap-hndl.so 19 | cp remap-hndl.so /usr/local/libexec/trafficserver 20 | 21 | clean: 22 | rm -rf *.o *.so *.lo 23 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Laguna 2 | Copyright 2015 Concurrent Computer Corporation 3 | 4 | This product includes software developed at Concurrent (http://www.concurrent.com/). 5 | --------------------------------------------------------------------------------