Codebase of Fwknop client for iOS (iPhone) devices

This commit is contained in:
Max Kastanas 2011-09-16 22:51:53 -07:00
parent 35abc349ab
commit 668ed9033f
24 changed files with 6647 additions and 0 deletions

340
iphone/COPYING Executable file
View File

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@ -0,0 +1,30 @@
/*
Copyright (C) Max Kastanas 2010
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#import <UIKit/UIKit.h>
@interface EditableViewController : UIViewController <UITextFieldDelegate>
{
NSString *_itemValue;
}
@property (nonatomic, retain) NSString *itemValue;
- (void)save;
@end

309
iphone/Classes/FwknopController.m Executable file
View File

@ -0,0 +1,309 @@
/*
Copyright (C) Max Kastanas 2010
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#import "FwknopController.h"
@implementation EditableViewController
@synthesize itemValue = _itemValue;
- (void)loadView
{
[super loadView];
CGFloat margin = 20.0;
CGRect viewRect = { margin, 40.0, 280.0, 400.0 };
UIView *view = [[UIView alloc] initWithFrame:viewRect];
[view setBackgroundColor:[UIColor lightGrayColor]];
[view setOpaque:YES];
[self setView:view];
//HEADER
CGRect labelHeaderRect = { margin + 60, 15.0, 120.0, 28.0 };
UILabel *labelHeader = [[UILabel alloc] initWithFrame:labelHeaderRect];
[labelHeader setBackgroundColor:[UIColor lightGrayColor]];
[labelHeader setTextColor:[UIColor darkGrayColor]];
[labelHeader setFont:[UIFont boldSystemFontOfSize:16.0]];
[labelHeader setOpaque:YES];
[labelHeader setText:@"Fwknop Client"];
[view addSubview:labelHeader];
//allow ip
CGRect labelRect = { margin, 50.0, 120.0, 28.0 };
UILabel *label = [[UILabel alloc] initWithFrame:labelRect];
[label setBackgroundColor:[UIColor lightGrayColor]];
[label setTextColor:[UIColor darkGrayColor]];
[label setFont:[UIFont boldSystemFontOfSize:16.0]];
[label setOpaque:YES];
[label setText:@"Allow IP:"];
[view addSubview:label];
CGRect textFieldRect = { margin + 120, 50.0, 120.0, 28.0 };
UITextField *textField = [[UITextField alloc] initWithFrame:textFieldRect];
[textField setBackgroundColor:[UIColor whiteColor]];
[textField setBorderStyle:UITextBorderStyleBezel];
[textField setOpaque:YES];
[textField setPlaceholder:@"0.0.0.0"];
[textField setText:@"0.0.0.0"];
//[textField setReturnKeyType:UIReturnKeyDone];
//[textField setEnablesReturnKeyAutomatically:YES];
[textField setTag:1];
[textField setDelegate:self];
[view addSubview:textField];
//access protocol
CGRect labelAccessProtoRect = { margin, 85.0, 120.0, 28.0 };
UILabel *labelAccessProto = [[UILabel alloc] initWithFrame:labelAccessProtoRect];
[labelAccessProto setBackgroundColor:[UIColor lightGrayColor]];
[labelAccessProto setTextColor:[UIColor darkGrayColor]];
[labelAccessProto setFont:[UIFont boldSystemFontOfSize:16.0]];
[labelAccessProto setOpaque:YES];
[labelAccessProto setText:@"Access Protocol:"];
[view addSubview:labelAccessProto];
CGRect textFieldAccessProtoRect = { margin + 120, 85.0, 120.0, 28.0 };
UITextField *textFieldAccessProto = [[UITextField alloc] initWithFrame:textFieldAccessProtoRect];
[textFieldAccessProto setBackgroundColor:[UIColor whiteColor]];
[textFieldAccessProto setBorderStyle:UITextBorderStyleBezel];
[textFieldAccessProto setOpaque:YES];
[textFieldAccessProto setPlaceholder:@"tcp/udp"];
[textFieldAccessProto setText:@"tcp"];
[textFieldAccessProto setReturnKeyType:UIReturnKeyDone];
[textFieldAccessProto setEnablesReturnKeyAutomatically:YES];
[textFieldAccessProto setTag:4];
[textFieldAccessProto setDelegate:self];
[view addSubview:textFieldAccessProto];
//access port
CGRect labelAccessPortRect = { margin, 120.0, 120.0, 28.0 };
UILabel *labelAccessPort = [[UILabel alloc] initWithFrame:labelAccessPortRect];
[labelAccessPort setBackgroundColor:[UIColor lightGrayColor]];
[labelAccessPort setTextColor:[UIColor darkGrayColor]];
[labelAccessPort setFont:[UIFont boldSystemFontOfSize:16.0]];
[labelAccessPort setOpaque:YES];
[labelAccessPort setText:@"Access Port:"];
[view addSubview:labelAccessPort];
CGRect textFieldAccessPortRect = { margin + 120, 120.0, 120.0, 28.0 };
UITextField *textFieldAccessPort = [[UITextField alloc] initWithFrame:textFieldAccessPortRect];
[textFieldAccessPort setBackgroundColor:[UIColor whiteColor]];
[textFieldAccessPort setBorderStyle:UITextBorderStyleBezel];
[textFieldAccessPort setOpaque:YES];
[textFieldAccessPort setPlaceholder:@"22"];
[textFieldAccessPort setText:@"22"];
[textFieldAccessPort setReturnKeyType:UIReturnKeyDone];
[textFieldAccessPort setEnablesReturnKeyAutomatically:YES];
[textFieldAccessPort setTag:5];
[textFieldAccessPort setDelegate:self];
[view addSubview:textFieldAccessPort];
//Server Address
CGRect labelServerAddrRect = { margin, 155.0, 120.0, 28.0 };
UILabel *labelServerAddr = [[UILabel alloc] initWithFrame:labelServerAddrRect];
[labelServerAddr setBackgroundColor:[UIColor lightGrayColor]];
[labelServerAddr setTextColor:[UIColor darkGrayColor]];
[labelServerAddr setFont:[UIFont boldSystemFontOfSize:16.0]];
[labelServerAddr setOpaque:YES];
[labelServerAddr setText:@"Server Address"];
[view addSubview:labelServerAddr];
CGRect textFieldServerAddrRect = { margin + 120, 155.0, 120.0, 28.0 };
UITextField *textFieldServerAddr = [[UITextField alloc] initWithFrame:textFieldServerAddrRect];
[textFieldServerAddr setBackgroundColor:[UIColor whiteColor]];
[textFieldServerAddr setBorderStyle:UITextBorderStyleBezel];
[textFieldServerAddr setOpaque:YES];
[textFieldServerAddr setPlaceholder:@"Server"];
[textFieldServerAddr setText:@""];
[textFieldServerAddr setReturnKeyType:UIReturnKeyDone];
[textFieldServerAddr setEnablesReturnKeyAutomatically:YES];
[textFieldServerAddr setTag:6];
[textFieldServerAddr setDelegate:self];
[view addSubview:textFieldServerAddr];
//Rijndael key
CGRect labelRijndaelKeyRect = { margin, 190.0, 120.0, 28.0 };
UILabel *labelRijndaelKey = [[UILabel alloc] initWithFrame:labelRijndaelKeyRect];
[labelRijndaelKey setBackgroundColor:[UIColor lightGrayColor]];
[labelRijndaelKey setTextColor:[UIColor darkGrayColor]];
[labelRijndaelKey setFont:[UIFont boldSystemFontOfSize:16.0]];
[labelRijndaelKey setOpaque:YES];
[labelRijndaelKey setText:@"Rijndael Key:"];
[view addSubview:labelRijndaelKey];
CGRect textFieldRijndaelKeyRect = { margin + 120, 190.0, 120.0, 28.0 };
UITextField *textFieldRijndaelKey = [[UITextField alloc] initWithFrame:textFieldRijndaelKeyRect];
[textFieldRijndaelKey setBackgroundColor:[UIColor whiteColor]];
[textFieldRijndaelKey setBorderStyle:UITextBorderStyleBezel];
[textFieldRijndaelKey setOpaque:YES];
[textFieldRijndaelKey setPlaceholder:@"Key"];
[textFieldRijndaelKey setText:@""];
[textFieldRijndaelKey setSecureTextEntry:YES];
[textFieldRijndaelKey setReturnKeyType:UIReturnKeyDone];
[textFieldRijndaelKey setEnablesReturnKeyAutomatically:YES];
[textFieldRijndaelKey setTag:7];
[textFieldRijndaelKey setDelegate:self];
[view addSubview:textFieldRijndaelKey];
//Rijndael key
CGRect labelTimeoutRect = { margin, 225.0, 120.0, 28.0 };
UILabel *labelTimeout = [[UILabel alloc] initWithFrame:labelTimeoutRect];
[labelTimeout setBackgroundColor:[UIColor lightGrayColor]];
[labelTimeout setTextColor:[UIColor darkGrayColor]];
[labelTimeout setFont:[UIFont boldSystemFontOfSize:16.0]];
[labelTimeout setOpaque:YES];
[labelTimeout setText:@"Timeout: "];
[view addSubview:labelTimeout];
CGRect textFieldTimeoutRect = { margin + 120, 225.0, 120.0, 28.0 };
UITextField *textFieldTimeout = [[UITextField alloc] initWithFrame:textFieldTimeoutRect];
[textFieldTimeout setBackgroundColor:[UIColor whiteColor]];
[textFieldTimeout setBorderStyle:UITextBorderStyleBezel];
[textFieldTimeout setOpaque:YES];
[textFieldTimeout setPlaceholder:@"timeout"];
[textFieldTimeout setText:@"60"];
[textFieldTimeout setReturnKeyType:UIReturnKeyDone];
[textFieldTimeout setEnablesReturnKeyAutomatically:YES];
[textFieldTimeout setTag:8];
[textFieldTimeout setDelegate:self];
[view addSubview:textFieldTimeout];
//Status
CGRect labelRect2 = { margin, 300.0, 120.0, 24.0 };
UILabel *label2 = [[UILabel alloc] initWithFrame:labelRect2];
[label2 setBackgroundColor:[UIColor lightGrayColor]];
[label2 setOpaque:YES];
[label2 setTextColor:[UIColor grayColor]];
[label2 setText:@"Status:"];
[view addSubview:label2];
CGRect textFieldRect2 = { 135.0, 302.0, 120.0, 28.0 };
UITextField *textField2 = [[UITextField alloc] initWithFrame:textFieldRect2];
[textField2 setBackgroundColor:[UIColor lightGrayColor]];
[textField2 setTextColor:[UIColor grayColor]];
[textField2 setEnabled:NO];
[textField2 setBorderStyle:UITextBorderStyleNone];
[textField2 setOpaque:YES];
[textField2 setText:@""];
[textField2 setTag:2];
[view addSubview:textField2];
//Send SPA
CGFloat width = 60.0;
CGFloat x = [view center].x - (width / 2.0) - (margin / 2.0);
CGRect buttonRect = { x, 360.0, width, 24.0 };
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button setFrame:buttonRect];
[button setTitle:@"Send" forState:UIControlStateNormal];
[button addTarget:self
action:@selector(save)
forControlEvents:UIControlEventTouchUpInside];
[view addSubview:button];
[view release];
[label release];
[textField release];
}
int sendSPA(NSString * allowip, NSString * proto,
NSString * port, NSString * server,
NSString * key, NSString * timeout){
char allowipStr[215];
strcpy(allowipStr,[allowip UTF8String]);
char accessStr[215];
strcpy(accessStr,[proto UTF8String]);
strcat(accessStr,"/");
strcat(accessStr,[port UTF8String]);
char serverStr[215];
strcpy(serverStr,[server UTF8String]);
char keyStr[215];
strcpy(keyStr,[key UTF8String]);
char timeoutStr[215];
strcpy(timeoutStr,[timeout UTF8String]);
int res = run_fwknop(allowipStr, accessStr, serverStr, keyStr, timeoutStr);
return res;
}
- (void)save
{
//allowip
UITextField *textField1 = (UITextField *)[[self view] viewWithTag:1];
NSString *text = [textField1 text];
[textField1 resignFirstResponder];
NSLog(@"TextField: %@\nValue: %@", textField1, text);
UITextField *textField2 = (UITextField *)[[self view] viewWithTag:2];
//[textField2 setText:text];
//proto
UITextField *textFieldproto = (UITextField *)[[self view] viewWithTag:4];
NSString *textProto = [textFieldproto text];
//port
UITextField *textFieldport = (UITextField *)[[self view] viewWithTag:5];
NSString *textPort = [textFieldport text];
//server
UITextField *textFieldserver = (UITextField *)[[self view] viewWithTag:6];
NSString *textServer = [textFieldserver text];
//key
UITextField *textFieldkey = (UITextField *)[[self view] viewWithTag:7];
NSString *textKey = [textFieldkey text];
//timeout
UITextField *textFieldtimeout = (UITextField *)[[self view] viewWithTag:8];
NSString *textTimeout = [textFieldtimeout text];
int res = sendSPA(text, textProto, textPort, textServer, textKey, textTimeout );
if(res > 0)
[textField2 setText:@"PACKET SENT"];
else
[textField2 setText:@"ERROR"];
[self setItemValue:@""];
}
#pragma mark -
#pragma mark UITextFieldDelegate Protocol
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
NSLog(@"In %s -- calling save", _cmd);
[textField resignFirstResponder];
//[self save];
return YES;
}
@end

33
iphone/Classes/MyAppDelegate.h Executable file
View File

@ -0,0 +1,33 @@
/*
Copyright (C) Max Kastanas 2010
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#import <UIKit/UIKit.h>
@class EditableViewController;
@interface MyAppDelegate : NSObject <UIApplicationDelegate>
{
UIWindow *_window;
EditableViewController *_viewController;
}
@property (nonatomic, retain) UIWindow *window;
@property (nonatomic, retain) EditableViewController *viewController;
@end

53
iphone/Classes/MyAppDelegate.m Executable file
View File

@ -0,0 +1,53 @@
/*
Copyright (C) Max Kastanas 2010
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#import "MyAppDelegate.h"
#import "FwknopController.h"
@implementation MyAppDelegate
@synthesize window = _window;
@synthesize viewController = _viewController;
- (void)dealloc
{
[_window release];
[super dealloc];
}
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
CGRect windowRect = [[UIScreen mainScreen] bounds];
UIWindow *window = [[UIWindow alloc] initWithFrame:windowRect];
[window setBackgroundColor:[UIColor grayColor]];
[self setWindow:window];
EditableViewController *viewController = [[EditableViewController alloc]
initWithNibName:nil
bundle:nil];
[self setViewController:viewController];
[window addSubview:[viewController view]];
[window makeKeyAndVisible];
[viewController release];
[window release];
}
@end

View File

@ -0,0 +1,28 @@
/*
Copyright (C) Max Kastanas 2010
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "bridge_fwknop.h"
#include <stdio.h>
int run_fwknop(char * allowip, char * accessStr, char * server, char * key, char * timeout){
printf("Running fwknop with Options: %s:%s:%s:%s:%s\n", allowip, accessStr,server,key, timeout);
int res = fwknop_sendSPAPacket(allowip, accessStr,server,key,timeout);
return res;
}

View File

@ -0,0 +1,21 @@
/*
Copyright (C) Max Kastanas 2010
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
int run_fwknop(char * allowip, char * accessStr, char * server, char * key, char * timeout);

346
iphone/Classes/config.h Normal file
View File

@ -0,0 +1,346 @@
/*
Copyright (C) Max Kastanas 2010
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef FWKNOP_CONFIG_H
#define FWKNOP_CONFIG_H
/* Define if building universal (internal helper macro) */
/* #undef AC_APPLE_UNIVERSAL_BUILD */
/* Path to firewall command executable (it should match the firewall type). */
#define FIREWALL_EXE "/sbin/iptables"
/* The firewall type: ipf. */
/* #undef FIREWALL_IPF */
/* The firewall type: ipfw. */
/* #undef FIREWALL_IPFW */
/* The firewall type: iptables. */
#define FIREWALL_IPTABLES 1
/* Path to gpg executable */
#define GPG_EXE "/usr/bin/gpg"
/* Define to 1 if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H 1
/* Define to 1 if you have the <arpa/nameser.h> header file. */
#define HAVE_ARPA_NAMESER_H 1
/* Define to 1 if you have the `bzero' function. */
#define HAVE_BZERO 1
/* Define to 1 if you have the <ctype.h> header file. */
#define HAVE_CTYPE_H 1
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the <endian.h> header file. */
#define HAVE_ENDIAN_H 1
/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
/* Define to 1 if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define if you have libgdbm */
#define HAVE_LIBGDBM 1
/* Define if you have libgpgme */
/* #undef HAVE_LIBGPGME */
/* Define if you have libndbm */
/* #undef HAVE_LIBNDBM */
/* Define if you have libpcap */
#define HAVE_LIBPCAP 1
/* Define to 1 if you have the <locale.h> header file. */
#define HAVE_LOCALE_H 1
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
#define HAVE_MALLOC 1
/* Define to 1 if you have the `memmove' function. */
#define HAVE_MEMMOVE 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `memset' function. */
#define HAVE_MEMSET 1
/* Define to 1 if you have the <netdb.h> header file. */
#define HAVE_NETDB_H 1
/* Define to 1 if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1
/* Define to 1 if you have the <net/ethernet.h> header file. */
/* #undef HAVE_NET_ETHERNET_H */
/* Define to 1 if your system has a GNU libc compatible `realloc' function,
and to 0 otherwise. */
#define HAVE_REALLOC 1
/* Define to 1 if you have the <resolv.h> header file. */
#define HAVE_RESOLV_H 1
/* Define to 1 if you have the `socket' function. */
#define HAVE_SOCKET 1
/* Define to 1 if `stat' has the bug that it succeeds when given the
zero-length file name argument. */
/* #undef HAVE_STAT_EMPTY_STRING_BUG */
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `strchr' function. */
#define HAVE_STRCHR 1
/* Define to 1 if you have the `strcspn' function. */
#define HAVE_STRCSPN 1
/* Define to 1 if you have the `strdup' function. */
#define HAVE_STRDUP 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strncasecmp' function. */
#define HAVE_STRNCASECMP 1
/* Define to 1 if you have the `strndup' function. */
#define HAVE_STRNDUP 1
/* Define to 1 if you have the `strrchr' function. */
#define HAVE_STRRCHR 1
/* Define to 1 if you have the `strspn' function. */
#define HAVE_STRSPN 1
/* Define to 1 if you have the <sys/byteorder.h> header file. */
/* #undef HAVE_SYS_BYTEORDER_H */
/* Define to 1 if you have the <sys/endian.h> header file. */
/* #undef HAVE_SYS_ENDIAN_H */
/* Define to 1 if you have the <sys/ethernet.h> header file. */
/* #undef HAVE_SYS_ETHERNET_H */
/* Define to 1 if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/wait.h> header file. */
#define HAVE_SYS_WAIT_H 1
/* Define to 1 if you have the <termios.h> header file. */
#define HAVE_TERMIOS_H 1
/* Define to 1 if you have the <time.h> header file. */
#define HAVE_TIME_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
slash. */
#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#define LT_OBJDIR ".libs/"
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
/* #undef NO_MINUS_C_MINUS_O */
/* Name of package */
#define PACKAGE "fwknop"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "dstuart@dstuart.org"
/* Define to the full name of this package. */
#define PACKAGE_NAME "fwknop"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "fwknop 2.0.0rc2"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "fwknop"
/* Define to the version of this package. */
#define PACKAGE_VERSION "2.0.0rc2"
/* The size of `unsigned int', as computed by sizeof. */
#define SIZEOF_UNSIGNED_INT 4
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# define _ALL_SOURCE 1
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# define _POSIX_PTHREAD_SEMANTICS 1
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# define _TANDEM_SOURCE 1
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# define __EXTENSIONS__ 1
#endif
/* Version number of package */
#define VERSION "2.0.0rc2"
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
/* # undef WORDS_BIGENDIAN */
# endif
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
#define _FILE_OFFSET_BITS 64
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
/* Define to 1 if on MINIX. */
/* #undef _MINIX */
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
/* #undef _POSIX_1_SOURCE */
/* Define to 1 if you need to in order for `stat' and other things to work. */
/* #undef _POSIX_SOURCE */
/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
/* #undef _UINT32_T */
/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
/* #undef _UINT64_T */
/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
/* #undef _UINT8_T */
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define to the type of a signed integer type of width exactly 16 bits if
such a type exists and the standard includes do not define it. */
/* #undef int16_t */
/* Define to the type of a signed integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
/* #undef int32_t */
/* Define to the type of a signed integer type of width exactly 64 bits if
such a type exists and the standard includes do not define it. */
/* #undef int64_t */
/* Define to the type of a signed integer type of width exactly 8 bits if such
a type exists and the standard includes do not define it. */
/* #undef int8_t */
/* Define to rpl_malloc if the replacement function should be used. */
/* #undef malloc */
/* Define to `long int' if <sys/types.h> does not define. */
/* #undef off_t */
/* Define to `int' if <sys/types.h> does not define. */
/* #undef pid_t */
/* Define to rpl_realloc if the replacement function should be used. */
/* #undef realloc */
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */
/* Define to `int' if <sys/types.h> does not define. */
/* #undef ssize_t */
/* Define to the type of an unsigned integer type of width exactly 16 bits if
such a type exists and the standard includes do not define it. */
/* #undef uint16_t */
/* Define to the type of an unsigned integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
/* #undef uint32_t */
/* Define to the type of an unsigned integer type of width exactly 64 bits if
such a type exists and the standard includes do not define it. */
/* #undef uint64_t */
/* Define to the type of an unsigned integer type of width exactly 8 bits if
such a type exists and the standard includes do not define it. */
/* #undef uint8_t */
#endif /* FWKNOP_CONFIG_H */

