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