| 1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2000-2021 Ericsson Telecom AB |
| 3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v2.0 |
| 5 |
* which accompanies this distribution, and is available at |
| 6 |
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html |
| 7 |
* |
| 8 |
* Contributors: |
| 9 |
* Zoltan Janos Szabo (Ericsson) - initial architecture design and implementation |
| 10 |
* Roland Gecse (Ericsson) - initial architecture design |
| 11 |
* Akos Cserveni (Ericsson) - Basic AST in compiler, semantic checking |
| 12 |
* Gabor Szalai (Ericsson) – RAW and TEXT codecs |
| 13 |
* Matyas Forstner (Ericsson) - ASN.1 extension of the compiler and BER/CER/DER codecs |
| 14 |
* Kristof Szabados (Ericsson) - Eclipse Designer, Executor, Titanium UIs |
| 15 |
* Szabolcs Beres (Ericsson) - Eclipse LogViewer |
| 16 |
* Ferenc Kovacs (Ericsson) – log interfaces, big number support, subtype checking |
| 17 |
* Csaba Raduly (Ericsson) – ASN.1 additions, XML encoder/decoder |
| 18 |
* Adam Delic (Ericsson) – template restrictions, try&catch, support of pre-processor directives in Eclipse |
| 19 |
* Krisztian Pandi (Ericsson) – import of imports |
| 20 |
* Peter Dimitrov (Ericsson)- maintenance |
| 21 |
* Balazs Andor Zalanyi (Ericsson) – code splitting |
| 22 |
* Gabor Szalai (Ericsson) – RAW encoding/decoding |
| 23 |
* Jeno Attila Balasko (Ericsson) – tests |
| 24 |
* Csaba Feher (Ericsson) – epoll support |
| 25 |
* Tamas Buti (Ericsson)- maintenance |
| 26 |
* Matyas Ormandi (Ericsson) - maintenance |
| 27 |
* Botond Baranyi (Ericsson) - JSON encoder |
| 28 |
* Arpad Lovassy (Ericsson) - Java Executor API |
| 29 |
* Laszlo Baji (Ericsson) - maintenance |
| 30 |
* Marton Godar (Ericsson) - xsd2ttcn converter |
| 31 |
*******************************************************************************/ |
| 32 |
// |
| 33 |
// File: PIPEasp_PT.hh |
| 34 |
// Description: Header file of PIPE testport implementation |
| 35 |
// Rev: <RnXnn> |
| 36 |
// Prodnr: CNL 113 334 |
| 37 |
// Updated: 2008-06-03 |
| 38 |
// Contact: http://ttcn.ericsson.se |
| 39 |
// |
| 40 |
|
| 41 |
|
| 42 |
#ifndef PIPEasp__PT_HH |
| 43 |
#define PIPEasp__PT_HH |
| 44 |
|
| 45 |
#include "PIPEasp_PortType.hh" |
| 46 |
|
| 47 |
namespace PIPEasp__PortType { |
| 48 |
|
| 49 |
class PIPEasp__PT : public PIPEasp__PT_BASE { |
| 50 |
public: |
| 51 |
PIPEasp__PT(const char *par_port_name = NULL); |
| 52 |
~PIPEasp__PT(); |
| 53 |
|
| 54 |
void set_parameter(const char *parameter_name, |
| 55 |
const char *parameter_value); |
| 56 |
|
| 57 |
void Event_Handler(const fd_set *read_fds, |
| 58 |
const fd_set *write_fds, const fd_set *error_fds, |
| 59 |
double time_since_last_call); |
| 60 |
|
| 61 |
protected: |
| 62 |
void user_map(const char *system_port); |
| 63 |
void user_unmap(const char *system_port); |
| 64 |
|
| 65 |
void user_start(); |
| 66 |
void user_stop(); |
| 67 |
|
| 68 |
void outgoing_send(const PIPEasp__Types::ASP__PExecute& send_par); |
| 69 |
void outgoing_send(const PIPEasp__Types::ASP__PExecuteBinary& send_par); |
| 70 |
void outgoing_send(const PIPEasp__Types::ASP__PExecuteBackground& send_par); |
| 71 |
void outgoing_send(const PIPEasp__Types::ASP__PStdin& send_par); |
| 72 |
void outgoing_send(const PIPEasp__Types::ASP__PStdinBinary& send_par); |
| 73 |
void outgoing_send(const PIPEasp__Types::ASP__PKill& send_par); |
| 74 |
void outgoing_send(const PIPEasp__Types::ASP__PLineMode& send_par); |
| 75 |
void outgoing_send(const PIPEasp__Types::ASP__PEndOfInput& send_par); |
| 76 |
private: |
| 77 |
int execCommand(const char* command); |
| 78 |
void handle_childDeath(); |
| 79 |
void sendStdout(); |
| 80 |
void sendStderr(); |
| 81 |
void sendExitCode(); |
| 82 |
void sendResult(); |
| 83 |
void sendError(const char* error_msg); |
| 84 |
void log(const char *fmt, ...); |
| 85 |
|
| 86 |
private: |
| 87 |
bool lineMode; // true if lineMode is enabled |
| 88 |
bool processExecuting; // true if process is executing: disable new processes |
| 89 |
bool binaryMode; // true if result should be returned in as binary data |
| 90 |
bool disableSend; // if true sendStdout/err is disabled |
| 91 |
|
| 92 |
fd_set readfds; // fd set for event handler |
| 93 |
int processPid; // pid of the process currently executing |
| 94 |
int processStdin; // fd of stdin of the process |
| 95 |
int processStdout; // fd of stdout of the process |
| 96 |
int processStderr; // fd of stderr of the process |
| 97 |
|
| 98 |
TTCN_Buffer stdout_buffer; // data sent to stdout |
| 99 |
TTCN_Buffer stderr_buffer; // data sent to stderr |
| 100 |
int processExitCode; // exit code of the process |
| 101 |
|
| 102 |
}; |
| 103 |
|
| 104 |
}//namespace |
| 105 |
|
| 106 |
#endif |