View File

@ -0,0 +1,162 @@
/*
*****************************************************************************
*
* File: fwknop_client.c
*
* Author: Damien S. Stuart
*
* Purpose: An implementation of an fwknop client for Android.
*
* Copyright (C) 2010 Damien Stuart (dstuart@dstuart.org)
*
* License (GNU Public License):
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
*****************************************************************************
*/
//#include <jni.h>
#include "fwknop_client.h"
#include "fko.h"
/* Format error message.
*/
char *
fko_errmsg(char *msg, int res) {
static char err_msg[MSG_BUFSIZE+1] = {0};
snprintf(err_msg, MSG_BUFSIZE, "Error: %s: %i", msg, fko_errstr(res));
return(err_msg);
}
/* JNI interface: constructs arguments and calls main function
*/
int fwknop_sendSPAPacket(
const char *allowip_str,
const char *access_str,
const char *destip_str,
const char *passwd_str,
const char *fw_timeout_str
)
{
fko_ctx_t ctx;
fwknop_options_t opts;
int res;
char res_msg[MSG_BUFSIZE+1] = {0};
char spa_msg[MSG_BUFSIZE+1] = {0};
printf("**** Init fwknop ****\n");
memset(&opts, 0, sizeof(fwknop_options_t));
/* Sanity checks
*/
if(access_str == NULL) {
sprintf(res_msg, "Error: Invalid or missing access string");
goto cleanup2;
}
if(allowip_str == NULL) {
sprintf(res_msg, "Error: Invalid or missing allow IP");
goto cleanup2;
}
if(destip_str == NULL) {
sprintf(res_msg, "Error: Invalid or missing destination IP");
goto cleanup2;
}
if(passwd_str == NULL) {
sprintf(res_msg, "Error: Invalid or missing password");
goto cleanup2;
}
if(fw_timeout_str == NULL) {
sprintf(res_msg, "Error: Invalid or missing firewall timeout value");
goto cleanup2;
}
/* Set our spa server info
*/
opts.spa_server_str = (char*)destip_str;
opts.spa_dst_port = FKO_DEFAULT_PORT; /* Until we make this settable. */
/* Intialize the context
*/
res = fko_new(&ctx);
if (res != FKO_SUCCESS) {
strcpy(res_msg, fko_errmsg("Unable to create FKO context", res));
goto cleanup2;
}
/* Set client timeout
*/
res = fko_set_spa_client_timeout(ctx, atoi(fw_timeout_str));
if (res != FKO_SUCCESS) {
strcpy(res_msg, fko_errmsg("Error setting FW timeout", res));
goto cleanup;
}
/* Set the spa message string
*/
snprintf(spa_msg, MSG_BUFSIZE, "%s,%s", allowip_str, access_str);
res = fko_set_spa_message(ctx, spa_msg);
if (res != FKO_SUCCESS) {
strcpy(res_msg, fko_errmsg("Error setting SPA request message", res));
goto cleanup;
}
/* Finalize the context data (Encrypt and encode).
*/
res = fko_spa_data_final(ctx, (char*)passwd_str);
if (res != FKO_SUCCESS) {
strcpy(res_msg, fko_errmsg("Error generating SPA data", res));
goto cleanup;
}
res = fko_get_spa_data(ctx, &opts.spa_data);
if (res != FKO_SUCCESS) {
strcpy(res_msg, fko_errmsg("Error getting SPA data", res));
goto cleanup;
}
/* --DSS NOTE: At this point, we could just return the SPA data
* to the caller and use the Java network libs to send
* the packet and eliminate the spa_comm code altogether.
*/
/* Send the spa data packet
*/
res = send_spa_packet(&opts);
if (res < 0) {
sprintf(res_msg, "Error: send_spa_packet: packet not sent.");
} else if (res == 0) {
sprintf(res_msg, "Error: send_spa_packet: Empty packet sent.");
} else {
sprintf(res_msg, "SPA Packet sent successfully.");
}
cleanup:
/* Release the resources used by the fko context.
*/
fko_destroy(ctx);
cleanup2:
/* Log and return a string of success or error message.
* This can be enhanced semantically with codes.
*/
printf("%s\n", res_msg);
printf("**** Closing fwknop ****\n");
return res; // (*env)->NewStringUTF(env, res_msg);
}
/***EOF***/

