Professional Linux Programming 1861003013, 9781861003010

As Linux increases its presence throughout the world as a target platform for professional application development, its

360 124 4MB

English Pages 1058 Year 2000

Report DMCA / Copyright

DOWNLOAD PDF FILE

Table of contents :
Table of Contents......Page 2
Professional Linux Programming......Page 20
What's Covered in This Book?......Page 28
Source Code......Page 31
Conventions......Page 32
Overview......Page 33
Iterative development......Page 34
Test Early, Test Often......Page 35
The DVD Store......Page 36
Analyzing the User Requirements......Page 37
Statement of Requirements......Page 42
Use Cases......Page 44
Application Architecture......Page 45
Detailed Design......Page 46
Data Access Functions......Page 47
Member Functions......Page 48
Title Functions......Page 49
Disk Functions......Page 50
Rental Functions......Page 51
Resources......Page 52
Summary......Page 53
Tools for Linux......Page 54
The Repository......Page 55
CVS Command Format......Page 56
Environment Variables......Page 57
Importing a New Project......Page 58
Starting Work on Our Project......Page 59
Checking Our Changes Against the Repository......Page 60
Updating the Repository with Our Changes......Page 61
Releasing the Project......Page 62
Keyword Substitution......Page 63
Revisions......Page 64
Tags......Page 65
Branches......Page 67
Working Collaboratively......Page 72
Accessing CVS Across a Network......Page 74
GUI CVS Clients......Page 76
Summary......Page 78
Choosing a Database......Page 80
Which is Right for Me?......Page 81
Installation and Commissioning......Page 82
First Normal Form......Page 87
A Simple Database......Page 88
Commands to psql......Page 92
Data Definition Commands......Page 93
Data Manipulation Commands......Page 98
Transactions......Page 104
Database Design Tips......Page 105
Resources......Page 106
Summary......Page 107
Libpq......Page 108
ECPG......Page 125
The Application......Page 133
Summary......Page 139
Pre-compiled Packages......Page 140
Building from Source......Page 141
Post-install Configuration......Page 142
Commands......Page 143
Creating Users, and Giving Them Permissions......Page 146
Creating a Database......Page 148
SQL Support in PostgreSQL and MySQL......Page 149
Connection Routines......Page 151
Error Handling......Page 154
Executing SQL Statements......Page 155
Resources......Page 166
Summary......Page 167
Reporting Errors......Page 168
Types of Software Error......Page 171
Debug Statements......Page 172
Assertions......Page 175
Where Are You?......Page 177
Backtrace......Page 179
Preparing to Debug......Page 181
Using the Debugger......Page 182
Simple GDB Commands......Page 183
Other GDB Features......Page 185
Summary......Page 186
X.500 and LDAP......Page 188
Structure of a Directory Server......Page 189
dn Naming......Page 190
Object Components......Page 191
LDAP Directory Tree......Page 193
LDIF Files......Page 194
Steps in Installing OpenLDAP......Page 195
Configuring OpenLDAP......Page 196
Running the Server......Page 198
Accessing LDAP from C......Page 199
Bind to the LDAP Server......Page 200
LDAP Error Handling......Page 201
Searching......Page 202
Adding a New Entry......Page 211
Modifying an Entry......Page 214
Deleting an Entry......Page 216
Summary......Page 217
The GTK+/GNOME libraries......Page 219
libGnorba......Page 220
Types......Page 221
Macros......Page 222
String functions......Page 224
Memory Allocation......Page 225
Lists......Page 226
Widgets......Page 228
Example GTK+ Application......Page 233
GNOME Basics......Page 234
Menus and Toolbars......Page 235
Dialogs......Page 238
Creating a GnomeDialog......Page 239
Example GNOME Application......Page 244
The GNOME Source Tree......Page 246
configure.in......Page 247
Makefile.am......Page 248
Storing data......Page 249
Reading the Stored Data......Page 250
Session Management......Page 251
Command Line Parsing Using popt......Page 253
Summary......Page 256
Overview of Glade......Page 257
A Glade Tutorial......Page 258
Main Window......Page 259
The Palette......Page 260
The Properties Window......Page 263
The Glade-built Source Tree......Page 267
lookup_widget......Page 268
Adding Code......Page 269
libglade......Page 271
The DVD Store GNOME GUI......Page 273
Compiling and Running dvdstore......Page 274
Structure......Page 279
Code......Page 280
Summary......Page 304
Input Structure......Page 305
How Generators Work......Page 307
A Simple Scanner......Page 308
Scanner Specifications......Page 309
Longest Match Principle......Page 313
Regular Expressions......Page 314
Redirecting Scanner Input and Output......Page 316
Returning Tokens......Page 317
Context Sensitive Scanners......Page 318
Parsers......Page 319
Generating Parsers......Page 320
Creating a Syntax Tester......Page 325
Token Types......Page 328
Actions in Rules......Page 329
Options to bison......Page 335
Conflicts in Grammars......Page 336
Arithmetic Expressions......Page 337
Summary......Page 338
Application Architecture......Page 339
General Testing......Page 340
Regression Testing......Page 341
A Test Program......Page 343
Testing the dvdstore Program......Page 347
expect......Page 348
Memory Problems......Page 350
Installing mpatrol......Page 356
Using mpatrol......Page 357
Testing Coverage......Page 361
Performance Testing......Page 368
Summary......Page 370
Stealthy Bugs......Page 371
The Virtue of Paranoia......Page 372
Filesystem Security......Page 373
Authenticating Users......Page 376
Public-Key Crypto......Page 388
On Writing Custom/Proprietary Algorithms......Page 389
Writing Protocols......Page 393
ssh......Page 397
Problems With the Environment......Page 398
Python......Page 404
Internet Information......Page 405
Summary......Page 406
About KDE......Page 407
Installing Qt......Page 408
Programming Applications Using Qt......Page 409
Getting Started: Hello World......Page 410
Simplifying Makefile Management With tmake......Page 411
Signals and Slots......Page 412
'Hello world' Revisited......Page 414
Deriving From Base Classes......Page 415
Widgets......Page 417
Layouts......Page 418
A Simple Text Editor......Page 422
Resources......Page 428
Summary......Page 429
Application Design......Page 430
Main Window......Page 432
Member Dialog......Page 437
Rent Dialog......Page 440
Search Window......Page 442
The Settings Manager......Page 447
Adjusting the Code to KDE......Page 449
Summary......Page 454
Introduction......Page 456
Features......Page 457
Installing Python......Page 460
The Interactive Interpreter......Page 462
'Standalone' Executable......Page 463
Comment Syntax......Page 464
Built-In Data Types and Operators......Page 465
Block Structure Syntax......Page 474
Statement Syntax......Page 475
Functions......Page 481
Built-In Functions......Page 482
Some Modules From The Standard Distribution......Page 483
Classes and Objects......Page 484
An Example Program: Penny Pinching......Page 486
Summary......Page 491
Server-side scripting......Page 493
Installing and Configuring PHP......Page 495
Building and Installing PHP as a CGI Interpreter......Page 496
Building and Installing PHP with Apache as an Apache module......Page 497
Configuring PHP......Page 498
Variables, Constants and Data types......Page 500
Operators in PHP......Page 501
Statements......Page 502
Functions......Page 503
Using PHP with the DVD project......Page 504
HTTP, HTML and PHP......Page 505
Cancellation......Page 507
dvdstorefunctions.php......Page 508
dvdstorecommon.php......Page 513
dvdstorelogin.php......Page 516
dvdstoresearch.php......Page 517
dvdstorecancel.php......Page 519
dvdstorereserve.php......Page 520
Resources......Page 521
Extending Python with a C/C++ extension module......Page 522
Required Software Tools......Page 523
Extending Python Using SWIG......Page 524
Python Object Types......Page 548
Reference Counting and Ownership......Page 549
Overview of Developing C Extension Modules......Page 550
Simple Functions......Page 552
A Slightly More Complex Function......Page 553
Creating New Python Object Types......Page 554
Encapsulating C++ Objects Using the C-API......Page 561
Embedding Python in C/C++ Programs......Page 563
Embedding Python Using High-level Functions......Page 564
Statically Linking a Host Program to an Extension Module......Page 566
Embedding Python Using Lower-level Calls......Page 567
General Suggestions......Page 577
Summary......Page 578
Overview......Page 579
BSD Sockets......Page 580
Coding Issues Using the BSD Socket Interface......Page 584
ONC RPC Architecture and Concepts.......Page 585
Why Use RPC in the DVD Store Application?......Page 586
rpcgen the RPC Protocol Compiler......Page 587
Functions Without Arguments or Return Types......Page 589
Functions with Simple Arguments and Simple Return Types......Page 597
More Complex Examples......Page 598
Returning Arrays......Page 601
Client Timeouts......Page 604
Client-Side Authentication Support......Page 605
Server-Side Authentication Support......Page 606
Using RPC Servers with /etc/inetd.conf......Page 608
Resources......Page 609
Summary......Page 610
The Current State of Affairs......Page 611
Sound......Page 612
Devices......Page 613
Handling Standard Audio Formats......Page 614
Do-It-Yourself......Page 616
Software Players......Page 630
Hardware Players......Page 631
Hybrids......Page 632
References......Page 633
Summary......Page 634
Object Request Broker (ORB)......Page 635
Servers......Page 636
Evaluating CORBA......Page 637
CORBA and RPC......Page 638
CORBA and Sockets......Page 639
DCOM or COM+......Page 640
SOAP......Page 641
Modules......Page 642
Interfaces......Page 643
Template Types......Page 644
Example DVD Application......Page 649
Language Mappings......Page 652
Language Mapping Components......Page 653
C Mappings......Page 654
Simple Messaging......Page 659
The Message Client......Page 660
The Message Server......Page 662
Compiling the ORBit Application......Page 663
Resources......Page 664
Summary......Page 665
Using CORBA for the DVD Store Application......Page 666
Validation Server......Page 667
Log Server......Page 668
DVD Server......Page 669
Putting It All Together......Page 682
Configuring ORBit for Multi-Host Use......Page 683
The Use of CORBA in GNOME......Page 684
Advanced CORBA Functionality......Page 685
CORBAServices......Page 686
Designing and Running Scalable CORBA Services......Page 690
Summary......Page 694
A Little History......Page 695
What, No Disk?......Page 696
How Does It Work?......Page 697
Starting a Diskless System......Page 698
Network Identification for Diskless Systems......Page 699
Running an Operating System......Page 700
Server Configuration......Page 701
Boot Image Creation......Page 703
Diskless Linux Kernel......Page 704
Root File Systems......Page 707
Problems......Page 709
Client Applications......Page 710
Summary......Page 711
Overview......Page 713
XML Syntax......Page 714
Well-formed XML......Page 715
Valid XML......Page 718
DOM......Page 722
libXML a.k.a. gnome-xml......Page 723
The Complete Parser......Page 735
main()......Page 736
start_element()......Page 737
chars_found()......Page 738
get_event_from_name()......Page 739
state_event_machine()......Page 740
Summary......Page 741
Hardware Setup......Page 742
Programming Using MPI......Page 743
The Basic Functionality of an MPI Program......Page 745
Compiling and Executing a Simple MPI Program......Page 746
A Distributed MP3 Encoder......Page 747
Communication Performance of a Beowulf Cluster......Page 749
A Review of Advanced Features of MPI......Page 752
Some MPI Programming Examples:......Page 758
Comparison with MPI......Page 767
A Review of PVM Library Routines......Page 768
A Sample PVM Program......Page 770
Some Useful Beowulf Links......Page 772
Defining the Audience......Page 773
End User Documentation: GUIs......Page 774
Power User/System Administrator Documentation......Page 777
Documentation Tools......Page 787
Developer Documentation......Page 794
Summary......Page 800
Execution Context......Page 802
Module and Initialization Code......Page 803
Example Module Code......Page 804
struct pci_dev......Page 805
Finding PCI Devices......Page 806
PCI Drivers......Page 807
PCI Access Functions......Page 808
Resource Allocation......Page 809
Interrupt Handlers......Page 810
Access to User Space Memory......Page 812
The kiobuf Architecture......Page 814
Locking Primitives......Page 817
Scheduling and Wait Queues......Page 819
Module Use Counts......Page 824
Making It Build......Page 825
What to Do with Your New Driver......Page 827
Submitting a New Driver......Page 828
Summary......Page 829
Overview......Page 830
The RPM User......Page 831
What Do I Have Installed?......Page 832
The RPM Database......Page 833
Anatomy of an RPM Package......Page 841
Source Packages......Page 842
configure, autoconf and automake......Page 843
Source RPM Packages......Page 846
Building an RPM Package......Page 847
Making a Patch......Page 851
GNATS......Page 853
Summary......Page 854
Overview......Page 855
I18N Terminology......Page 856
Unicode......Page 857
ISO 2022: Extension Techniques for Coded Character Sets......Page 862
Programming with Unicode......Page 863
I18N Models and the System Environment......Page 868
The POSIX Locale Model......Page 869
Collation......Page 870
Time......Page 871
The X/Open Portability Guide (XPG)......Page 872
The X Window System......Page 874
Practical Considerations of I18N Programming......Page 879
I18N and Internal Text Processing......Page 880
Category Dimensions......Page 881
Category Conversions......Page 882
Category Message catalogs......Page 883
I18N and Xlib Programming......Page 889
I18N and Linux GUIs......Page 895
I18N in Real Software Development Projects......Page 897
Object Oriented Programming and I18N......Page 898
Application Builders and I18N......Page 899
Where Next for Linux I18N?......Page 901
GtkCheckButton......Page 903
GtkCList......Page 904
GtkCombo......Page 908
GtkEntry......Page 909
GtkHButtonBox......Page 910
GtkLabel......Page 911
GtkMenu......Page 912
GtkMenuItem......Page 913
GtkNotebook......Page 914
GtkOptionMenu......Page 916
GtkScrolledWindow......Page 917
GtkSpinButton......Page 918
GtkTable......Page 919
GtkText......Page 920
GtkWindow......Page 921
GnomeApp......Page 922
GnomeAppBar......Page 923
GnomeDialog......Page 924
GnomeDock......Page 925
GnomeDockItem......Page 926
GnomePropertyBox......Page 927
References......Page 928
Appendix B: The DVD Store RPC Protocol Definition......Page 929
GNU GENERAL PUBLIC LICENSE......Page 935
Preamble......Page 940
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION......Page 941
How to Apply These Terms to Your New Libraries......Page 946
0. PREAMBLE......Page 947
2. VERBATIM COPYING......Page 948
4. MODIFICATIONS......Page 949
5. COMBINING DOCUMENTS......Page 950
10. FUTURE REVISIONS OF THIS LICENSE......Page 951
THE Q PUBLIC LICENSE version 1.0......Page 952
Limitations of Liability......Page 953
Choice of Law......Page 954
forums.apress.com......Page 955
PdftkEmptyString......Page 0

Professional Linux Programming
 1861003013, 9781861003010

  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
File loading please wait...
Recommend Papers