Sync with 5.1.0
[deliverable/titan.core.git] / regression_test / implicitMsgEncoding / PCOType.cc
1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2000-2014 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 v1.0
5 // which accompanies this distribution, and is available at
6 // http://www.eclipse.org/legal/epl-v10.html
7 ///////////////////////////////////////////////////////////////////////////////
8 // This Test Port skeleton source file was generated by the
9 // TTCN-3 Compiler of the TTCN-3 Test Executor version 1.7.pre0 build 8
10 // for edmdeli (edmdeli@EGNA8004JPBUT7R) on Thu Mar 1 14:45:21 2007
11
12
13 // You may modify this file. Complete the body of empty functions and
14 // add your member functions here.
15
16 #include <stdio.h>
17
18 #include "PCOType.hh"
19 #include "TimplicitEnc.hh"
20
21 #include <memory.h>
22
23 #ifndef OLD_NAMES
24 namespace TimplicitEnc {
25 #endif
26
27 PCOType_PROVIDER::PCOType_PROVIDER(const char *par_port_name)
28 : PORT(par_port_name)
29 {
30
31 }
32
33 PCOType_PROVIDER::~PCOType_PROVIDER()
34 {
35
36 }
37
38 void PCOType_PROVIDER::set_parameter(const char *parameter_name,
39 const char *parameter_value)
40 {
41
42 }
43
44 void PCOType_PROVIDER::Event_Handler(const fd_set *read_fds,
45 const fd_set *write_fds, const fd_set *error_fds,
46 double time_since_last_call)
47 {
48 size_t buf_len = 0, buf_size = 32;
49 char *buf = (char*)Malloc(buf_size);
50 for ( ; ; ) {
51 int c = getc(stdin);
52 if (c == EOF) {
53 if (buf_len > 0) incoming_message(CHARSTRING(buf_len, buf));
54 Uninstall_Handler();
55 break;
56 } else if (c == '\n') {
57 incoming_message(CHARSTRING(buf_len, buf));
58 break;
59 } else {
60 if (buf_len >= buf_size) {
61 buf_size *= 2;
62 buf = (char*)Realloc(buf, buf_size);
63 }
64 buf[buf_len++] = c;
65 }
66 }
67 Free(buf);
68 }
69
70 void PCOType_PROVIDER::user_map(const char *system_port)
71 {
72 fd_set readfds;
73 FD_ZERO(&readfds);
74 FD_SET(0, &readfds);
75 Install_Handler(&readfds, NULL, NULL, 0.0);
76
77 //start with sending an octetstring that cannot be decoded to MyPDU
78 const OCTETSTRING myBadOctets = str2oct("FFFFFFFFFFFFFF");
79 incoming_message(myBadOctets);
80 }
81
82 void PCOType_PROVIDER::user_unmap(const char *system_port)
83 {
84 Uninstall_Handler();
85 }
86
87 void PCOType_PROVIDER::user_start()
88 {
89
90 }
91
92 void PCOType_PROVIDER::user_stop()
93 {
94
95 }
96
97 void PCOType_PROVIDER::outgoing_send(const CHARSTRING& send_par)
98 {
99 incoming_message(send_par);
100 }
101
102 void PCOType_PROVIDER::outgoing_send(const OCTETSTRING& send_par)
103 {
104 incoming_message(send_par);
105 }
106
107 #ifndef OLD_NAMES
108 } /* end of namespace */
109 #endif
This page took 0.033957 seconds and 5 git commands to generate.