View File

@ -0,0 +1,60 @@
/*
*****************************************************************************
*
* File: fwknop_client.h
*
* Author: Damien Stuart (dstuart@dstuart.org)
*
* Purpose: Header file for fwknop_client.c fwknop client for Android.
*
* Copyright (C) 2010 Damien Stuart (dstuart@dstuart.org)
*
* License (GNU Public License):
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
*****************************************************************************
*/
#ifndef FWKNOP_CLIENT_H
#define FWKNOP_CLIENT_H
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <ctype.h>
#include <sys/types.h>
#include "config.h"
#define FKO_DEFAULT_PORT 62201
#define MAX_PORT_STR_LEN 6
#define MAX_SERVER_STR_LEN 50
#define MSG_BUFSIZE 255
typedef u_int8_t uint8_t;
typedef u_int16_t uint16_t;
typedef u_int32_t uint32_t;
typedef struct fwknop_options
{
char *spa_server_str;
unsigned int spa_dst_port;
char *spa_data;
} fwknop_options_t;
/* Function Prototypes
*/
int send_spa_packet(fwknop_options_t *options);
#endif /* FWKNOP_CLIENT_H */

View File

@ -0,0 +1,94 @@
/*
*****************************************************************************
*
* File: send_spa_packet.c
*
* Author: Damien S. Stuart (dstuart@dstuart.org)
*
* Purpose: Function to send a SPA data packet out onto the network.
*
* Copyright (C) 2010 Damien Stuart (dstuart@dstuart.org)
*
* License (GNU Public License):
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
*****************************************************************************
*/
#include "fwknop_client.h"
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <netinet/in.h>
/* Send the SPA data via UDP packet.
*/
int
send_spa_packet(fwknop_options_t *options)
{
int sock, res=0, sd_len, error;
struct addrinfo *result, *rp, hints;
char port_str[MAX_PORT_STR_LEN];
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */
hints.ai_socktype = SOCK_DGRAM;
hints.ai_protocol = IPPROTO_UDP;
sprintf(port_str, "%d", options->spa_dst_port);
error = getaddrinfo(options->spa_server_str, port_str, &hints, &result);
if (error != 0)
{
printf("Error in getaddrinfo: %s\n", gai_strerror(error));
return -1;
}
for (rp = result; rp != NULL; rp = rp->ai_next) {
sock = socket(rp->ai_family, rp->ai_socktype,
rp->ai_protocol);
if (sock < 0)
continue;
if ((error = (connect(sock, rp->ai_addr, rp->ai_addrlen) != -1)))
break; /* made it */
close(sock);
}
if (rp == NULL)
{
printf("Error: Unable to create socket.");
return -1;
}
freeaddrinfo(result);
sd_len = strlen(options->spa_data);
res = send(sock, options->spa_data, sd_len, 0);
if(res < 0)
printf("send_spa_packet: write error: ");
else if(res != sd_len)
printf("Warning: bytes sent (%i) not spa data length (%i).\n",
res, sd_len
);
close(sock);
return(res);
}
/***EOF***/

View File

@ -0,0 +1,11 @@
README for the libfwknop directory (iphone/Classes/libfwknop)
===============================================================================
This directory should contain all of the .c and .h files from the fwknop
main distribution "lib" directory. These are the source files for libfko.
You can either manually copy the libfko source files to this directory,
or run the "get_libfko_files.sh script. Either way, the libfko *.[ch]
files need to exist in this directory before you attempt to build the Iphone
fwknop client.

View File

@ -0,0 +1,14 @@
/*
* config.h
* Fwknop
*
* Created by Dev on 9/16/11.
* Copyright 2011 __MyCompanyName__. All rights reserved.
*
*/
/* MACOSX: Need to set these for MACOSX*/
#define HAVE_SYS_TIME_H 1
#define IPHONE 1

View File

@ -0,0 +1,140 @@
/*
*****************************************************************************
*
* File: fko_common.h
*
* Author: Damien S. Stuart
*
* Purpose: Common header for libfko source files.
*
* Copyright 2009-2010 Damien Stuart (dstuart@dstuart.org)
*
* License (GNU Public License):
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
*****************************************************************************
*/
#ifndef FKO_COMMON_H
#define FKO_COMMON_H 1
#define HAVE_CONFIG_H 1
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <sys/types.h>
#if STDC_HEADERS
#include <stdlib.h>
#include <string.h>
#elif HAVE_STRINGS_H
#include <strings.h>
#endif /*STDC_HEADERS*/
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#if HAVE_CTYPE_H
#include <ctype.h> /* Using this for isdigit() */
#else
/* Fall-back does not account for locale */
#define isdigit(c) (c >= 48 && c <= 57)
#endif
#ifdef IPHONE
typedef u_int8_t uint8_t;
typedef u_int16_t uint16_t;
typedef u_int32_t uint32_t;
#endif
#ifdef WIN32
/* These are needed for the digest code under windows.
*/
typedef unsigned __int8 uint8_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
#define strdup _strdup
#else
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#endif
/* Work out endianess (sp?)
*/
#if HAVE_ENDIAN_H /* Should cover most Linux systems */
#include <endian.h>
#define BYTEORDER __BYTE_ORDER
#elif HAVE_SYS_ENDIAN_H /* FreeBSD has a sys/endian.h */
#include <sys/endian.h>
#define BYTEORDER _BYTE_ORDER
#elif HAVE_SYS_BYTEORDER_H /* Solaris (v10 at least) seems to have this */
#include <sys/byteorder.h>
#if defined(_BIG_ENDIAN)
#define BYTEORDER 4321
#elif defined(_LITTLE_ENDIAN)
#define BYTEORDER 1234
#else
#error unable to determine BYTEORDER
#endif
#endif
#ifdef WIN32
#include <time.h>
#else
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#ifdef TIME_WITH_SYS_TIME
#include <time.h>
#endif
#endif
#endif
/* Convenient macros for wrapping sections in 'extern "C" {' constructs.
*/
#ifdef __cplusplus
#define BEGIN_C_DECLS extern "C" {
#define END_C_DECLS }
#else /* !__cplusplus */
#define BEGIN_C_DECLS
#define END_C_DECLS
#endif /* __cplusplus */
/* Pull in gpgme.h if we have it.
*/
#if HAVE_LIBGPGME
#include <gpgme.h>
#endif
#include "fko_util.h"
#include "fko_limits.h"
#include "fko_state.h"
#include "fko_context.h"
/* Try to cover for those that do not have bzero.
*/
#if !HAVE_BZERO && HAVE_MEMSET
# define bzero(buf, bytes) ((void) memset (buf, 0, bytes))
#endif
#endif /* FKO_COMMON_H */
/***EOF***/

View File

@ -0,0 +1,38 @@
#!/bin/sh
#
# get_libfko_files.sh
#
# Copy each of the libfko source files in the fwknop source tree into this
# directory.
#
# Usage: ./get_libfko_files.sh [libfko-dir]
#
# Note: You should run this script only from this directory (libfwknop).
#
# If the libfko-dir argument is not given, this script will assume
# ../../../lib (which will work if this directory is still part
# of the original fwknop source distribution.
#
###############################################################################
#
LIBFKO_DIR=${1:-"../../../lib"} # Default relative path to libfko files.
# Simple sanity checks. See if the LIBFKO_DIR directory exists and see if
# thi "fko_context.h" is found there as well.
#
if [ ! -d "$LIBFKO_DIR" ] ; then
echo "Libfko directory: '$LIBFKO_DIR' was not found! Aborting."
exit 1
fi
if [ ! -e "${LIBFKO_DIR}/fko_context.h" ] ; then
echo "'$LIBFKO_DIR' does not seem to contain the required files! Aborting."
exit 1
fi
# Copy the files.
#
/bin/cp ${LIBFKO_DIR}/*.[ch] .
/bin/cp -f fko_common.b fko_common.h
###EOF###

33
iphone/Classes/logutils.h Normal file
View File

@ -0,0 +1,33 @@
/*
Copyright (C) Max Kastanas 2010
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef _LOGUTILS_H
#define _LOGUTILS_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif /* _LOGUTILS_H */

23
iphone/Fwknop.pch Executable file
View File

@ -0,0 +1,23 @@
/*
Copyright (C) Max Kastanas 2010
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,413 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 45;
objects = {
/* Begin PBXBuildFile section */
1D3623260D0F684500981E51 /* MyAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* MyAppDelegate.m */; };
1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; };
1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; };
ABA422DB0FEEBE4100C83D50 /* FwknopController.m in Sources */ = {isa = PBXBuildFile; fileRef = ABA422DA0FEEBE4100C83D50 /* FwknopController.m */; };
D779E41313CAF97A001CF276 /* bridge_fwknop.c in Sources */ = {isa = PBXBuildFile; fileRef = D779E41213CAF97A001CF276 /* bridge_fwknop.c */; };
D7E62BE113CBDD3700D44954 /* base64.c in Sources */ = {isa = PBXBuildFile; fileRef = D7E62BB213CBDD3700D44954 /* base64.c */; };
D7E62BE213CBDD3700D44954 /* cipher_funcs.c in Sources */ = {isa = PBXBuildFile; fileRef = D7E62BB413CBDD3700D44954 /* cipher_funcs.c */; };
D7E62BE313CBDD3700D44954 /* digest.c in Sources */ = {isa = PBXBuildFile; fileRef = D7E62BB613CBDD3700D44954 /* digest.c */; };
D7E62BE413CBDD3700D44954 /* fko_client_timeout.c in Sources */ = {isa = PBXBuildFile; fileRef = D7E62BB913CBDD3700D44954 /* fko_client_timeout.c */; };
D7E62BE513CBDD3700D44954 /* fko_decode.c in Sources */ = {isa = PBXBuildFile; fileRef = D7E62BBC13CBDD3700D44954 /* fko_decode.c */; };
D7E62BE613CBDD3700D44954 /* fko_digest.c in Sources */ = {isa = PBXBuildFile; fileRef = D7E62BBD13CBDD3700D44954 /* fko_digest.c */; };
D7E62BE713CBDD3700D44954 /* fko_encode.c in Sources */ = {isa = PBXBuildFile; fileRef = D7E62BBE13CBDD3700D44954 /* fko_encode.c */; };
D7E62BE813CBDD3700D44954 /* fko_encryption.c in Sources */ = {isa = PBXBuildFile; fileRef = D7E62BBF13CBDD3700D44954 /* fko_encryption.c */; };
D7E62BE913CBDD3700D44954 /* fko_error.c in Sources */ = {isa = PBXBuildFile; fileRef = D7E62BC013CBDD3700D44954 /* fko_error.c */; };
D7E62BEA13CBDD3700D44954 /* fko_funcs.c in Sources */ = {isa = PBXBuildFile; fileRef = D7E62BC113CBDD3700D44954 /* fko_funcs.c */; };
D7E62BEB13CBDD3700D44954 /* fko_message.c in Sources */ = {isa = PBXBuildFile; fileRef = D7E62BC313CBDD3700D44954 /* fko_message.c */; };
D7E62BEC13CBDD3700D44954 /* fko_nat_access.c in Sources */ = {isa = PBXBuildFile; fileRef = D7E62BC413CBDD3700D44954 /* fko_nat_access.c */; };
D7E62BED13CBDD3700D44954 /* fko_rand_value.c in Sources */ = {isa = PBXBuildFile; fileRef = D7E62BC513CBDD3700D44954 /* fko_rand_value.c */; };
D7E62BEE13CBDD3700D44954 /* fko_server_auth.c in Sources */ = {isa = PBXBuildFile; fileRef = D7E62BC613CBDD3700D44954 /* fko_server_auth.c */; };
D7E62BEF13CBDD3700D44954 /* fko_timestamp.c in Sources */ = {isa = PBXBuildFile; fileRef = D7E62BC813CBDD3700D44954 /* fko_timestamp.c */; };
D7E62BF013CBDD3700D44954 /* fko_user.c in Sources */ = {isa = PBXBuildFile; fileRef = D7E62BC913CBDD3700D44954 /* fko_user.c */; };
D7E62BF213CBDD3700D44954 /* gpgme_funcs.c in Sources */ = {isa = PBXBuildFile; fileRef = D7E62BCC13CBDD3700D44954 /* gpgme_funcs.c */; };
D7E62BF313CBDD3700D44954 /* md5.c in Sources */ = {isa = PBXBuildFile; fileRef = D7E62BCE13CBDD3700D44954 /* md5.c */; };
D7E62BF513CBDD3700D44954 /* rijndael.c in Sources */ = {isa = PBXBuildFile; fileRef = D7E62BD113CBDD3700D44954 /* rijndael.c */; };
D7E62BF613CBDD3700D44954 /* sha1.c in Sources */ = {isa = PBXBuildFile; fileRef = D7E62BD313CBDD3700D44954 /* sha1.c */; };
D7E62BF713CBDD3700D44954 /* sha2.c in Sources */ = {isa = PBXBuildFile; fileRef = D7E62BD513CBDD3700D44954 /* sha2.c */; };
D7E62BF813CBDD3700D44954 /* strlcat.c in Sources */ = {isa = PBXBuildFile; fileRef = D7E62BD713CBDD3700D44954 /* strlcat.c */; };
D7E62BF913CBDD3700D44954 /* strlcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = D7E62BD813CBDD3700D44954 /* strlcpy.c */; };
D7E62BFA13CBDD3700D44954 /* fwknop_client.c in Sources */ = {isa = PBXBuildFile; fileRef = D7E62BDA13CBDD3700D44954 /* fwknop_client.c */; };
D7E62BFB13CBDD3700D44954 /* send_spa_packet.c in Sources */ = {isa = PBXBuildFile; fileRef = D7E62BDC13CBDD3700D44954 /* send_spa_packet.c */; };
D7ED6D4114189DE00070A866 /* lock_57x57.png in Resources */ = {isa = PBXBuildFile; fileRef = D7ED6D4014189DE00070A866 /* lock_57x57.png */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
1D3623240D0F684500981E51 /* MyAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyAppDelegate.h; sourceTree = "<group>"; };
1D3623250D0F684500981E51 /* MyAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyAppDelegate.m; sourceTree = "<group>"; };
1D6058910D05DD3D006BFB54 /* Fwknop.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Fwknop.app; sourceTree = BUILT_PRODUCTS_DIR; };
1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
32CA4F630368D1EE00C91783 /* Fwknop.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Fwknop.pch; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
ABA422D90FEEBE4100C83D50 /* FwknopController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FwknopController.h; sourceTree = "<group>"; };
ABA422DA0FEEBE4100C83D50 /* FwknopController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FwknopController.m; sourceTree = "<group>"; };
D779E41213CAF97A001CF276 /* bridge_fwknop.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bridge_fwknop.c; sourceTree = "<group>"; };
D7E33C3E1424559A005D6CB6 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; };
D7E62BB213CBDD3700D44954 /* base64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = base64.c; sourceTree = "<group>"; };
D7E62BB313CBDD3700D44954 /* base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = base64.h; sourceTree = "<group>"; };
D7E62BB413CBDD3700D44954 /* cipher_funcs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cipher_funcs.c; sourceTree = "<group>"; };
D7E62BB513CBDD3700D44954 /* cipher_funcs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cipher_funcs.h; sourceTree = "<group>"; };
D7E62BB613CBDD3700D44954 /* digest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = digest.c; sourceTree = "<group>"; };
D7E62BB713CBDD3700D44954 /* digest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = digest.h; sourceTree = "<group>"; };
D7E62BB813CBDD3700D44954 /* fko.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fko.h; sourceTree = "<group>"; };
D7E62BB913CBDD3700D44954 /* fko_client_timeout.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fko_client_timeout.c; sourceTree = "<group>"; };
D7E62BBA13CBDD3700D44954 /* fko_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fko_common.h; sourceTree = "<group>"; };
D7E62BBB13CBDD3700D44954 /* fko_context.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fko_context.h; sourceTree = "<group>"; };
D7E62BBC13CBDD3700D44954 /* fko_decode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fko_decode.c; sourceTree = "<group>"; };
D7E62BBD13CBDD3700D44954 /* fko_digest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fko_digest.c; sourceTree = "<group>"; };
D7E62BBE13CBDD3700D44954 /* fko_encode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fko_encode.c; sourceTree = "<group>"; };
D7E62BBF13CBDD3700D44954 /* fko_encryption.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fko_encryption.c; sourceTree = "<group>"; };
D7E62BC013CBDD3700D44954 /* fko_error.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fko_error.c; sourceTree = "<group>"; };
D7E62BC113CBDD3700D44954 /* fko_funcs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fko_funcs.c; sourceTree = "<group>"; };
D7E62BC213CBDD3700D44954 /* fko_limits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fko_limits.h; sourceTree = "<group>"; };
D7E62BC313CBDD3700D44954 /* fko_message.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fko_message.c; sourceTree = "<group>"; };
D7E62BC413CBDD3700D44954 /* fko_nat_access.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fko_nat_access.c; sourceTree = "<group>"; };
D7E62BC513CBDD3700D44954 /* fko_rand_value.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fko_rand_value.c; sourceTree = "<group>"; };
D7E62BC613CBDD3700D44954 /* fko_server_auth.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fko_server_auth.c; sourceTree = "<group>"; };
D7E62BC713CBDD3700D44954 /* fko_state.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fko_state.h; sourceTree = "<group>"; };
D7E62BC813CBDD3700D44954 /* fko_timestamp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fko_timestamp.c; sourceTree = "<group>"; };
D7E62BC913CBDD3700D44954 /* fko_user.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fko_user.c; sourceTree = "<group>"; };
D7E62BCA13CBDD3700D44954 /* fko_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fko_util.h; sourceTree = "<group>"; };
D7E62BCC13CBDD3700D44954 /* gpgme_funcs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = gpgme_funcs.c; sourceTree = "<group>"; };
D7E62BCD13CBDD3700D44954 /* gpgme_funcs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gpgme_funcs.h; sourceTree = "<group>"; };
D7E62BCE13CBDD3700D44954 /* md5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = md5.c; sourceTree = "<group>"; };
D7E62BCF13CBDD3700D44954 /* md5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = md5.h; sourceTree = "<group>"; };
D7E62BD113CBDD3700D44954 /* rijndael.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rijndael.c; sourceTree = "<group>"; };
D7E62BD213CBDD3700D44954 /* rijndael.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rijndael.h; sourceTree = "<group>"; };
D7E62BD313CBDD3700D44954 /* sha1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sha1.c; sourceTree = "<group>"; };
D7E62BD413CBDD3700D44954 /* sha1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sha1.h; sourceTree = "<group>"; };
D7E62BD513CBDD3700D44954 /* sha2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sha2.c; sourceTree = "<group>"; };
D7E62BD613CBDD3700D44954 /* sha2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sha2.h; sourceTree = "<group>"; };
D7E62BD713CBDD3700D44954 /* strlcat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strlcat.c; sourceTree = "<group>"; };
D7E62BD813CBDD3700D44954 /* strlcpy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strlcpy.c; sourceTree = "<group>"; };
D7E62BDA13CBDD3700D44954 /* fwknop_client.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fwknop_client.c; sourceTree = "<group>"; };
D7E62BDB13CBDD3700D44954 /* fwknop_client.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fwknop_client.h; sourceTree = "<group>"; };
D7E62BDC13CBDD3700D44954 /* send_spa_packet.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = send_spa_packet.c; sourceTree = "<group>"; };
D7E62BDD13CBDD3700D44954 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; };
D7E62DD913CC12E400D44954 /* bridge_fwknop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bridge_fwknop.h; sourceTree = "<group>"; };
D7ED6D4014189DE00070A866 /* lock_57x57.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = lock_57x57.png; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
1D60588F0D05DD3D006BFB54 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */,
1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */,
288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
080E96DDFE201D6D7F000001 /* Classes */ = {
isa = PBXGroup;
children = (
D7E62BB113CBDD3700D44954 /* libfwknop */,
D7E62BD913CBDD3700D44954 /* fwknop */,
D7E62BDD13CBDD3700D44954 /* config.h */,
D7E62DD913CC12E400D44954 /* bridge_fwknop.h */,
1D3623240D0F684500981E51 /* MyAppDelegate.h */,
1D3623250D0F684500981E51 /* MyAppDelegate.m */,
ABA422D90FEEBE4100C83D50 /* FwknopController.h */,
ABA422DA0FEEBE4100C83D50 /* FwknopController.m */,
D779E41213CAF97A001CF276 /* bridge_fwknop.c */,
);
path = Classes;
sourceTree = "<group>";
};
19C28FACFE9D520D11CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
1D6058910D05DD3D006BFB54 /* Fwknop.app */,
);
name = Products;
sourceTree = "<group>";
};
29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
isa = PBXGroup;
children = (
D779E52B13CB0BEC001CF276 /* lib */,
080E96DDFE201D6D7F000001 /* Classes */,
29B97315FDCFA39411CA2CEA /* Other Sources */,
29B97317FDCFA39411CA2CEA /* Resources */,
29B97323FDCFA39411CA2CEA /* Frameworks */,
19C28FACFE9D520D11CA2CBB /* Products */,
);
name = CustomTemplate;
sourceTree = "<group>";
};
29B97315FDCFA39411CA2CEA /* Other Sources */ = {
isa = PBXGroup;
children = (
32CA4F630368D1EE00C91783 /* Fwknop.pch */,
29B97316FDCFA39411CA2CEA /* main.m */,
);
name = "Other Sources";
sourceTree = "<group>";
};
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
D7ED6D4014189DE00070A866 /* lock_57x57.png */,
8D1107310486CEB800E47090 /* Info.plist */,
);
name = Resources;
sourceTree = "<group>";
};
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
isa = PBXGroup;
children = (
1DF5F4DF0D08C38300B7A737 /* UIKit.framework */,
1D30AB110D05D00D00671497 /* Foundation.framework */,
288765FC0DF74451002DB57D /* CoreGraphics.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
D779E52B13CB0BEC001CF276 /* lib */ = {
isa = PBXGroup;
children = (
);
name = lib;
sourceTree = "<group>";
};
D7E62BB113CBDD3700D44954 /* libfwknop */ = {
isa = PBXGroup;
children = (
D7E62BB213CBDD3700D44954 /* base64.c */,
D7E62BB313CBDD3700D44954 /* base64.h */,
D7E62BB413CBDD3700D44954 /* cipher_funcs.c */,
D7E62BB513CBDD3700D44954 /* cipher_funcs.h */,
D7E62BB613CBDD3700D44954 /* digest.c */,
D7E62BB713CBDD3700D44954 /* digest.h */,
D7E62BB813CBDD3700D44954 /* fko.h */,
D7E62BB913CBDD3700D44954 /* fko_client_timeout.c */,
D7E62BBA13CBDD3700D44954 /* fko_common.h */,
D7E62BBB13CBDD3700D44954 /* fko_context.h */,
D7E62BBC13CBDD3700D44954 /* fko_decode.c */,
D7E62BBD13CBDD3700D44954 /* fko_digest.c */,
D7E62BBE13CBDD3700D44954 /* fko_encode.c */,
D7E62BBF13CBDD3700D44954 /* fko_encryption.c */,
D7E62BC013CBDD3700D44954 /* fko_error.c */,
D7E62BC113CBDD3700D44954 /* fko_funcs.c */,
D7E62BC213CBDD3700D44954 /* fko_limits.h */,
D7E62BC313CBDD3700D44954 /* fko_message.c */,
D7E62BC413CBDD3700D44954 /* fko_nat_access.c */,
D7E62BC513CBDD3700D44954 /* fko_rand_value.c */,
D7E62BC613CBDD3700D44954 /* fko_server_auth.c */,
D7E62BC713CBDD3700D44954 /* fko_state.h */,
D7E62BC813CBDD3700D44954 /* fko_timestamp.c */,
D7E62BC913CBDD3700D44954 /* fko_user.c */,
D7E62BCA13CBDD3700D44954 /* fko_util.h */,
D7E62BCC13CBDD3700D44954 /* gpgme_funcs.c */,
D7E62BCD13CBDD3700D44954 /* gpgme_funcs.h */,
D7E62BCE13CBDD3700D44954 /* md5.c */,
D7E62BCF13CBDD3700D44954 /* md5.h */,
D7E62BD113CBDD3700D44954 /* rijndael.c */,
D7E62BD213CBDD3700D44954 /* rijndael.h */,
D7E62BD313CBDD3700D44954 /* sha1.c */,
D7E62BD413CBDD3700D44954 /* sha1.h */,
D7E62BD513CBDD3700D44954 /* sha2.c */,
D7E62BD613CBDD3700D44954 /* sha2.h */,
D7E62BD713CBDD3700D44954 /* strlcat.c */,
D7E62BD813CBDD3700D44954 /* strlcpy.c */,
D7E33C3E1424559A005D6CB6 /* config.h */,
);
path = libfwknop;
sourceTree = "<group>";
};
D7E62BD913CBDD3700D44954 /* fwknop */ = {
isa = PBXGroup;
children = (
D7E62BDA13CBDD3700D44954 /* fwknop_client.c */,
D7E62BDB13CBDD3700D44954 /* fwknop_client.h */,
D7E62BDC13CBDD3700D44954 /* send_spa_packet.c */,
);
path = fwknop;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
1D6058900D05DD3D006BFB54 /* Fwknop */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "Fwknop" */;
buildPhases = (
1D60588D0D05DD3D006BFB54 /* Resources */,
1D60588E0D05DD3D006BFB54 /* Sources */,
1D60588F0D05DD3D006BFB54 /* Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = Fwknop;
productName = Fwknop;
productReference = 1D6058910D05DD3D006BFB54 /* Fwknop.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Fwknop" */;
compatibilityVersion = "Xcode 3.1";
hasScannedForEncodings = 1;
mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
projectDirPath = "";
projectRoot = "";
targets = (
1D6058900D05DD3D006BFB54 /* Fwknop */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
1D60588D0D05DD3D006BFB54 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
D7ED6D4114189DE00070A866 /* lock_57x57.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
1D60588E0D05DD3D006BFB54 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
1D60589B0D05DD56006BFB54 /* main.m in Sources */,
1D3623260D0F684500981E51 /* MyAppDelegate.m in Sources */,
ABA422DB0FEEBE4100C83D50 /* FwknopController.m in Sources */,
D779E41313CAF97A001CF276 /* bridge_fwknop.c in Sources */,
D7E62BE113CBDD3700D44954 /* base64.c in Sources */,
D7E62BE213CBDD3700D44954 /* cipher_funcs.c in Sources */,
D7E62BE313CBDD3700D44954 /* digest.c in Sources */,
D7E62BE413CBDD3700D44954 /* fko_client_timeout.c in Sources */,
D7E62BE513CBDD3700D44954 /* fko_decode.c in Sources */,
D7E62BE613CBDD3700D44954 /* fko_digest.c in Sources */,
D7E62BE713CBDD3700D44954 /* fko_encode.c in Sources */,
D7E62BE813CBDD3700D44954 /* fko_encryption.c in Sources */,
D7E62BE913CBDD3700D44954 /* fko_error.c in Sources */,
D7E62BEA13CBDD3700D44954 /* fko_funcs.c in Sources */,
D7E62BEB13CBDD3700D44954 /* fko_message.c in Sources */,
D7E62BEC13CBDD3700D44954 /* fko_nat_access.c in Sources */,
D7E62BED13CBDD3700D44954 /* fko_rand_value.c in Sources */,
D7E62BEE13CBDD3700D44954 /* fko_server_auth.c in Sources */,
D7E62BEF13CBDD3700D44954 /* fko_timestamp.c in Sources */,
D7E62BF013CBDD3700D44954 /* fko_user.c in Sources */,
D7E62BF213CBDD3700D44954 /* gpgme_funcs.c in Sources */,
D7E62BF313CBDD3700D44954 /* md5.c in Sources */,
D7E62BF513CBDD3700D44954 /* rijndael.c in Sources */,
D7E62BF613CBDD3700D44954 /* sha1.c in Sources */,
D7E62BF713CBDD3700D44954 /* sha2.c in Sources */,
D7E62BF813CBDD3700D44954 /* strlcat.c in Sources */,
D7E62BF913CBDD3700D44954 /* strlcpy.c in Sources */,
D7E62BFA13CBDD3700D44954 /* fwknop_client.c in Sources */,
D7E62BFB13CBDD3700D44954 /* send_spa_packet.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
1D6058940D05DD3E006BFB54 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = Fwknop.pch;
INFOPLIST_FILE = Info.plist;
PRODUCT_NAME = Fwknop;
};
name = Debug;
};
1D6058950D05DD3E006BFB54 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = Fwknop.pch;
INFOPLIST_FILE = Info.plist;
PRODUCT_NAME = Fwknop;
};
name = Release;
};
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Don't Code Sign";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_PREPROCESSOR_DEFINITIONS = "";
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
SDKROOT = iphoneos2.2.1;
};
name = Debug;
};
C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Don't Code Sign";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
SDKROOT = iphoneos3.1;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "Fwknop" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1D6058940D05DD3E006BFB54 /* Debug */,
1D6058950D05DD3E006BFB54 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Fwknop" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C01FCF4F08A954540054247B /* Debug */,
C01FCF5008A954540054247B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
}

30
iphone/Info.plist Executable file
View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>Fwknop</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>lock_57x57.png</string>
<key>CFBundleIdentifier</key>
<string>com.max2idea.iphone.fwknopclient</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSMainNibFile</key>
<string></string>
</dict>
</plist>

42
iphone/README Executable file
View File

@ -0,0 +1,42 @@
===============================================================================
FWKNOP for Iphone
Max Kastanas <max2idea@users.sourceforge.net>
Based on fwknop C implementation by Damien Stuart
===============================================================================
1. Requirements:
a. MacOSX(10.5.8)
b. XCode ver 4.1.3
===============================================================================
2. Setup
a. Untar the tar.gz file:
tar -zxf Fwknop-0.9.tar.gz
b. Open project with XCode under folder ./iphone
f. The relevant fwknop iphone C code can be found under the
".../iphone/Classes" directory:
1. The "./iphone/Classes/libfwknop" directory should contain all of
the .c and .h files from the main fwknop/lib/ directory (the
libfko source files. You can copy all of the *.[ch] files from
.../fwknop.../lib manually, or use the "get_libfko_files.sh"
script.
2. Keep in mind file fko_common.b will replace the contents of file
fko_common.h. This is needed for additional preprocessor defines
for compilation MacOSX.
===============================================================================
Changelog
v0.9b Dec 16 2011
1) Rijndael client support

BIN
iphone/lock_57x57.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

29
iphone/main.m Executable file
View File

@ -0,0 +1,29 @@
/*
Copyright (C) Max Kastanas 2010
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#import <UIKit/UIKit.h>
int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int val = UIApplicationMain(argc, argv, nil, @"MyAppDelegate");
[pool release];
return val;
}